MCPcopy Create free account
hub / github.com/LUX-Core/lux / simplify

Method simplify

src/qt/qcustomplot.cpp:2568–2593  ·  view source on GitHub ↗

! 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 w

Source from the content-addressed store, hash-verified

2566 simplify explicitly set to false.
2567*/
2568void QCPDataSelection::simplify()
2569{
2570 // remove any empty ranges:
2571 for (int i=mDataRanges.size()-1; i>=0; --i)
2572 {
2573 if (mDataRanges.at(i).isEmpty())
2574 mDataRanges.removeAt(i);
2575 }
2576 if (mDataRanges.isEmpty())
2577 return;
2578
2579 // sort ranges by starting value, ascending:
2580 std::sort(mDataRanges.begin(), mDataRanges.end(), lessThanDataRangeBegin);
2581
2582 // join overlapping/contiguous ranges:
2583 int i = 1;
2584 while (i < mDataRanges.size())
2585 {
2586 if (mDataRanges.at(i-1).end() >= mDataRanges.at(i).begin()) // range i overlaps/joins with i-1, so expand range i-1 appropriately and remove range i from list
2587 {
2588 mDataRanges[i-1].setEnd(qMax(mDataRanges.at(i-1).end(), mDataRanges.at(i).end()));
2589 mDataRanges.removeAt(i);
2590 } else
2591 ++i;
2592 }
2593}
2594
2595/*!
2596 Makes sure this data selection conforms to the specified \a type selection type. Before the type

Callers 8

addDataRangeMethod · 0.95
intersectionMethod · 0.80
inverseMethod · 0.80
selectTestRectMethod · 0.80
getDataSegmentsMethod · 0.80
selectTestRectMethod · 0.80
selectTestMethod · 0.80
getDataSegmentsMethod · 0.80

Calls 9

rowCountFunction · 0.85
columnCountFunction · 0.85
removeAtMethod · 0.80
sizeMethod · 0.45
isEmptyMethod · 0.45
atMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected