##// END OF EJS Templates
Spline with problems
Spline with problems

File last commit:

r388:5bb469f288f8
r419:1666cfa56d96
Show More
domain.cpp
69 lines | 1.4 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
Adds isEmpty to domain
r388 bool Domain::isEmpty() const
{
return spanX()==0 || spanY()==0;
}
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