##// END OF EJS Templates
Refactor the new QXYSeries::pointAt() -> QXYSeries::at()...
Miikka Heikkinen -
r2491:d86f47a4910b
parent child
Show More
@@ -88,7 +88,7 void LineChartItem::updateGeometry()
88 qreal minX = domain()->minX();
88 qreal minX = domain()->minX();
89 qreal maxX = domain()->maxX();
89 qreal maxX = domain()->maxX();
90 qreal minY = domain()->minY();
90 qreal minY = domain()->minY();
91 QPointF currentSeriesPoint = m_series->pointAt(0);
91 QPointF currentSeriesPoint = m_series->at(0);
92 QPointF currentGeometryPoint = points.at(0);
92 QPointF currentGeometryPoint = points.at(0);
93 QPointF previousGeometryPoint = points.at(0);
93 QPointF previousGeometryPoint = points.at(0);
94 int size = m_linePen.width();
94 int size = m_linePen.width();
@@ -129,7 +129,7 void LineChartItem::updateGeometry()
129 // degrees and both of the points are within the margin, one in the top half and one in the
129 // degrees and both of the points are within the margin, one in the top half and one in the
130 // bottom half of the chart, the bottom one gets clipped incorrectly.
130 // bottom half of the chart, the bottom one gets clipped incorrectly.
131 // However, this should be rare occurrence in any sensible chart.
131 // However, this should be rare occurrence in any sensible chart.
132 currentSeriesPoint = m_series->pointAt(qMin(seriesLastIndex, i));
132 currentSeriesPoint = m_series->at(qMin(seriesLastIndex, i));
133 currentGeometryPoint = points.at(i);
133 currentGeometryPoint = points.at(i);
134 pointOffGrid = (currentSeriesPoint.x() < minX || currentSeriesPoint.x() > maxX);
134 pointOffGrid = (currentSeriesPoint.x() < minX || currentSeriesPoint.x() > maxX);
135
135
@@ -149,7 +149,7 void LineChartItem::updateGeometry()
149
149
150 bool dummyOk; // We know points are ok, but this is needed
150 bool dummyOk; // We know points are ok, but this is needed
151 qreal currentAngle = static_cast<PolarDomain *>(domain())->toAngularCoordinate(currentSeriesPoint.x(), dummyOk);
151 qreal currentAngle = static_cast<PolarDomain *>(domain())->toAngularCoordinate(currentSeriesPoint.x(), dummyOk);
152 qreal previousAngle = static_cast<PolarDomain *>(domain())->toAngularCoordinate(m_series->pointAt(i - 1).x(), dummyOk);
152 qreal previousAngle = static_cast<PolarDomain *>(domain())->toAngularCoordinate(m_series->at(i - 1).x(), dummyOk);
153
153
154 if ((qAbs(currentAngle - previousAngle) > 180.0)) {
154 if ((qAbs(currentAngle - previousAngle) > 180.0)) {
155 // If the angle between two points is over 180 degrees (half X range),
155 // If the angle between two points is over 180 degrees (half X range),
@@ -140,7 +140,7 void ScatterChartItem::updateGeometry()
140 // Note that marker map values can be technically incorrect during the animation,
140 // Note that marker map values can be technically incorrect during the animation,
141 // if it was caused by an insert, but this shouldn't be a problem as the points are
141 // if it was caused by an insert, but this shouldn't be a problem as the points are
142 // fake anyway.
142 // fake anyway.
143 m_markerMap[item] = m_series->pointAt(qMin(seriesLastIndex, i));
143 m_markerMap[item] = m_series->at(qMin(seriesLastIndex, i));
144 item->setPos(point.x() - rect.width() / 2, point.y() - rect.height() / 2);
144 item->setPos(point.x() - rect.width() / 2, point.y() - rect.height() / 2);
145
145
146 if (!m_visible || offGridStatus.at(i))
146 if (!m_visible || offGridStatus.at(i))
@@ -119,7 +119,7 void SplineChartItem::updateGeometry()
119 qreal minX = domain()->minX();
119 qreal minX = domain()->minX();
120 qreal maxX = domain()->maxX();
120 qreal maxX = domain()->maxX();
121 qreal minY = domain()->minY();
121 qreal minY = domain()->minY();
122 QPointF currentSeriesPoint = m_series->pointAt(0);
122 QPointF currentSeriesPoint = m_series->at(0);
123 QPointF currentGeometryPoint = points.at(0);
123 QPointF currentGeometryPoint = points.at(0);
124 QPointF previousGeometryPoint = points.at(0);
124 QPointF previousGeometryPoint = points.at(0);
125 bool pointOffGrid = false;
125 bool pointOffGrid = false;
@@ -157,7 +157,7 void SplineChartItem::updateGeometry()
157 // degrees and both of the points are within the margin, one in the top half and one in the
157 // degrees and both of the points are within the margin, one in the top half and one in the
158 // bottom half of the chart, the bottom one gets clipped incorrectly.
158 // bottom half of the chart, the bottom one gets clipped incorrectly.
159 // However, this should be rare occurrence in any sensible chart.
159 // However, this should be rare occurrence in any sensible chart.
160 currentSeriesPoint = m_series->pointAt(qMin(seriesLastIndex, i));
160 currentSeriesPoint = m_series->at(qMin(seriesLastIndex, i));
161 currentGeometryPoint = points.at(i);
161 currentGeometryPoint = points.at(i);
162 pointOffGrid = (currentSeriesPoint.x() < minX || currentSeriesPoint.x() > maxX);
162 pointOffGrid = (currentSeriesPoint.x() < minX || currentSeriesPoint.x() > maxX);
163
163
@@ -165,7 +165,7 void SplineChartItem::updateGeometry()
165 if (!pointOffGrid || !previousPointWasOffGrid) {
165 if (!pointOffGrid || !previousPointWasOffGrid) {
166 bool dummyOk; // We know points are ok, but this is needed
166 bool dummyOk; // We know points are ok, but this is needed
167 qreal currentAngle = static_cast<PolarDomain *>(domain())->toAngularCoordinate(currentSeriesPoint.x(), dummyOk);
167 qreal currentAngle = static_cast<PolarDomain *>(domain())->toAngularCoordinate(currentSeriesPoint.x(), dummyOk);
168 qreal previousAngle = static_cast<PolarDomain *>(domain())->toAngularCoordinate(m_series->pointAt(i - 1).x(), dummyOk);
168 qreal previousAngle = static_cast<PolarDomain *>(domain())->toAngularCoordinate(m_series->at(i - 1).x(), dummyOk);
169
169
170 if ((qAbs(currentAngle - previousAngle) > 180.0)) {
170 if ((qAbs(currentAngle - previousAngle) > 180.0)) {
171 // If the angle between two points is over 180 degrees (half X range),
171 // If the angle between two points is over 180 degrees (half X range),
@@ -368,7 +368,7 QList<QPointF> QXYSeries::points() const
368 /*!
368 /*!
369 Returns point at \a index in internal points vector.
369 Returns point at \a index in internal points vector.
370 */
370 */
371 const QPointF &QXYSeries::pointAt(int index) const
371 const QPointF &QXYSeries::at(int index) const
372 {
372 {
373 Q_D(const QXYSeries);
373 Q_D(const QXYSeries);
374 return d->m_points.at(index);
374 return d->m_points.at(index);
@@ -56,7 +56,7 public:
56
56
57 int count() const;
57 int count() const;
58 QList<QPointF> points() const;
58 QList<QPointF> points() const;
59 const QPointF &pointAt(int index) const;
59 const QPointF &at(int index) const;
60
60
61 QXYSeries &operator << (const QPointF &point);
61 QXYSeries &operator << (const QPointF &point);
62 QXYSeries &operator << (const QList<QPointF> &points);
62 QXYSeries &operator << (const QList<QPointF> &points);
@@ -79,7 +79,7 QVector<bool> XYChart::offGridStatusVector()
79 const int seriesLastIndex = m_series->count() - 1;
79 const int seriesLastIndex = m_series->count() - 1;
80
80
81 for (int i = 0; i < m_points.size(); i++) {
81 for (int i = 0; i < m_points.size(); i++) {
82 const QPointF &seriesPoint = m_series->pointAt(qMin(seriesLastIndex, i));
82 const QPointF &seriesPoint = m_series->at(qMin(seriesLastIndex, i));
83 if (seriesPoint.x() < minX
83 if (seriesPoint.x() < minX
84 || seriesPoint.x() > maxX
84 || seriesPoint.x() > maxX
85 || seriesPoint.y() < minY
85 || seriesPoint.y() < minY
General Comments 0
You need to be logged in to leave comments. Login now