! This method outputs the currently visible data range via \a begin and \a end. The returned range will also never exceed \a rangeRestriction. This method takes into account that the drawing of data lines at the axis rect border always requires the points just outside the visible axis range. So \a begin and \a end may actually indicate a range that contains one additional data point to
| 21122 | axis range. |
| 21123 | */ |
| 21124 | void QCPGraph::getVisibleDataBounds(QCPGraphDataContainer::const_iterator &begin, QCPGraphDataContainer::const_iterator &end, const QCPDataRange &rangeRestriction) const |
| 21125 | { |
| 21126 | if (rangeRestriction.isEmpty()) |
| 21127 | { |
| 21128 | end = mDataContainer->constEnd(); |
| 21129 | begin = end; |
| 21130 | } else |
| 21131 | { |
| 21132 | QCPAxis *keyAxis = mKeyAxis.data(); |
| 21133 | QCPAxis *valueAxis = mValueAxis.data(); |
| 21134 | if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return; } |
| 21135 | // get visible data range: |
| 21136 | begin = mDataContainer->findBegin(keyAxis->range().lower); |
| 21137 | end = mDataContainer->findEnd(keyAxis->range().upper); |
| 21138 | // limit lower/upperEnd to rangeRestriction: |
| 21139 | mDataContainer->limitIteratorsToDataRange(begin, end, rangeRestriction); // this also ensures rangeRestriction outside data bounds doesn't break anything |
| 21140 | } |
| 21141 | } |
| 21142 | |
| 21143 | /*! \internal |
| 21144 |
nothing calls this directly
no test coverage detected