![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
A selection decorator which draws brackets around each selected data segment. More...
#include <qcustomplot.h>


Public Types | |
| enum | BracketStyle { bsSquareBracket , bsHalfEllipse , bsEllipse , bsPlus , bsUserStyle } |
Public Member Functions | |
| QCPSelectionDecoratorBracket () | |
| virtual | ~QCPSelectionDecoratorBracket () |
| QPen | bracketPen () const |
| QBrush | bracketBrush () const |
| int | bracketWidth () const |
| int | bracketHeight () const |
| BracketStyle | bracketStyle () const |
| bool | tangentToData () const |
| int | tangentAverage () const |
| void | setBracketPen (const QPen &pen) |
| void | setBracketBrush (const QBrush &brush) |
| void | setBracketWidth (int width) |
| void | setBracketHeight (int height) |
| void | setBracketStyle (BracketStyle style) |
| void | setTangentToData (bool enabled) |
| void | setTangentAverage (int pointCount) |
| virtual void | drawBracket (QCPPainter *painter, int direction) const |
| virtual void | drawDecoration (QCPPainter *painter, QCPDataSelection selection) |
Public Member Functions inherited from QCPSelectionDecorator | |
| QCPSelectionDecorator () | |
| virtual | ~QCPSelectionDecorator () |
| QPen | pen () const |
| QBrush | brush () const |
| QCPScatterStyle | scatterStyle () const |
| QCPScatterStyle::ScatterProperties | usedScatterProperties () const |
| void | setPen (const QPen &pen) |
| void | setBrush (const QBrush &brush) |
| void | setScatterStyle (const QCPScatterStyle &scatterStyle, QCPScatterStyle::ScatterProperties usedProperties=QCPScatterStyle::spPen) |
| void | setUsedScatterProperties (const QCPScatterStyle::ScatterProperties &properties) |
| void | applyPen (QCPPainter *painter) const |
| void | applyBrush (QCPPainter *painter) const |
| QCPScatterStyle | getFinalScatterStyle (const QCPScatterStyle &unselectedStyle) const |
| virtual void | copyFrom (const QCPSelectionDecorator *other) |
Protected Member Functions | |
| double | getTangentAngle (const QCPPlottableInterface1D *interface1d, int dataIndex, int direction) const |
| QPointF | getPixelCoordinates (const QCPPlottableInterface1D *interface1d, int dataIndex) const |
Protected Member Functions inherited from QCPSelectionDecorator | |
| virtual bool | registerWithPlottable (QCPAbstractPlottable *plottable) |
Protected Attributes | |
| QPen | mBracketPen |
| QBrush | mBracketBrush |
| int | mBracketWidth |
| int | mBracketHeight |
| BracketStyle | mBracketStyle |
| bool | mTangentToData |
| int | mTangentAverage |
Protected Attributes inherited from QCPSelectionDecorator | |
| QPen | mPen |
| QBrush | mBrush |
| QCPScatterStyle | mScatterStyle |
| QCPScatterStyle::ScatterProperties | mUsedScatterProperties |
| QCPAbstractPlottable * | mPlottable |
A selection decorator which draws brackets around each selected data segment.
Additionally to the regular highlighting of selected segments via color, fill and scatter style, this QCPSelectionDecorator subclass draws markers at the begin and end of each selected data segment of the plottable.
The shape of the markers can be controlled with setBracketStyle, setBracketWidth and setBracketHeight. The color/fill can be controlled with setBracketPen and setBracketBrush.
To introduce custom bracket styles, it is only necessary to sublcass QCPSelectionDecoratorBracket and reimplement drawBracket. The rest will be managed by the base class.
Definition at line 5298 of file qcustomplot.h.
Defines which shape is drawn at the boundaries of selected data ranges.
Some of the bracket styles further allow specifying a height and/or width, see setBracketHeight and setBracketWidth.
| Enumerator | |
|---|---|
| bsSquareBracket | A square bracket is drawn. |
| bsHalfEllipse | A half ellipse is drawn. The size of the ellipse is given by the bracket width/height properties. |
| bsEllipse | An ellipse is drawn. The size of the ellipse is given by the bracket width/height properties. |
| bsPlus | A plus is drawn. |
| bsUserStyle | Start custom bracket styles at this index when subclassing and reimplementing drawBracket. |
Definition at line 5307 of file qcustomplot.h.
| QCPSelectionDecoratorBracket::QCPSelectionDecoratorBracket | ( | ) |
Creates a new QCPSelectionDecoratorBracket instance with default values.
Definition at line 17105 of file qcustomplot.cpp.
|
virtual |
Definition at line 17114 of file qcustomplot.cpp.
|
inline |
Definition at line 5328 of file qcustomplot.h.
|
inline |
Definition at line 5330 of file qcustomplot.h.
|
inline |
Definition at line 5327 of file qcustomplot.h.
|
inline |
Definition at line 5331 of file qcustomplot.h.
|
inline |
Definition at line 5329 of file qcustomplot.h.
|
virtual |
Draws the bracket shape with painter. The parameter direction is either -1 or 1 and indicates whether the bracket shall point to the left or the right (i.e. is a closing or opening bracket, respectively).
The passed painter already contains all transformations that are necessary to position and rotate the bracket appropriately. Painting operations can be performed as if drawing upright brackets on flat data with horizontal key axis, with (0, 0) being the center of the bracket.
If you wish to sublcass QCPSelectionDecoratorBracket in order to provide custom bracket shapes (see QCPSelectionDecoratorBracket::bsUserStyle), this is the method you should reimplement.
Definition at line 17198 of file qcustomplot.cpp.
References bsEllipse, bsHalfEllipse, bsPlus, bsSquareBracket, QCPPainter::drawLine(), mBracketHeight, mBracketStyle, and mBracketWidth.
Referenced by drawDecoration().
|
virtual |
Draws the bracket decoration on the data points at the begin and end of each selected data segment given in seletion.
It uses the method drawBracket to actually draw the shapes.
\seebaseclassmethod
Reimplemented from QCPSelectionDecorator.
Definition at line 17248 of file qcustomplot.cpp.
References QCPDataRange::begin(), QCPDataSelection::dataRanges(), drawBracket(), QCPDataRange::end(), getPixelCoordinates(), getTangentAngle(), QCPAbstractPlottable::interface1D(), QCPDataSelection::isEmpty(), QCPAbstractPlottable::keyAxis(), M_PI, mBracketBrush, mBracketPen, QCPSelectionDecorator::mPlottable, mTangentToData, QCPAxis::rangeReversed(), and QCPPainter::setPen().
|
protected |
Definition at line 17356 of file qcustomplot.cpp.
References QCPAxis::coordToPixel(), QCPPlottableInterface1D::dataMainKey(), QCPPlottableInterface1D::dataMainValue(), QCPAbstractPlottable::keyAxis(), QCPSelectionDecorator::mPlottable, QCPAxis::orientation(), and QCPAbstractPlottable::valueAxis().
Referenced by drawDecoration(), and getTangentAngle().
|
protected |
Definition at line 17307 of file qcustomplot.cpp.
References QCPPlottableInterface1D::dataCount(), getPixelCoordinates(), mTangentAverage, and points.
Referenced by drawDecoration().
| void QCPSelectionDecoratorBracket::setBracketBrush | ( | const QBrush & | brush | ) |
Sets the brush that will be used to draw the brackets at the beginning and end of each selected data segment.
Definition at line 17128 of file qcustomplot.cpp.
References QCPSelectionDecorator::brush(), and mBracketBrush.
| void QCPSelectionDecoratorBracket::setBracketHeight | ( | int | height | ) |
Sets the height of the drawn bracket. The height dimension is always perpendicular to the key axis of the data, or the tangent direction of the current data slope, if setTangentToData is enabled.
Definition at line 17146 of file qcustomplot.cpp.
References height, and mBracketHeight.
| void QCPSelectionDecoratorBracket::setBracketPen | ( | const QPen & | pen | ) |
Sets the pen that will be used to draw the brackets at the beginning and end of each selected data segment.
Definition at line 17120 of file qcustomplot.cpp.
References mBracketPen, and QCPSelectionDecorator::pen().
| void QCPSelectionDecoratorBracket::setBracketStyle | ( | QCPSelectionDecoratorBracket::BracketStyle | style | ) |
Sets the shape that the bracket/marker will have.
Definition at line 17155 of file qcustomplot.cpp.
References mBracketStyle.
| void QCPSelectionDecoratorBracket::setBracketWidth | ( | int | width | ) |
Sets the width of the drawn bracket. The width dimension is always parallel to the key axis of the data, or the tangent direction of the current data slope, if setTangentToData is enabled.
Definition at line 17137 of file qcustomplot.cpp.
References mBracketWidth, and width.
| void QCPSelectionDecoratorBracket::setTangentAverage | ( | int | pointCount | ) |
Controls over how many data points the slope shall be averaged, when brackets shall be aligned with the data (if setTangentToData is true).
From the position of the bracket, pointCount points towards the selected data range will be taken into account. The smallest value of pointCount is 1, which is effectively equivalent to disabling setTangentToData.
Definition at line 17179 of file qcustomplot.cpp.
References mTangentAverage.
| void QCPSelectionDecoratorBracket::setTangentToData | ( | bool | enabled | ) |
Sets whether the brackets will be rotated such that they align with the slope of the data at the position that they appear in.
For noisy data, it might be more visually appealing to average the slope over multiple data points. This can be configured via setTangentAverage.
Definition at line 17167 of file qcustomplot.cpp.
References mTangentToData.
|
inline |
Definition at line 5333 of file qcustomplot.h.
|
inline |
Definition at line 5332 of file qcustomplot.h.
|
protected |
Definition at line 5354 of file qcustomplot.h.
Referenced by drawDecoration(), and setBracketBrush().
|
protected |
Definition at line 5356 of file qcustomplot.h.
Referenced by drawBracket(), and setBracketHeight().
|
protected |
Definition at line 5353 of file qcustomplot.h.
Referenced by drawDecoration(), and setBracketPen().
|
protected |
Definition at line 5357 of file qcustomplot.h.
Referenced by drawBracket(), and setBracketStyle().
|
protected |
Definition at line 5355 of file qcustomplot.h.
Referenced by drawBracket(), and setBracketWidth().
|
protected |
Definition at line 5359 of file qcustomplot.h.
Referenced by getTangentAngle(), and setTangentAverage().
|
protected |
Definition at line 5358 of file qcustomplot.h.
Referenced by drawDecoration(), and setTangentToData().