An item which draws scales and grid lines on a polar plot. More...
#include <qwt_polar_grid.h>
Classes | |
class | AxisData |
class | GridData |
class | PrivateData |
Public Types | |
enum | DisplayFlag { SmartOriginLabel = 1, HideMaxRadiusLabel = 2, ClipAxisBackground = 4, SmartScaleDraw = 8, ClipGridLines = 16 } |
typedef QFlags< DisplayFlag > | DisplayFlags |
Display flags. More... | |
enum | GridAttribute { AutoScaling = 0x01 } |
Grid attributes. More... | |
typedef QFlags< GridAttribute > | GridAttributes |
Grid attributes. More... | |
Public Types inherited from QwtPolarItem | |
enum | ItemAttribute { Legend = 0x01, AutoScale = 0x02 } |
Plot Item Attributes. More... | |
typedef QFlags< ItemAttribute > | ItemAttributes |
Item attributes. More... | |
enum | RenderHint { RenderAntialiased = 0x01 } |
Render hints. More... | |
typedef QFlags< RenderHint > | RenderHints |
Item attributes. More... | |
enum | RttiValues { Rtti_PolarItem = 0, Rtti_PolarGrid, Rtti_PolarMarker, Rtti_PolarCurve, Rtti_PolarSpectrogram, Rtti_PolarUserItem = 1000 } |
Runtime type information. More... | |
Public Member Functions | |
QFont | axisFont (int axisId) const |
QPen | axisPen (int axisId) const |
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 |
bool | isAxisVisible (int axisId) const |
bool | isGridVisible (int scaleId) const |
bool | isMinorGridVisible (int scaleId) const |
QPen | majorGridPen (int scaleId) const |
virtual int | marginHint () const QWT_OVERRIDE |
QPen | minorGridPen (int scaleId) const |
QwtPolarGrid () | |
Constructor. More... | |
virtual int | rtti () const QWT_OVERRIDE |
const QwtScaleDraw * | scaleDraw (int axisId) const |
QwtScaleDraw * | scaleDraw (int axisId) |
void | setAxisFont (int axisId, const QFont &p) |
void | setAxisPen (int axisId, const QPen &p) |
void | setAzimuthScaleDraw (QwtRoundScaleDraw *) |
Set a scale draw for the azimuth scale. More... | |
void | setDisplayFlag (DisplayFlag, bool on=true) |
void | setFont (const QFont &) |
void | setGridAttribute (GridAttribute, bool on=true) |
Specify an attribute for the grid. More... | |
void | setMajorGridPen (const QPen &p) |
void | setMajorGridPen (int scaleId, const QPen &p) |
void | setMinorGridPen (const QPen &p) |
void | setMinorGridPen (int scaleId, const QPen &p) |
void | setPen (const QPen &p) |
void | setScaleDraw (int axisId, QwtScaleDraw *) |
Set a scale draw. More... | |
void | showAxis (int axisId, bool show=true) |
void | showGrid (int scaleId, bool show=true) |
void | showMinorGrid (int scaleId, bool show=true) |
bool | testDisplayFlag (DisplayFlag) const |
bool | testGridAttribute (GridAttribute) const |
virtual void | updateScaleDiv (const QwtScaleDiv &azimuthMap, const QwtScaleDiv &radialMap, const QwtInterval &) QWT_OVERRIDE |
Update the item to changes of the axes scale division. More... | |
virtual | ~QwtPolarGrid () |
Destructor. More... | |
Public Member Functions inherited from QwtPolarItem | |
void | attach (QwtPolarPlot *plot) |
Attach the item to a plot. More... | |
virtual QwtInterval | boundingInterval (int scaleId) const |
void | detach () |
This method detaches a QwtPolarItem from the QwtPolarPlot it has been associated with. More... | |
void | hide () |
Hide the item. More... | |
bool | isVisible () const |
virtual void | itemChanged () |
virtual void | legendChanged () |
virtual QList< QwtLegendData > | legendData () const |
Return all information, that is needed to represent the item on the legend. More... | |
virtual QwtGraphic | legendIcon (int index, const QSizeF &) const |
QSize | legendIconSize () const |
QwtPolarPlot * | plot () const |
QwtPolarItem (const QwtText &title=QwtText()) | |
uint | renderThreadCount () const |
void | setItemAttribute (ItemAttribute, bool on=true) |
void | setLegendIconSize (const QSize &) |
void | setRenderHint (RenderHint, bool on=true) |
void | setRenderThreadCount (uint numThreads) |
void | setTitle (const QString &title) |
void | setTitle (const QwtText &title) |
virtual void | setVisible (bool) |
void | setZ (double z) |
Set the z value. More... | |
void | show () |
Show the item. More... | |
bool | testItemAttribute (ItemAttribute) const |
bool | testRenderHint (RenderHint) const |
const QwtText & | title () const |
double | z () const |
virtual | ~QwtPolarItem () |
Destroy the QwtPolarItem. More... | |
Protected Member Functions | |
void | drawAxis (QPainter *, int axisId) const |
void | drawCircles (QPainter *, const QRectF &, const QPointF &pole, const QwtScaleMap &radialMap, const QList< double > &) const |
void | drawRays (QPainter *, const QRectF &, const QPointF &pole, double radius, const QwtScaleMap &azimuthMap, const QList< double > &) const |
Private Member Functions | |
void | updateScaleDraws (const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap, const QPointF &pole, const double radius) const |
Private Attributes | |
PrivateData * | d_data |
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().
Definition at line 41 of file qwt_polar_grid.h.
typedef QFlags<DisplayFlag> QwtPolarGrid::DisplayFlags |
Display flags.
Definition at line 89 of file qwt_polar_grid.h.
typedef QFlags<GridAttribute> QwtPolarGrid::GridAttributes |
Grid attributes.
Definition at line 105 of file qwt_polar_grid.h.
Mysterious flags trying to avoid conflicts, when painting the scales and grid lines.
The default setting enables all flags.
Definition at line 52 of file qwt_polar_grid.h.
Grid attributes.
Enumerator | |
---|---|
AutoScaling |
When AutoScaling is enabled, the radial axes will be adjusted to the interval, that is currently visible on the canvas plot. |
Definition at line 95 of file qwt_polar_grid.h.
|
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.
Definition at line 80 of file qwt_polar_grid.cpp.
|
virtual |
Destructor.
Definition at line 153 of file qwt_polar_grid.cpp.
QFont QwtPolarGrid::axisFont | ( | int | axisId | ) | const |
axisId | Axis id (QwtPolar::Axis) |
Definition at line 552 of file qwt_polar_grid.cpp.
QPen QwtPolarGrid::axisPen | ( | int | axisId | ) | const |
axisId | Axis id (QwtPolar::Axis) |
Definition at line 521 of file qwt_polar_grid.cpp.
const QwtRoundScaleDraw * QwtPolarGrid::azimuthScaleDraw | ( | ) | const |
Definition at line 1113 of file qwt_polar_grid.cpp.
QwtRoundScaleDraw * QwtPolarGrid::azimuthScaleDraw | ( | ) |
Definition at line 1123 of file qwt_polar_grid.cpp.
|
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.
Definition at line 570 of file qwt_polar_grid.cpp.
|
protected |
Paint an axis
painter | Painter |
axisId | Axis id (QwtPolar::Axis) |
Definition at line 828 of file qwt_polar_grid.cpp.
|
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 |
Definition at line 747 of file qwt_polar_grid.cpp.
|
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 |
Definition at line 677 of file qwt_polar_grid.cpp.
bool QwtPolarGrid::isAxisVisible | ( | int | axisId | ) | const |
axisId | Axis id (QwtPolar::Axis) |
Definition at line 339 of file qwt_polar_grid.cpp.
bool QwtPolarGrid::isGridVisible | ( | int | scaleId | ) | const |
scaleId | Scale id ( QwtPolar::Scale ) |
Definition at line 268 of file qwt_polar_grid.cpp.
bool QwtPolarGrid::isMinorGridVisible | ( | int | scaleId | ) | const |
scaleId | Scale id ( QwtPolar::Scale ) |
Definition at line 304 of file qwt_polar_grid.cpp.
QPen QwtPolarGrid::majorGridPen | ( | int | scaleId | ) | const |
scaleId | Scale id ( QwtPolar::Scale ) |
Definition at line 450 of file qwt_polar_grid.cpp.
|
virtual |
Reimplemented from QwtPolarItem.
Definition at line 1045 of file qwt_polar_grid.cpp.
QPen QwtPolarGrid::minorGridPen | ( | int | scaleId | ) | const |
scaleId | Scale id ( QwtPolar::Scale ) |
Definition at line 506 of file qwt_polar_grid.cpp.
|
virtual |
Reimplemented from QwtPolarItem.
Definition at line 159 of file qwt_polar_grid.cpp.
const QwtScaleDraw * QwtPolarGrid::scaleDraw | ( | int | axisId | ) | const |
Returns the scale draw of a specified axis
axisId | axis index ( QwtPolar::AxisLeft <= axisId <= QwtPolar::AxisBottom) |
Definition at line 1064 of file qwt_polar_grid.cpp.
QwtScaleDraw * QwtPolarGrid::scaleDraw | ( | int | axisId | ) |
Returns the scale draw of a specified axis
axisId | axis index ( QwtPolar::AxisLeft <= axisId <= QwtPolar::AxisBottom) |
Definition at line 1079 of file qwt_polar_grid.cpp.
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 |
Definition at line 535 of file qwt_polar_grid.cpp.
void QwtPolarGrid::setAxisPen | ( | int | axisId, |
const QPen & | pen | ||
) |
Assign a pen for painting an axis
axisId | Axis id (QwtPolar::Axis) |
pen | Pen |
Definition at line 231 of file qwt_polar_grid.cpp.
void QwtPolarGrid::setAzimuthScaleDraw | ( | QwtRoundScaleDraw * | scaleDraw | ) |
Set a scale draw for the azimuth scale.
scaleDraw | object responsible for drawing scales. |
Definition at line 1135 of file qwt_polar_grid.cpp.
void QwtPolarGrid::setDisplayFlag | ( | DisplayFlag | flag, |
bool | on = true |
||
) |
Change the display flags
flag | See DisplayFlag |
on | true/false |
Definition at line 170 of file qwt_polar_grid.cpp.
void QwtPolarGrid::setFont | ( | const QFont & | font | ) |
Assign a font for all scale tick labels
font | Font |
Definition at line 386 of file qwt_polar_grid.cpp.
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()
Definition at line 201 of file qwt_polar_grid.cpp.
void QwtPolarGrid::setMajorGridPen | ( | const QPen & | pen | ) |
Assign a pen for the major grid lines
pen | Pen |
Definition at line 408 of file qwt_polar_grid.cpp.
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 |
Definition at line 432 of file qwt_polar_grid.cpp.
void QwtPolarGrid::setMinorGridPen | ( | const QPen & | pen | ) |
Assign a pen for the minor grid lines
pen | Pen |
Definition at line 465 of file qwt_polar_grid.cpp.
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 |
Definition at line 489 of file qwt_polar_grid.cpp.
void QwtPolarGrid::setPen | ( | const QPen & | pen | ) |
Assign a pen for all axes and grid lines
pen | Pen |
Definition at line 353 of file qwt_polar_grid.cpp.
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. |
Definition at line 1095 of file qwt_polar_grid.cpp.
void QwtPolarGrid::showAxis | ( | int | axisId, |
bool | show = true |
||
) |
Show/Hide an axis
axisId | Axis id (QwtPolar::Axis) |
show | true/false |
Definition at line 320 of file qwt_polar_grid.cpp.
void QwtPolarGrid::showGrid | ( | int | scaleId, |
bool | show = true |
||
) |
Show/Hide grid lines for a scale
scaleId | Scale id ( QwtPolar::Scale ) |
show | true/false |
Definition at line 250 of file qwt_polar_grid.cpp.
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 |
Definition at line 286 of file qwt_polar_grid.cpp.
bool QwtPolarGrid::testDisplayFlag | ( | DisplayFlag | flag | ) | const |
flag | See DisplayFlag |
Definition at line 187 of file qwt_polar_grid.cpp.
bool QwtPolarGrid::testGridAttribute | ( | GridAttribute | attribute | ) | const |
Definition at line 218 of file qwt_polar_grid.cpp.
|
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.
Definition at line 948 of file qwt_polar_grid.cpp.
|
private |
Update the axis scale draw geometries
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 |
Definition at line 855 of file qwt_polar_grid.cpp.
|
private |
Definition at line 180 of file qwt_polar_grid.h.