plotdomain.cpp
45 lines
| 807 B
| text/x-c
|
CppLexer
/ src / plotdomain.cpp
Michal Klocek
|
r67 | #include "plotdomain_p.h" | ||
Michal Klocek
|
r25 | |||
Tero Ahola
|
r30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||
Michal Klocek
|
r25 | |||
Michal Klocek
|
r67 | PlotDomain::PlotDomain(): | ||
Michal Klocek
|
r25 | m_minX(0), | ||
m_maxX(0), | ||||
m_minY(0), | ||||
m_maxY(0) | ||||
{ | ||||
} | ||||
Michal Klocek
|
r67 | PlotDomain::~PlotDomain() | ||
Michal Klocek
|
r25 | { | ||
// TODO Auto-generated destructor stub | ||||
} | ||||
Michal Klocek
|
r67 | qreal PlotDomain::spanX() const | ||
Michal Klocek
|
r25 | { | ||
Q_ASSERT(m_maxX >= m_minX); | ||||
return m_maxX - m_minX; | ||||
} | ||||
Michal Klocek
|
r67 | qreal PlotDomain::spanY() const | ||
Michal Klocek
|
r25 | { | ||
Q_ASSERT(m_maxY >= m_minY); | ||||
return m_maxY - m_minY; | ||||
} | ||||
Michal Klocek
|
r115 | PlotDomain PlotDomain::subDomain(const QRectF& rect, qreal maxWidth,qreal maxHeight) const | ||
Michal Klocek
|
r76 | { | ||
PlotDomain 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; | ||||
} | ||||
Tero Ahola
|
r30 | QTCOMMERCIALCHART_END_NAMESPACE | ||