![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
Handles the different ending decorations for line-like items. More...
#include <qcustomplot.h>
Public Types | |
| enum | EndingStyle { esNone , esFlatArrow , esSpikeArrow , esLineArrow , esDisc , esSquare , esDiamond , esBar , esHalfBar , esSkewedBar , esNone , esFlatArrow , esSpikeArrow , esLineArrow , esDisc , esSquare , esDiamond , esBar , esHalfBar , esSkewedBar } |
| enum | EndingStyle { esNone , esFlatArrow , esSpikeArrow , esLineArrow , esDisc , esSquare , esDiamond , esBar , esHalfBar , esSkewedBar , esNone , esFlatArrow , esSpikeArrow , esLineArrow , esDisc , esSquare , esDiamond , esBar , esHalfBar , esSkewedBar } |
Public Member Functions | |
| QCPLineEnding () | |
| QCPLineEnding (EndingStyle style, double width=8, double length=10, bool inverted=false) | |
| EndingStyle | style () const |
| double | width () const |
| double | length () const |
| bool | inverted () const |
| void | setStyle (EndingStyle style) |
| void | setWidth (double width) |
| void | setLength (double length) |
| void | setInverted (bool inverted) |
| double | boundingDistance () const |
| double | realLength () const |
| void | draw (QCPPainter *painter, const QCPVector2D &pos, const QCPVector2D &dir) const |
| void | draw (QCPPainter *painter, const QCPVector2D &pos, double angle) const |
| QCPLineEnding () | |
| QCPLineEnding (EndingStyle style, double width=8, double length=10, bool inverted=false) | |
| EndingStyle | style () const |
| double | width () const |
| double | length () const |
| bool | inverted () const |
| void | setStyle (EndingStyle style) |
| void | setWidth (double width) |
| void | setLength (double length) |
| void | setInverted (bool inverted) |
| double | boundingDistance () const |
| double | realLength () const |
| void | draw (QCPPainter *painter, const QVector2D &pos, const QVector2D &dir) const |
| void | draw (QCPPainter *painter, const QVector2D &pos, double angle) const |
Protected Attributes | |
| EndingStyle | mStyle |
| double | mWidth |
| double | mLength |
| bool | mInverted |
Handles the different ending decorations for line-like items.
For every ending a line-like item has, an instance of this class exists. For example, QCPItemLine has two endings which can be set with QCPItemLine::setHead and QCPItemLine::setTail.
The styles themselves are defined via the enum QCPLineEnding::EndingStyle. Most decorations can be modified regarding width and length, see setWidth and setLength. The direction of the ending decoration (e.g. direction an arrow is pointing) is controlled by the line-like item. For example, when both endings of a QCPItemLine are set to be arrows, they will point to opposite directions, e.g. "outward". This can be changed by setInverted, which would make the respective arrow point inward.
Note that due to the overloaded QCPLineEnding constructor, you may directly specify a QCPLineEnding::EndingStyle where actually a QCPLineEnding is expected, e.g.
qcplineending-sethead
Definition at line 1738 of file qcustomplot.h.
Defines the type of ending decoration for line-like items, e.g. an arrow.
The width and length of these decorations can be controlled with the functions setWidth and setLength. Some decorations like esDisc, esSquare, esDiamond and esBar only support a width, the length property is ignored.
| Enumerator | |
|---|---|
| esNone | No ending decoration. |
| esFlatArrow | A filled arrow head with a straight/flat back (a triangle) |
| esSpikeArrow | A filled arrow head with an indented back. |
| esLineArrow | A non-filled arrow head with open back. |
| esDisc | A filled circle. |
| esSquare | A filled square. |
| esDiamond | A filled diamond (45 degrees rotated square) A filled diamond (45° rotated square) |
| esBar | A bar perpendicular to the line. |
| esHalfBar | A bar perpendicular to the line, pointing out to only one side (to which side can be changed with setInverted) |
| esSkewedBar | A bar that is skewed (skew controllable via setLength) |
| esNone | No ending decoration. |
| esFlatArrow | A filled arrow head with a straight/flat back (a triangle) |
| esSpikeArrow | A filled arrow head with an indented back. |
| esLineArrow | A non-filled arrow head with open back. |
| esDisc | A filled circle. |
| esSquare | A filled square. |
| esDiamond | A filled diamond (45 degrees rotated square) A filled diamond (45° rotated square) |
| esBar | A bar perpendicular to the line. |
| esHalfBar | A bar perpendicular to the line, pointing out to only one side (to which side can be changed with setInverted) |
| esSkewedBar | A bar that is skewed (skew controllable via setLength) |
Definition at line 1754 of file qcustomplot.h.
Defines the type of ending decoration for line-like items, e.g. an arrow.
The width and length of these decorations can be controlled with the functions setWidth and setLength. Some decorations like esDisc, esSquare, esDiamond and esBar only support a width, the length property is ignored.
| Enumerator | |
|---|---|
| esNone | No ending decoration. |
| esFlatArrow | A filled arrow head with a straight/flat back (a triangle) |
| esSpikeArrow | A filled arrow head with an indented back. |
| esLineArrow | A non-filled arrow head with open back. |
| esDisc | A filled circle. |
| esSquare | A filled square. |
| esDiamond | A filled diamond (45 degrees rotated square) A filled diamond (45° rotated square) |
| esBar | A bar perpendicular to the line. |
| esHalfBar | A bar perpendicular to the line, pointing out to only one side (to which side can be changed with setInverted) |
| esSkewedBar | A bar that is skewed (skew controllable via setLength) |
| esNone | No ending decoration. |
| esFlatArrow | A filled arrow head with a straight/flat back (a triangle) |
| esSpikeArrow | A filled arrow head with an indented back. |
| esLineArrow | A non-filled arrow head with open back. |
| esDisc | A filled circle. |
| esSquare | A filled square. |
| esDiamond | A filled diamond (45 degrees rotated square) A filled diamond (45° rotated square) |
| esBar | A bar perpendicular to the line. |
| esHalfBar | A bar perpendicular to the line, pointing out to only one side (to which side can be changed with setInverted) |
| esSkewedBar | A bar that is skewed (skew controllable via setLength) |
Definition at line 1089 of file qcustomplot.h.
| QCPLineEnding::QCPLineEnding | ( | ) |
Creates a QCPLineEnding instance with default values (style esNone).
Definition at line 5114 of file qcustomplot.cpp.
| QCPLineEnding::QCPLineEnding | ( | QCPLineEnding::EndingStyle | style, |
| double | width = 8, |
||
| double | length = 10, |
||
| bool | inverted = false |
||
| ) |
Creates a QCPLineEnding instance with the specified values.
Definition at line 5120 of file qcustomplot.cpp.
| QCPLineEnding::QCPLineEnding | ( | ) |
| QCPLineEnding::QCPLineEnding | ( | EndingStyle | style, |
| double | width = 8, |
||
| double | length = 10, |
||
| bool | inverted = false |
||
| ) |
| double QCPLineEnding::boundingDistance | ( | ) | const |
Definition at line 5171 of file qcustomplot.cpp.
References esBar, esDiamond, esDisc, esFlatArrow, esHalfBar, esLineArrow, esNone, esSkewedBar, esSpikeArrow, esSquare, mLength, mStyle, and mWidth.
Referenced by QCPItemLine::draw().
| double QCPLineEnding::boundingDistance | ( | ) | const |
| void QCPLineEnding::draw | ( | QCPPainter * | painter, |
| const QCPVector2D & | pos, | ||
| const QCPVector2D & | dir | ||
| ) | const |
Definition at line 5235 of file qcustomplot.cpp.
References QCPPainter::drawLine(), esBar, esDiamond, esDisc, esFlatArrow, esHalfBar, esLineArrow, esNone, esSkewedBar, esSpikeArrow, esSquare, QCPVector2D::isNull(), mInverted, mLength, QCPPainter::modes(), mStyle, mWidth, QCPVector2D::normalized(), QCPVector2D::perpendicular(), QCPPainter::pmNonCosmetic, points, QCPPainter::setPen(), and QCPVector2D::toPointF().
Referenced by QCPItemLine::draw(), QCPItemCurve::draw(), and draw().
| void QCPLineEnding::draw | ( | QCPPainter * | painter, |
| const QCPVector2D & | pos, | ||
| double | angle | ||
| ) | const |
Definition at line 5366 of file qcustomplot.cpp.
References draw().
| void QCPLineEnding::draw | ( | QCPPainter * | painter, |
| const QVector2D & | pos, | ||
| const QVector2D & | dir | ||
| ) | const |
Definition at line 3496 of file qcustomplot.cpp.
References QCPPainter::drawLine(), esBar, esDiamond, esDisc, esFlatArrow, esHalfBar, esLineArrow, esNone, esSkewedBar, esSpikeArrow, esSquare, float, mInverted, mLength, QCPPainter::modes(), mStyle, mWidth, QCPPainter::pmNonCosmetic, points, and QCPPainter::setPen().
| void QCPLineEnding::draw | ( | QCPPainter * | painter, |
| const QVector2D & | pos, | ||
| double | angle | ||
| ) | const |
Definition at line 3628 of file qcustomplot.cpp.
References draw().
|
inline |
Definition at line 1791 of file qcustomplot.h.
Referenced by setInverted().
|
inline |
Definition at line 1125 of file qcustomplot.h.
|
inline |
Definition at line 1790 of file qcustomplot.h.
Referenced by setLength().
|
inline |
Definition at line 1124 of file qcustomplot.h.
| double QCPLineEnding::realLength | ( | ) | const |
Starting from the origin of this line ending (which is style specific), returns the length covered by the line ending symbol, in backward direction.
For example, the esSpikeArrow has a shorter real length than a esFlatArrow, even if both have the same setLength value, because the spike arrow has an inward curved back, which reduces the length along its center axis (the drawing origin for arrows is at the tip).
This function is used for precise, style specific placement of line endings, for example in QCPAxes.
Definition at line 5207 of file qcustomplot.cpp.
References esBar, esDiamond, esDisc, esFlatArrow, esHalfBar, esLineArrow, esNone, esSkewedBar, esSpikeArrow, esSquare, mLength, mStyle, and mWidth.
| double QCPLineEnding::realLength | ( | ) | const |
| void QCPLineEnding::setInverted | ( | bool | inverted | ) |
Sets whether the ending decoration shall be inverted. For example, an arrow decoration will point inward when inverted is set to true.
Note that also the width direction is inverted. For symmetrical ending styles like arrows or discs, this doesn't make a difference. However, asymmetric styles like esHalfBar are affected by it, which can be used to control to which side the half bar points to.
Definition at line 5159 of file qcustomplot.cpp.
References inverted(), and mInverted.
| void QCPLineEnding::setInverted | ( | bool | inverted | ) |
| void QCPLineEnding::setLength | ( | double | length | ) |
Sets the length of the ending decoration, if the style supports it. On arrows, for example, the length defines the size in pointing direction.
Definition at line 5148 of file qcustomplot.cpp.
| void QCPLineEnding::setLength | ( | double | length | ) |
| void QCPLineEnding::setStyle | ( | QCPLineEnding::EndingStyle | style | ) |
Sets the style of the ending decoration.
Definition at line 5129 of file qcustomplot.cpp.
| void QCPLineEnding::setStyle | ( | EndingStyle | style | ) |
| void QCPLineEnding::setWidth | ( | double | width | ) |
Sets the width of the ending decoration, if the style supports it. On arrows, for example, the width defines the size perpendicular to the arrow's pointing direction.
Definition at line 5140 of file qcustomplot.cpp.
| void QCPLineEnding::setWidth | ( | double | width | ) |
|
inline |
Definition at line 1788 of file qcustomplot.h.
Referenced by QCPItemLine::draw(), QCPItemCurve::draw(), and setStyle().
|
inline |
Definition at line 1122 of file qcustomplot.h.
|
inline |
Definition at line 1789 of file qcustomplot.h.
Referenced by setWidth().
|
inline |
Definition at line 1123 of file qcustomplot.h.
|
protected |
Definition at line 1811 of file qcustomplot.h.
Referenced by draw(), and setInverted().
|
protected |
Definition at line 1810 of file qcustomplot.h.
Referenced by boundingDistance(), draw(), realLength(), and setLength().
|
protected |
Definition at line 1809 of file qcustomplot.h.
Referenced by boundingDistance(), draw(), realLength(), and setStyle().
|
protected |
Definition at line 1810 of file qcustomplot.h.
Referenced by boundingDistance(), draw(), realLength(), and setWidth().