##// END OF EJS Templates
Blocks auto test on win32
Blocks auto test on win32

File last commit:

r222:9497ff6ff131
r254:0045e32956f4
Show More
domain.cpp
64 lines | 1.3 KiB | text/x-c | CppLexer
Michal Klocek
Refactors qchart , adds line animation...
r131 #include "domain_p.h"
QTCOMMERCIALCHART_BEGIN_NAMESPACE
Michal Klocek
Add min max constuctor to domain
r221 Domain::Domain(qreal minX, qreal maxX, qreal minY, qreal maxY):
m_minX(minX),
m_maxX(maxX),
m_minY(minY),
m_maxY(maxY)
Michal Klocek
Refactors qchart , adds line animation...
r131 {
}
Domain::~Domain()
{
}
qreal Domain::spanX() const
{
Q_ASSERT(m_maxX >= m_minX);
return m_maxX - m_minX;
}
qreal Domain::spanY() const
{
Q_ASSERT(m_maxY >= m_minY);
return m_maxY - m_minY;
}
Michal Klocek
Refactored for MVP...
r139 Domain Domain::subDomain(const QRectF& rect, qreal maxWidth,qreal maxHeight) const
Michal Klocek
Refactors qchart , adds line animation...
r131 {
Domain domain;
qreal dx = spanX() / maxWidth;
qreal dy = spanY() / maxHeight;
domain.m_minX = m_minX + dx * rect.left();
domain.m_maxX = m_minX + dx * rect.right();
domain.m_minY = m_maxY - dy * rect.bottom();
domain.m_maxY = m_maxY - dy * rect.top();
return domain;
}
Michal Klocek
Add overloaded comparison operators to domain
r220
bool operator== (const Domain &domain1, const Domain &domain2)
{
return (domain1.m_maxX == domain2.m_maxX &&
domain1.m_maxY == domain2.m_maxY &&
domain1.m_minX == domain2.m_minX &&
domain1.m_minY == domain2.m_minY);
}
bool operator!= (const Domain &domain1, const Domain &domain2)
{
return !(domain1 == domain2);
}
Michal Klocek
Adds debug operator to domain
r222
QDebug operator<<(QDebug dbg, const Domain &domain)
{
dbg.nospace() << "Domain("<<domain.m_minX<<','<<domain.m_maxX<<','<<domain.m_minY<<','<<domain.m_maxY<<')';
return dbg.maybeSpace();
}
Michal Klocek
Refactors qchart , adds line animation...
r131 QTCOMMERCIALCHART_END_NAMESPACE