##// END OF EJS Templates
Remove header.GPL now that it exists in QtBase...
Remove header.GPL now that it exists in QtBase Change-Id: I2cb53cb638b00bef34a313b0678066ef91c6d7a2 Reviewed-by: Tomi Korpipää <tomi.korpipaa@theqtcompany.com> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>

File last commit:

r2855:aa5aba329d30
r2856:f5f060e330b7
Show More
xydomain.cpp
213 lines | 5.8 KiB | text/x-c | CppLexer
Miikka Heikkinen
Updated license...
r2854 /****************************************************************************
Jani Honkonen
Add license headers
r794 **
Miikka Heikkinen
Updated license...
r2854 ** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
Jani Honkonen
Add license headers
r794 **
Miikka Heikkinen
Updated license...
r2854 ** This file is part of the Qt Charts module of the Qt Toolkit.
Jani Honkonen
Add license headers
r794 **
Miikka Heikkinen
Updated license...
r2854 ** $QT_BEGIN_LICENSE:GPL$
Titta Heikkala
Updated license headers...
r2845 ** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
Miikka Heikkinen
Updated license...
r2854 ** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 or (at your option) any later version
** approved by the KDE Free Qt Foundation. The licenses are as published by
** the Free Software Foundation and appearing in the file LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
Jani Honkonen
Add license headers
r794 **
Titta Heikkala
Updated license headers...
r2845 ** $QT_END_LICENSE$
**
Miikka Heikkinen
Updated license...
r2854 ****************************************************************************/
Jani Honkonen
Add license headers
r794
Titta Heikkala
Fix include syntax...
r2714 #include <private/xydomain_p.h>
#include <private/qabstractaxis_p.h>
#include <QtCore/QtMath>
Michal Klocek
Refactors qchart , adds line animation...
r131
Titta Heikkala
Qt Charts project file structure change...
r2712 QT_CHARTS_BEGIN_NAMESPACE
Michal Klocek
Refactors qchart , adds line animation...
r131
Marek Rosa
Domains added
r2275 XYDomain::XYDomain(QObject *parent)
: AbstractDomain(parent)
Michal Klocek
Refactors qchart , adds line animation...
r131 {
}
Marek Rosa
Domains added
r2275 XYDomain::~XYDomain()
Michal Klocek
Refactors qchart , adds line animation...
r131 {
}
Marek Rosa
Domains added
r2275 void XYDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY)
Michal Klocek
Adds loosenumber algorithm...
r678 {
Michal Klocek
Refactor axis hadnling...
r1078 bool axisXChanged = false;
bool axisYChanged = false;
Michal Klocek
Refactor domain model...
r439
Marek Rosa
Replaced qFuzzyIsNull with qFuzzyCompare. Once qchart test case still uses qFuzzyIsNull becasue it started failing when qFuzzyCompare was used
r2242 if (!qFuzzyCompare(m_minX, minX) || !qFuzzyCompare(m_maxX, maxX)) {
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 m_minX = minX;
m_maxX = maxX;
axisXChanged = true;
Michal Klocek
Bugfix resize event during zoomin
r2289 if(!m_signalsBlocked)
emit rangeHorizontalChanged(m_minX, m_maxX);
Michal Klocek
Adds loosenumber algorithm...
r678 }
Marek Rosa
Replaced qFuzzyIsNull with qFuzzyCompare. Once qchart test case still uses qFuzzyIsNull becasue it started failing when qFuzzyCompare was used
r2242 if (!qFuzzyCompare(m_minY, minY) || !qFuzzyCompare(m_maxY, maxY)) {
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 m_minY = minY;
m_maxY = maxY;
axisYChanged = true;
Michal Klocek
Bugfix resize event during zoomin
r2289 if(!m_signalsBlocked)
emit rangeVerticalChanged(m_minY, m_maxY);
Michal Klocek
Adds loosenumber algorithm...
r678 }
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if (axisXChanged || axisYChanged)
Michal Klocek
Refactors Domain and Axis...
r1698 emit updated();
Michal Klocek
Refactor domain model...
r439 }
Michal Klocek
Adds loosenumber algorithm...
r678
Michal Klocek
Refactors qchart , adds line animation...
r131
Marek Rosa
Domains added
r2275 void XYDomain::zoomIn(const QRectF &rect)
Michal Klocek
Refactors qchart , adds line animation...
r131 {
Miikka Heikkinen
Added QChart::zoomReset() and QChart::isZoomed()...
r2545 storeZoomReset();
Michal Klocek
Refactors internals...
r2273 qreal dx = spanX() / m_size.width();
qreal dy = spanY() / m_size.height();
Michal Klocek
Refactors qchart , adds line animation...
r131
Michal Klocek
Refactor axis hadnling...
r1078 qreal maxX = m_maxX;
qreal minX = m_minX;
qreal minY = m_minY;
qreal maxY = m_maxY;
Michal Klocek
Refactor domain model...
r439
Michal Klocek
Refactor axis hadnling...
r1078 maxX = minX + dx * rect.right();
minX = minX + dx * rect.left();
minY = maxY - dy * rect.bottom();
maxY = maxY - dy * rect.top();
Michal Klocek
Adds loosenumber algorithm...
r678
Titta Heikkala
Fix zooming...
r2728 if ((maxX - minX) == spanX()) {
minX = m_minX;
maxX = m_maxX;
}
if ((maxY - minY) == spanY()) {
minY = m_minY;
maxY = m_maxY;
}
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 setRange(minX, maxX, minY, maxY);
Michal Klocek
Refactor domain model...
r439 }
Marek Rosa
Domains added
r2275 void XYDomain::zoomOut(const QRectF &rect)
Michal Klocek
Refactor domain model...
r439 {
Miikka Heikkinen
Added QChart::zoomReset() and QChart::isZoomed()...
r2545 storeZoomReset();
Michal Klocek
Refactor domain model...
r439 qreal dx = spanX() / rect.width();
qreal dy = spanY() / rect.height();
Michal Klocek
Refactors qchart , adds line animation...
r131
Michal Klocek
Refactor axis hadnling...
r1078 qreal maxX = m_maxX;
qreal minX = m_minX;
qreal minY = m_minY;
qreal maxY = m_maxY;
Michal Klocek
Refactors qchart , adds line animation...
r131
Michal Klocek
Refactor axis hadnling...
r1078 minX = maxX - dx * rect.right();
Michal Klocek
Refactors internals...
r2273 maxX = minX + dx * m_size.width();
Michal Klocek
Refactor axis hadnling...
r1078 maxY = minY + dy * rect.bottom();
Michal Klocek
Refactors internals...
r2273 minY = maxY - dy * m_size.height();
Michal Klocek
Refactor axis hadnling...
r1078
Titta Heikkala
Fix zooming...
r2728 if ((maxX - minX) == spanX()) {
minX = m_minX;
maxX = m_maxX;
}
if ((maxY - minY) == spanY()) {
minY = m_minY;
maxY = m_maxY;
}
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 setRange(minX, maxX, minY, maxY);
Michal Klocek
Adds scroll support...
r531 }
Marek Rosa
Domains added
r2275 void XYDomain::move(qreal dx, qreal dy)
Michal Klocek
Adds scroll support...
r531 {
Michal Klocek
Refactors internals...
r2273 qreal x = spanX() / m_size.width();
qreal y = spanY() / m_size.height();
Michal Klocek
Adds scroll support...
r531
Michal Klocek
Refactor axis hadnling...
r1078 qreal maxX = m_maxX;
qreal minX = m_minX;
qreal minY = m_minY;
qreal maxY = m_maxY;
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if (dx != 0) {
Michal Klocek
Refactor axis hadnling...
r1078 minX = minX + x * dx;
maxX = maxX + x * dx;
Michal Klocek
Adds scroll support...
r531 }
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if (dy != 0) {
Michal Klocek
Refactor axis hadnling...
r1078 minY = minY + y * dy;
maxY = maxY + y * dy;
Michal Klocek
Adds scroll support...
r531 }
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 setRange(minX, maxX, minY, maxY);
Michal Klocek
Refactor domain model...
r439 }
Marek Rosa
Negative values with log axis handled
r2356 QPointF XYDomain::calculateGeometryPoint(const QPointF &point, bool &ok) const
Michal Klocek
Adds loosenumber algorithm...
r678 {
Michal Klocek
Refactors internals...
r2273 const qreal deltaX = m_size.width() / (m_maxX - m_minX);
const qreal deltaY = m_size.height() / (m_maxY - m_minY);
qreal x = (point.x() - m_minX) * deltaX;
qreal y = (point.y() - m_minY) * -deltaY + m_size.height();
Marek Rosa
Negative values with log axis handled
r2356 ok = true;
Michal Klocek
Refactors internals...
r2273 return QPointF(x, y);
Michal Klocek
Adds loosenumber algorithm...
r678 }
Miikka Heikkinen
Accelerating lineseries with OpenGL...
r2820 QVector<QPointF> XYDomain::calculateGeometryPoints(const QVector<QPointF> &vector) const
Michal Klocek
Adds missing ticks hadnling
r554 {
Michal Klocek
Refactors internals...
r2273 const qreal deltaX = m_size.width() / (m_maxX - m_minX);
const qreal deltaY = m_size.height() / (m_maxY - m_minY);
QVector<QPointF> result;
result.resize(vector.count());
for (int i = 0; i < vector.count(); ++i) {
qreal x = (vector[i].x() - m_minX) * deltaX;
qreal y = (vector[i].y() - m_minY) * -deltaY + m_size.height();
result[i].setX(x);
result[i].setY(y);
}
return result;
Michal Klocek
Adds missing ticks hadnling
r554 }
Marek Rosa
Domains added
r2275 QPointF XYDomain::calculateDomainPoint(const QPointF &point) const
Michal Klocek
Refactors internals...
r2273 {
const qreal deltaX = m_size.width() / (m_maxX - m_minX);
const qreal deltaY = m_size.height() / (m_maxY - m_minY);
qreal x = point.x() / deltaX + m_minX;
qreal y = (point.y() - m_size.height()) / (-deltaY) + m_minY;
return QPointF(x, y);
}
// operators
Robin Burchell
charts: Follow Qt's already-existent -developer-build option....
r2855 bool Q_AUTOTEST_EXPORT operator== (const XYDomain &domain1, const XYDomain &domain2)
Michal Klocek
Add overloaded comparison operators to domain
r220 {
Miikka Heikkinen
Add Polar chart support...
r2483 return (qFuzzyCompare(domain1.m_maxX, domain2.m_maxX)
&& qFuzzyCompare(domain1.m_maxY, domain2.m_maxY)
&& qFuzzyCompare(domain1.m_minX, domain2.m_minX)
&& qFuzzyCompare(domain1.m_minY, domain2.m_minY));
Michal Klocek
Add overloaded comparison operators to domain
r220 }
Michal Klocek
Another attempt to fix issue with visual sutudio hidden export attributes in domain
r1066
Robin Burchell
charts: Follow Qt's already-existent -developer-build option....
r2855 bool Q_AUTOTEST_EXPORT operator!= (const XYDomain &domain1, const XYDomain &domain2)
Michal Klocek
Add overloaded comparison operators to domain
r220 {
return !(domain1 == domain2);
}
Michal Klocek
Another attempt to fix issue with visual sutudio hidden export attributes in domain
r1066
Robin Burchell
charts: Follow Qt's already-existent -developer-build option....
r2855 QDebug Q_AUTOTEST_EXPORT operator<<(QDebug dbg, const XYDomain &domain)
Michal Klocek
Adds debug operator to domain
r222 {
Titta Heikkala
Fix Chart build when QT_NO_TEXTSTREAM is defined...
r2620 #ifdef QT_NO_TEXTSTREAM
Q_UNUSED(domain)
#else
Marek Rosa
Domains added
r2275 dbg.nospace() << "AbstractDomain(" << domain.m_minX << ',' << domain.m_maxX << ',' << domain.m_minY << ',' << domain.m_maxY << ')' << domain.m_size;
Titta Heikkala
Fix Chart build when QT_NO_TEXTSTREAM is defined...
r2620 #endif
Michal Klocek
Adds debug operator to domain
r222 return dbg.maybeSpace();
}
Marek Rosa
Domains added
r2275 #include "moc_xydomain_p.cpp"
Michal Klocek
Refactor domain model...
r439
Titta Heikkala
Qt Charts project file structure change...
r2712 QT_CHARTS_END_NAMESPACE