MCPcopy Index your code
hub / github.com/Audio4Linux/JDSP4Linux / enforceType

Method enforceType

3rdparty/qcustomplot/qcustomplot.cpp:2637–2676  ·  view source on GitHub ↗

! Makes sure this data selection conforms to the specified \a type selection type. Before the type is enforced, \ref simplify is called. Depending on \a 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 \a type, the data selection is not changed. \se

Source from the content-addressed store, hash-verified

2635 \see QCP::SelectionType
2636*/
2637void QCPDataSelection::enforceType(QCP::SelectionType type)
2638{
2639 simplify();
2640 switch (type)
2641 {
2642 case QCP::stNone:
2643 {
2644 mDataRanges.clear();
2645 break;
2646 }
2647 case QCP::stWhole:
2648 {
2649 // whole selection isn't defined by data range, so don't change anything (is handled in plottable methods)
2650 break;
2651 }
2652 case QCP::stSingleData:
2653 {
2654 // reduce all data ranges to the single first data point:
2655 if (!mDataRanges.isEmpty())
2656 {
2657 if (mDataRanges.size() > 1)
2658 mDataRanges = QList<QCPDataRange>() << mDataRanges.first();
2659 if (mDataRanges.first().length() > 1)
2660 mDataRanges.first().setEnd(mDataRanges.first().begin()+1);
2661 }
2662 break;
2663 }
2664 case QCP::stDataRange:
2665 {
2666 if (!isEmpty())
2667 mDataRanges = QList<QCPDataRange>() << span();
2668 break;
2669 }
2670 case QCP::stMultipleDataRanges:
2671 {
2672 // this is the selection type that allows all concievable combinations of ranges, so do nothing
2673 break;
2674 }
2675 }
2676}
2677
2678/*!
2679 Returns true if the data selection \a other is contained entirely in this data selection, i.e.

Callers 2

setSelectionMethod · 0.80
setSelectableMethod · 0.80

Calls 6

isEmptyFunction · 0.85
lengthMethod · 0.80
clearMethod · 0.45
isEmptyMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected