|
QWT 7.0.1
|
An item which draws scales and grid lines on a polar plot. More...
#include <qwt_polar_grid.h>
Classes | |
| class | PrivateData |
Public Types | |
| enum | DisplayFlag { SmartOriginLabel = 1 , HideMaxRadiusLabel = 2 , ClipAxisBackground = 4 , SmartScaleDraw = 8 , ClipGridLines = 16 } |
| Mysterious flags trying to avoid conflicts, when painting the scales and grid lines. More... | |
| enum | GridAttribute { AutoScaling = 0x01 } |
| Grid attributes. More... | |
Public Types inherited from QwtPolarItem | |
| enum | RttiValues { Rtti_PolarItem = 0 , Rtti_PolarGrid , Rtti_PolarMarker , Rtti_PolarCurve , Rtti_PolarSpectrogram , Rtti_PolarUserItem = 1000 } |
| Runtime type information. More... | |
| enum | ItemAttribute { Legend = 0x01 , AutoScale = 0x02 } |
| Plot Item Attributes. More... | |
| enum | RenderHint { RenderAntialiased = 0x01 } |
| Render hints. More... | |
Public Member Functions | |
| QwtPolarGrid () | |
| Constructor. | |
| virtual | ~QwtPolarGrid () |
| Destructor. | |
| virtual int | rtti () const QWT_OVERRIDE |
| void | setDisplayFlag (DisplayFlag, bool on=true) |
| Change the display flags. | |
| bool | testDisplayFlag (DisplayFlag) const |
| void | setGridAttribute (GridAttribute, bool on=true) |
| Specify an attribute for the grid. | |
| bool | testGridAttribute (GridAttribute) const |
| void | showGrid (int scaleId, bool show=true) |
| Show/Hide grid lines for a scale. | |
| bool | isGridVisible (int scaleId) const |
| void | showMinorGrid (int scaleId, bool show=true) |
| Show/Hide minor grid lines for a scale. | |
| bool | isMinorGridVisible (int scaleId) const |
| void | showAxis (int axisId, bool show=true) |
| Show/Hide an axis. | |
| bool | isAxisVisible (int axisId) const |
| void | setPen (const QPen &p) |
| Assign a pen for all axes and grid lines. | |
| void | setFont (const QFont &) |
| Assign a font for all scale tick labels. | |
| void | setMajorGridPen (const QPen &p) |
| Assign a pen for the major grid lines. | |
| void | setMajorGridPen (int scaleId, const QPen &p) |
| Assign a pen for the major grid lines of a specific scale. | |
| QPen | majorGridPen (int scaleId) const |
| void | setMinorGridPen (const QPen &p) |
| Assign a pen for the minor grid lines. | |
| void | setMinorGridPen (int scaleId, const QPen &p) |
| Assign a pen for the minor grid lines of a specific scale. | |
| QPen | minorGridPen (int scaleId) const |
| void | setAxisPen (int axisId, const QPen &p) |
| Assign a pen for painting an axis. | |
| QPen | axisPen (int axisId) const |
| void | setAxisFont (int axisId, const QFont &p) |
| Assign a font for the tick labels of a specific axis. | |
| QFont | axisFont (int axisId) const |
| void | setScaleDraw (int axisId, QwtScaleDraw *) |
| Set a scale draw. | |
| const QwtScaleDraw * | scaleDraw (int axisId) const |
| Returns the scale draw of a specified axis. | |
| QwtScaleDraw * | scaleDraw (int axisId) |
| Returns the scale draw of a specified axis. | |
| void | setAzimuthScaleDraw (QwtRoundScaleDraw *) |
| Set a scale draw for the azimuth scale. | |
| const QwtRoundScaleDraw * | azimuthScaleDraw () const |
| QwtRoundScaleDraw * | azimuthScaleDraw () |
| virtual void | draw (QPainter *p, const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap, const QPointF &pole, double radius, const QRectF &rect) const QWT_OVERRIDE |
| Draw the grid and axes. | |
| virtual void | updateScaleDiv (const QwtScaleDiv &azimuthMap, const QwtScaleDiv &radialMap, const QwtInterval &) QWT_OVERRIDE |
| Update the item to changes of the axes scale division. | |
| virtual int | marginHint () const QWT_OVERRIDE |
Public Member Functions inherited from QwtPolarItem | |
| QwtPolarItem (const QwtText &title=QwtText()) | |
| Constructor. | |
| virtual | ~QwtPolarItem () |
| Destroy the QwtPolarItem. | |
| void | attach (QwtPolarPlot *plot) |
| Attach the item to a plot. | |
| void | detach () |
| This method detaches a QwtPolarItem from the QwtPolarPlot it has been associated with. | |
| QwtPolarPlot * | plot () const |
| void | setTitle (const QString &title) |
| Set a new title. | |
| void | setTitle (const QwtText &title) |
| Set a new title. | |
| const QwtText & | title () const |
| void | setItemAttribute (ItemAttribute, bool on=true) |
| Toggle an item attribute. | |
| bool | testItemAttribute (ItemAttribute) const |
| Test an item attribute. | |
| void | setRenderHint (RenderHint, bool on=true) |
| Toggle an render hint. | |
| bool | testRenderHint (RenderHint) const |
| Test a render hint. | |
| void | setRenderThreadCount (uint numThreads) |
| On multi core systems rendering of certain plot item ( f.e QwtPolarSpectrogram ) can be done in parallel in several threads. | |
| uint | renderThreadCount () const |
| double | z () const |
| Plot items are painted in increasing z-order. | |
| void | setZ (double z) |
| Set the z value. | |
| void | show () |
| Show the item. | |
| void | hide () |
| Hide the item. | |
| virtual void | setVisible (bool) |
| Show/Hide the item. | |
| bool | isVisible () const |
| virtual void | itemChanged () |
| Update the legend and call QwtPolarPlot::autoRefresh for the parent plot. | |
| virtual void | legendChanged () |
| Update the legend of the parent plot. | |
| virtual QwtInterval | boundingInterval (int scaleId) const |
| Interval, that is necessary to display the item. | |
| void | setLegendIconSize (const QSize &) |
| Set the size of the legend icon. | |
| QSize | legendIconSize () const |
| virtual QList< QwtLegendData > | legendData () const |
| Return all information, that is needed to represent the item on the legend. | |
| virtual QwtGraphic | legendIcon (int index, const QSizeF &) const |
Protected Member Functions | |
| void | drawRays (QPainter *, const QRectF &, const QPointF &pole, double radius, const QwtScaleMap &azimuthMap, const QList< double > &) const |
| Draw lines from the pole. | |
| void | drawCircles (QPainter *, const QRectF &, const QPointF &pole, const QwtScaleMap &radialMap, const QList< double > &) const |
| Draw circles. | |
| void | drawAxis (QPainter *, int axisId) const |
| Paint an axis. | |
An item which draws scales and grid lines on a polar plot.
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.
|
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.
| QFont QwtPolarGrid::axisFont | ( | int | axisId | ) | const |
| axisId | Axis id (QwtPolar::Axis) |
| QPen QwtPolarGrid::axisPen | ( | int | axisId | ) | const |
| axisId | Axis id (QwtPolar::Axis) |
| QwtRoundScaleDraw * QwtPolarGrid::azimuthScaleDraw | ( | ) |
| const QwtRoundScaleDraw * QwtPolarGrid::azimuthScaleDraw | ( | ) | 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.
|
protected |
Paint an axis.
| painter | Painter |
| axisId | Axis id (QwtPolar::Axis) |
|
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 |
|
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 |
| bool QwtPolarGrid::isAxisVisible | ( | int | axisId | ) | const |
| bool QwtPolarGrid::isGridVisible | ( | int | scaleId | ) | const |
| scaleId | Scale id ( QwtPolar::Scale ) |
| bool QwtPolarGrid::isMinorGridVisible | ( | int | scaleId | ) | const |
| scaleId | Scale id ( QwtPolar::Scale ) |
| QPen QwtPolarGrid::majorGridPen | ( | int | scaleId | ) | const |
| scaleId | Scale id ( QwtPolar::Scale ) |
|
virtual |
Reimplemented from QwtPolarItem.
| QPen QwtPolarGrid::minorGridPen | ( | int | scaleId | ) | const |
| scaleId | Scale id ( QwtPolar::Scale ) |
|
virtual |
Reimplemented from QwtPolarItem.
| QwtScaleDraw * QwtPolarGrid::scaleDraw | ( | int | axisId | ) |
Returns the scale draw of a specified axis.
| axisId | axis index ( QwtPolar::AxisLeft <= axisId <= QwtPolar::AxisBottom) |
| const QwtScaleDraw * QwtPolarGrid::scaleDraw | ( | int | axisId | ) | const |
Returns the scale draw of a specified axis.
| axisId | axis index ( QwtPolar::AxisLeft <= axisId <= QwtPolar::AxisBottom) |
| 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 |
| void QwtPolarGrid::setAxisPen | ( | int | axisId, |
| const QPen & | pen | ||
| ) |
Assign a pen for painting an axis.
| axisId | Axis id (QwtPolar::Axis) |
| pen | Pen |
| void QwtPolarGrid::setAzimuthScaleDraw | ( | QwtRoundScaleDraw * | scaleDraw | ) |
Set a scale draw for the azimuth scale.
| scaleDraw | object responsible for drawing scales. |
| void QwtPolarGrid::setDisplayFlag | ( | DisplayFlag | flag, |
| bool | on = true |
||
| ) |
Change the display flags.
| flag | See DisplayFlag |
| on | true/false |
| void QwtPolarGrid::setFont | ( | const QFont & | font | ) |
| void QwtPolarGrid::setGridAttribute | ( | GridAttribute | attribute, |
| bool | on = true |
||
| ) |
Specify an attribute for the grid.
| attribute | Grid attribute |
| on | On/Off |
/sa GridAttribute, testGridAttribute(), updateScaleDiv(), QwtPolarPlot::zoom(), QwtPolarPlot::scaleDiv()
| 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 |
| 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 |
| void QwtPolarGrid::setPen | ( | const QPen & | pen | ) |
Assign a pen for all axes and grid lines.
| pen | Pen |
| void QwtPolarGrid::setScaleDraw | ( | int | axisId, |
| QwtScaleDraw * | scaleDraw | ||
| ) |
Set a scale draw.
| axisId | axis index ( QwtPolar::AxisLeft <= axisId <= QwtPolar::AxisBottom) |
| scaleDraw | object responsible for drawing scales. |
| void QwtPolarGrid::showAxis | ( | int | axisId, |
| bool | show = true |
||
| ) |
| void QwtPolarGrid::showGrid | ( | int | scaleId, |
| bool | show = true |
||
| ) |
Show/Hide grid lines for a scale.
| scaleId | Scale id ( QwtPolar::Scale ) |
| show | true/false |
| 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::testDisplayFlag | ( | DisplayFlag | flag | ) | const |
| flag | See DisplayFlag |
| bool QwtPolarGrid::testGridAttribute | ( | GridAttribute | attribute | ) | const |
|
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.