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

Method inverse

src/qt/qcustomplot.cpp:2706–2724  ·  view source on GitHub ↗

! Returns a data selection which is the exact inverse of this data selection, with \a outerRange defining the base range on which to invert. If \a outerRange is smaller than the \ref span of this data selection, it is expanded accordingly. For example, this method can be used to retrieve all unselected segments by setting \a outerRange to the full data range of the plottable, and callin

Source from the content-addressed store, hash-verified

2704 selected segments.
2705*/
2706QCPDataSelection QCPDataSelection::inverse(const QCPDataRange &outerRange) const
2707{
2708 if (isEmpty())
2709 return QCPDataSelection(outerRange);
2710 QCPDataRange fullRange = outerRange.expanded(span());
2711
2712 QCPDataSelection result;
2713 // first unselected segment:
2714 if (mDataRanges.first().begin() != fullRange.begin())
2715 result.addDataRange(QCPDataRange(fullRange.begin(), mDataRanges.first().begin()), false);
2716 // intermediate unselected segments:
2717 for (int i=1; i<mDataRanges.size(); ++i)
2718 result.addDataRange(QCPDataRange(mDataRanges.at(i-1).end(), mDataRanges.at(i).begin()), false);
2719 // last unselected segment:
2720 if (mDataRanges.last().end() != fullRange.end())
2721 result.addDataRange(QCPDataRange(mDataRanges.last().end(), fullRange.end()), false);
2722 result.simplify();
2723 return result;
2724}
2725/* end of 'src/selection.cpp' */
2726
2727

Callers 2

getDataSegmentsMethod · 0.80
getDataSegmentsMethod · 0.80

Calls 8

isEmptyFunction · 0.85
expandedMethod · 0.80
addDataRangeMethod · 0.80
simplifyMethod · 0.80
beginMethod · 0.45
sizeMethod · 0.45
endMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected