#include <qwt_polar_grid.h>
Public Types | |
| enum | DisplayFlag { SmartOriginLabel = 1, HideMaxRadiusLabel = 2, ClipAxisBackground = 4, SmartScaleDraw = 8, ClipGridLines = 16 } |
| enum | GridAttribute { AutoScaling = 1 } |
Public Member Functions | |
| QwtPolarGrid () | |
| virtual | ~QwtPolarGrid () |
| virtual int | rtti () const |
| void | setDisplayFlag (DisplayFlag, bool on=true) |
| bool | testDisplayFlag (DisplayFlag) const |
| void | setGridAttribute (GridAttribute, bool on=true) |
| bool | testGridAttribute (GridAttribute) const |
| void | showGrid (int scaleId, bool show=true) |
| bool | isGridVisible (int scaleId) const |
| void | showMinorGrid (int scaleId, bool show=true) |
| bool | isMinorGridVisible (int scaleId) const |
| void | showAxis (int axisId, bool show=true) |
| bool | isAxisVisible (int axisId) const |
| void | setPen (const QPen &p) |
| void | setFont (const QFont &) |
| void | setMajorGridPen (const QPen &p) |
| void | setMajorGridPen (int scaleId, const QPen &p) |
| QPen | majorGridPen (int scaleId) const |
| void | setMinorGridPen (const QPen &p) |
| void | setMinorGridPen (int scaleId, const QPen &p) |
| QPen | minorGridPen (int scaleId) const |
| void | setAxisPen (int axisId, const QPen &p) |
| QPen | axisPen (int axisId) const |
| void | setAxisFont (int axisId, const QFont &p) |
| QFont | axisFont (int axisId) const |
| virtual void | draw (QPainter *p, const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap, const QwtDoublePoint &pole, double radius, const QwtDoubleRect &rect) const |
| virtual void | updateScaleDiv (const QwtScaleDiv &azimuthMap, const QwtScaleDiv &radialMap, const QwtDoubleInterval &) |
| virtual int | marginHint () const |
Protected Member Functions | |
| void | drawRays (QPainter *, const QwtDoubleRect &, const QwtDoublePoint &pole, double radius, const QwtScaleMap &azimuthMap, const QwtValueList &) const |
| void | drawCircles (QPainter *, const QwtDoubleRect &, const QwtDoublePoint &pole, const QwtScaleMap &radialMap, const QwtValueList &) const |
| void | drawAxis (QPainter *, int axisId) const |
The QwtPolarGrid class can be used to draw a coordinate grid. A coordinate grid consists of major and minor gridlines. The locations of the gridlines are determined by the azimuth and radial scale divisions.
QwtPolarGrid is also responsible for drawing the axis representing the scales. It is possible to display 4 radial and one azimuth axis.
Whenever the scale divisions of the plot widget changes the grid is synchronized by updateScaleDiv().
Mysterious flags trying to avoid conflicts, when painting the scales and grid lines.
The default setting enables all flags.
Grid attributes.
| QwtPolarGrid::QwtPolarGrid | ( | ) | [explicit] |
Constructor.
Enables major and disables minor grid lines. The azimuth and right radial axis are visible. all other axes are hidden. Autoscaling is enabled.
| QwtPolarGrid::~QwtPolarGrid | ( | ) | [virtual] |
Destructor.
| int QwtPolarGrid::rtti | ( | ) | const [virtual] |
| void QwtPolarGrid::setDisplayFlag | ( | DisplayFlag | flag, | |
| bool | on = true | |||
| ) |
Change the display flags
| flag | See DisplayFlag | |
| on | true/false |
| bool QwtPolarGrid::testDisplayFlag | ( | DisplayFlag | flag | ) | const |
| flag | See DisplayFlag |
| void QwtPolarGrid::setGridAttribute | ( | GridAttribute | attribute, | |
| bool | on = true | |||
| ) |
Specify an attribute for the grid.
| attribute | Grid attribute | |
| on | On/Off |
| bool QwtPolarGrid::testGridAttribute | ( | GridAttribute | attribute | ) | const |
| void QwtPolarGrid::showGrid | ( | int | scaleId, | |
| bool | show = true | |||
| ) |
Show/Hide grid lines for a scale
| scaleId | Scale id ( QwtPolar::Scale ) | |
| show | true/false |
| bool QwtPolarGrid::isGridVisible | ( | int | scaleId | ) | const |
| scaleId | Scale id ( QwtPolar::Scale ) |
| void QwtPolarGrid::showMinorGrid | ( | int | scaleId, | |
| bool | show = true | |||
| ) |
Show/Hide minor grid lines for a scale
To display minor grid lines. showGrid() needs to be enabled too.
| scaleId | Scale id ( QwtPolar::Scale ) | |
| show | true/false |
| bool QwtPolarGrid::isMinorGridVisible | ( | int | scaleId | ) | const |
| scaleId | Scale id ( QwtPolar::Scale ) |
| void QwtPolarGrid::showAxis | ( | int | axisId, | |
| bool | show = true | |||
| ) |
Show/Hide an axis
| axisId | Axis id (QwtPolar::Axis) | |
| show | true/false |
| bool QwtPolarGrid::isAxisVisible | ( | int | axisId | ) | const |
| void QwtPolarGrid::setPen | ( | const QPen & | pen | ) |
Assign a pen for all axes and grid lines
| pen | Pen |
| void QwtPolarGrid::setFont | ( | const QFont & | font | ) |
| void QwtPolarGrid::setMajorGridPen | ( | const QPen & | pen | ) |
Assign a pen for the major grid lines
| pen | Pen |
| void QwtPolarGrid::setMajorGridPen | ( | int | scaleId, | |
| const QPen & | pen | |||
| ) |
Assign a pen for the major grid lines of a specific scale
| scaleId | Scale id ( QwtPolar::Scale ) | |
| pen | Pen |
| QPen QwtPolarGrid::majorGridPen | ( | int | scaleId | ) | const |
| scaleId | Scale id ( QwtPolar::Scale ) |
| void QwtPolarGrid::setMinorGridPen | ( | const QPen & | pen | ) |
Assign a pen for the minor grid lines
| pen | Pen |
| void QwtPolarGrid::setMinorGridPen | ( | int | scaleId, | |
| const QPen & | pen | |||
| ) |
Assign a pen for the minor grid lines of a specific scale
| scaleId | Scale id ( QwtPolar::Scale ) | |
| pen | Pen |
| QPen QwtPolarGrid::minorGridPen | ( | int | scaleId | ) | const |
| scaleId | Scale id ( QwtPolar::Scale ) |
| void QwtPolarGrid::setAxisPen | ( | int | axisId, | |
| const QPen & | pen | |||
| ) |
Assign a pen for painting an axis
| axisId | Axis id (QwtPolar::Axis) | |
| pen | Pen |
| QPen QwtPolarGrid::axisPen | ( | int | axisId | ) | const |
| axisId | Axis id (QwtPolar::Axis) |
| void QwtPolarGrid::setAxisFont | ( | int | axisId, | |
| const QFont & | font | |||
| ) |
Assign a font for the tick labels of a specific axis
| axisId | Axis id (QwtPolar::Axis) | |
| font | new Font |
| QFont QwtPolarGrid::axisFont | ( | int | axisId | ) | const |
| axisId | Axis id (QwtPolar::Axis) |
| void QwtPolarGrid::draw | ( | QPainter * | painter, | |
| const QwtScaleMap & | azimuthMap, | |||
| const QwtScaleMap & | radialMap, | |||
| const QwtDoublePoint & | pole, | |||
| double | radius, | |||
| const QwtDoubleRect & | canvasRect | |||
| ) | const [virtual] |
Draw the grid and axes
| painter | Painter | |
| azimuthMap | Maps azimuth values to values related to 0.0, M_2PI | |
| radialMap | Maps radius values into painter coordinates. | |
| pole | Position of the pole in painter coordinates | |
| radius | Radius of the complete plot area in painter coordinates | |
| canvasRect | Contents rect of the canvas in painter coordinates |
Implements QwtPolarItem.
| void QwtPolarGrid::updateScaleDiv | ( | const QwtScaleDiv & | azimuthScaleDiv, | |
| const QwtScaleDiv & | radialScaleDiv, | |||
| const QwtDoubleInterval & | interval | |||
| ) | [virtual] |
Update the item to changes of the axes scale division.
If AutoScaling is enabled the radial scale is calculated from the interval, otherwise the scales are adopted to the plot scales.
| azimuthScaleDiv | Scale division of the azimuth-scale | |
| radialScaleDiv | Scale division of the radius-axis | |
| interval | The interval of the radius-axis, that is visible on the canvas |
Reimplemented from QwtPolarItem.
| int QwtPolarGrid::marginHint | ( | ) | const [virtual] |
Reimplemented from QwtPolarItem.
| void QwtPolarGrid::drawRays | ( | QPainter * | painter, | |
| const QwtDoubleRect & | canvasRect, | |||
| const QwtDoublePoint & | pole, | |||
| double | radius, | |||
| const QwtScaleMap & | azimuthMap, | |||
| const QwtValueList & | values | |||
| ) | const [protected] |
Draw lines from the pole
| painter | Painter | |
| canvasRect | Contents rect of the canvas in painter coordinates | |
| pole | Position of the pole in painter coordinates | |
| radius | Length of the lines in painter coordinates | |
| azimuthMap | Maps azimuth values to values related to 0.0, M_2PI | |
| values | Azimuth values, indicating the direction of the lines |
| void QwtPolarGrid::drawCircles | ( | QPainter * | painter, | |
| const QwtDoubleRect & | canvasRect, | |||
| const QwtDoublePoint & | pole, | |||
| const QwtScaleMap & | radialMap, | |||
| const QwtValueList & | values | |||
| ) | const [protected] |
Draw circles
| painter | Painter | |
| canvasRect | Contents rect of the canvas in painter coordinates | |
| pole | Position of the pole in painter coordinates | |
| radialMap | Maps radius values into painter coordinates. | |
| values | Radial values, indicating the distances from the pole |
| void QwtPolarGrid::drawAxis | ( | QPainter * | painter, | |
| int | axisId | |||
| ) | const [protected] |
Paint an axis
| painter | Painter | |
| axisId | Axis id (QwtPolar::Axis) |
1.5.6