|QCPDataSelection (const QCPDataRange &range)|
|void||addDataRange (const QCPDataRange &dataRange, bool simplify=true)|
|bool||contains (const QCPDataSelection &other) const|
|int||dataPointCount () const|
|QCPDataRange||dataRange (int index=0) const|
|int||dataRangeCount () const|
|QList< QCPDataRange >||dataRanges () const|
|void||enforceType (QCP::SelectionType type)|
|QCPDataSelection||intersection (const QCPDataRange &other) const|
|QCPDataSelection||intersection (const QCPDataSelection &other) const|
|QCPDataSelection||inverse (const QCPDataRange &outerRange) const|
|bool||isEmpty () const|
|bool||operator!= (const QCPDataSelection &other) const|
|QCPDataSelection &||operator+= (const QCPDataRange &other)|
|QCPDataSelection &||operator+= (const QCPDataSelection &other)|
|QCPDataSelection &||operator-= (const QCPDataRange &other)|
|QCPDataSelection &||operator-= (const QCPDataSelection &other)|
|bool||operator== (const QCPDataSelection &other) const|
|QCPDataRange||span () const|
(Note that these are not member functions.)
|QDebug||operator<< (QDebug d, const QCPDataSelection &selection)|
Describes a data set by holding multiple QCPDataRange instances.
The data selection can be modified with addition and subtraction operators which take QCPDataSelection and QCPDataRange instances, as well as methods such as addDataRange and clear. Read access is provided by dataRange, dataRanges, dataRangeCount, etc.
The method simplify is used to join directly adjacent or even overlapping QCPDataRange instances. QCPDataSelection automatically simplifies when using the addition/subtraction operators. The only case when simplify is left to the user, is when calling addDataRange, with the parameter simplify explicitly set to false. This is useful if many data ranges will be added to the selection successively and the overhead for simplifying after each iteration shall be avoided. In this case, you should make sure to call simplify after completing the operation.
As an example, the following code snippet calculates the average value of a graph's data selection:
Constructor & Destructor Documentation
Member Function Documentation
|void QCPDataSelection::addDataRange||(||const QCPDataRange &||dataRange,|
Adds the given dataRange to this data selection. This is equivalent to the += operator but allows disabling immediate simplification by setting simplify to false. This can improve performance if adding a very large amount of data ranges successively. In this case, make sure to call simplify manually, after the operation.
|bool QCPDataSelection::contains||(||const QCPDataSelection &||other||)||const|
|QCPDataRange QCPDataSelection::dataRange||(||int||index = ||)||const|
Makes sure this data selection conforms to the specified type selection type. Before the type is enforced, simplify is called.
Depending on type, enforcing means adding new data points that were previously not part of the selection, or removing data points from the selection. If the current selection already conforms to type, the data selection is not changed.
- See also
Returns a data selection containing the points which are both in this data selection and in the data range other.
A common use case is to limit an unknown data selection to the valid range of a data container, using QCPDataContainer::dataRange as other. One can then safely iterate over the returned data selection without exceeding the data container's bounds.
Returns a data selection which is the exact inverse of this data selection, with outerRange defining the base range on which to invert. If outerRange is smaller than the span of this data selection, it is expanded accordingly.
For example, this method can be used to retrieve all unselected segments by setting outerRange to the full data range of the plottable, and calling this method on a data selection holding the selected segments.
|bool QCPDataSelection::operator==||(||const QCPDataSelection &||other||)||const|
Returns true if this selection is identical (contains the same data ranges with the same begin and end indices) to other.
Note that both data selections must be in simplified state (the usual state of the selection, see simplify) for this operator to return correct results.
Sorts all data ranges by range begin index in ascending order, and then joins directly adjacent or overlapping ranges. This can reduce the number of individual data ranges in the selection, and prevents possible double-counting when iterating over the data points held by the data ranges.
This method is automatically called when using the addition/subtraction operators. The only case when simplify is left to the user, is when calling addDataRange, with the parameter simplify explicitly set to false.
Friends And Related Function Documentation
The documentation for this class was generated from the following files: