Classes | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
QwtPolarGrid Class Reference

An item which draws scales and grid lines on a polar plot. More...

#include <qwt_polar_grid.h>

Inheritance diagram for QwtPolarGrid:
Inheritance graph
[legend]

Classes

class  PrivateData
 

Public Types

enum  DisplayFlag {
  SmartOriginLabel = 1, HideMaxRadiusLabel = 2, ClipAxisBackground = 4, SmartScaleDraw = 8,
  ClipGridLines = 16
}
 
enum  GridAttribute { AutoScaling = 0x01 }
 Grid attributes. More...
 
- Public Types inherited from QwtPolarItem
enum  ItemAttribute { Legend = 0x01, AutoScale = 0x02 }
 Plot Item Attributes. More...
 
enum  RenderHint { RenderAntialiased = 0x01 }
 Render hints. 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
 
QwtRoundScaleDrawazimuthScaleDraw ()
 
const QwtRoundScaleDrawazimuthScaleDraw () const
 
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
 
QwtScaleDrawscaleDraw (int axisId)
 
const QwtScaleDrawscaleDraw (int axisId) const
 
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< QwtLegendDatalegendData () 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
 
QwtPolarPlotplot () 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 QwtTexttitle () 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

PrivateDatam_data
 

Detailed Description

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().

See also
QwtPolarPlot, QwtPolar::Axis

Definition at line 41 of file qwt_polar_grid.h.

Member Enumeration Documentation

◆ DisplayFlag

Mysterious flags trying to avoid conflicts, when painting the scales and grid lines.

The default setting enables all flags.

See also
setDisplayFlag(), testDisplayFlag()
Enumerator
SmartOriginLabel 

Try to avoid situations, where the label of the origin is painted over another axis.

HideMaxRadiusLabel 

Often the outermost tick of the radial scale is close to the canvas border. With HideMaxRadiusLabel enabled it is not painted.

ClipAxisBackground 

The tick labels of the radial scales might be hard to read, when they are painted on top of the radial grid lines ( or on top of a curve/spectrogram ). When ClipAxisBackground the bounding rect of each label is added to the clip region.

SmartScaleDraw 

Don't paint the backbone of the radial axes, when they are very close to a line of the azimuth grid.

ClipGridLines 

All grid lines are clipped against the plot area before being painted. When the plot is zoomed in this will have an significant impact on the performance of the painting code.

Definition at line 52 of file qwt_polar_grid.h.

◆ GridAttribute

Grid attributes.

See also
setGridAttributes(), testGridAttributes()
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 94 of file qwt_polar_grid.h.

Constructor & Destructor Documentation

◆ QwtPolarGrid()

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.

Definition at line 84 of file qwt_polar_grid.cpp.

◆ ~QwtPolarGrid()

QwtPolarGrid::~QwtPolarGrid ( )
virtual

Destructor.

Definition at line 157 of file qwt_polar_grid.cpp.

Member Function Documentation

◆ axisFont()

QFont QwtPolarGrid::axisFont ( int  axisId) const
Returns
Font for the tick labels of a specific axis
Parameters
axisIdAxis id (QwtPolar::Axis)

Definition at line 556 of file qwt_polar_grid.cpp.

◆ axisPen()

QPen QwtPolarGrid::axisPen ( int  axisId) const
Returns
Pen for painting a specific axis
Parameters
axisIdAxis id (QwtPolar::Axis)
See also
setAxisPen()

Definition at line 525 of file qwt_polar_grid.cpp.

◆ azimuthScaleDraw() [1/2]

QwtRoundScaleDraw* QwtPolarGrid::azimuthScaleDraw ( )

◆ azimuthScaleDraw() [2/2]

QwtRoundScaleDraw * QwtPolarGrid::azimuthScaleDraw ( ) const
Returns
Scale draw for the azimuth scale
See also
setAzimuthScaleDraw(), scaleDraw()

Definition at line 1117 of file qwt_polar_grid.cpp.

◆ draw()

void QwtPolarGrid::draw ( QPainter *  painter,
const QwtScaleMap azimuthMap,
const QwtScaleMap radialMap,
const QPointF &  pole,
double  radius,
const QRectF &  canvasRect 
) const
virtual

Draw the grid and axes

Parameters
painterPainter
azimuthMapMaps azimuth values to values related to 0.0, M_2PI
radialMapMaps radius values into painter coordinates.
polePosition of the pole in painter coordinates
radiusRadius of the complete plot area in painter coordinates
canvasRectContents rect of the canvas in painter coordinates

Implements QwtPolarItem.

Definition at line 574 of file qwt_polar_grid.cpp.

◆ drawAxis()

void QwtPolarGrid::drawAxis ( QPainter *  painter,
int  axisId 
) const
protected

Paint an axis

Parameters
painterPainter
axisIdAxis id (QwtPolar::Axis)

Definition at line 832 of file qwt_polar_grid.cpp.

◆ drawCircles()

void QwtPolarGrid::drawCircles ( QPainter *  painter,
const QRectF &  canvasRect,
const QPointF &  pole,
const QwtScaleMap radialMap,
const QList< double > &  values 
) const
protected

Draw circles

Parameters
painterPainter
canvasRectContents rect of the canvas in painter coordinates
polePosition of the pole in painter coordinates
radialMapMaps radius values into painter coordinates.
valuesRadial values, indicating the distances from the pole

Definition at line 751 of file qwt_polar_grid.cpp.

◆ drawRays()

void QwtPolarGrid::drawRays ( QPainter *  painter,
const QRectF &  canvasRect,
const QPointF &  pole,
double  radius,
const QwtScaleMap azimuthMap,
const QList< double > &  values 
) const
protected

Draw lines from the pole

Parameters
painterPainter
canvasRectContents rect of the canvas in painter coordinates
polePosition of the pole in painter coordinates
radiusLength of the lines in painter coordinates
azimuthMapMaps azimuth values to values related to 0.0, M_2PI
valuesAzimuth values, indicating the direction of the lines

Definition at line 681 of file qwt_polar_grid.cpp.

◆ isAxisVisible()

bool QwtPolarGrid::isAxisVisible ( int  axisId) const
Returns
true if the axis is visible
Parameters
axisIdAxis id (QwtPolar::Axis)
See also
showAxis()

Definition at line 343 of file qwt_polar_grid.cpp.

◆ isGridVisible()

bool QwtPolarGrid::isGridVisible ( int  scaleId) const
Returns
true if grid lines are enabled
Parameters
scaleIdScale id ( QwtPolar::Scale )
See also
QwtPolar::Scale, showGrid()

Definition at line 272 of file qwt_polar_grid.cpp.

◆ isMinorGridVisible()

bool QwtPolarGrid::isMinorGridVisible ( int  scaleId) const
Returns
true if minor grid lines are enabled
Parameters
scaleIdScale id ( QwtPolar::Scale )
See also
showMinorGrid()

Definition at line 308 of file qwt_polar_grid.cpp.

◆ majorGridPen()

QPen QwtPolarGrid::majorGridPen ( int  scaleId) const
Returns
Pen for painting the major grid lines of a specific scale
Parameters
scaleIdScale id ( QwtPolar::Scale )
See also
setMajorGridPen(), minorGridPen()

Definition at line 454 of file qwt_polar_grid.cpp.

◆ marginHint()

int QwtPolarGrid::marginHint ( ) const
virtual
Returns
Number of pixels, that are necessary to paint the azimuth scale
See also
QwtRoundScaleDraw::extent()

Reimplemented from QwtPolarItem.

Definition at line 1049 of file qwt_polar_grid.cpp.

◆ minorGridPen()

QPen QwtPolarGrid::minorGridPen ( int  scaleId) const
Returns
Pen for painting the minor grid lines of a specific scale
Parameters
scaleIdScale id ( QwtPolar::Scale )

Definition at line 510 of file qwt_polar_grid.cpp.

◆ rtti()

int QwtPolarGrid::rtti ( ) const
virtual
Returns
QwtPlotItem::Rtti_PolarGrid

Reimplemented from QwtPolarItem.

Definition at line 163 of file qwt_polar_grid.cpp.

◆ scaleDraw() [1/2]

QwtScaleDraw * QwtPolarGrid::scaleDraw ( int  axisId)

Returns the scale draw of a specified axis

Parameters
axisIdaxis index ( QwtPolar::AxisLeft <= axisId <= QwtPolar::AxisBottom)
Returns
specified scaleDraw for axis, or NULL if axis is invalid.
See also
setScaleDraw(), azimuthScaleDraw()

Definition at line 1083 of file qwt_polar_grid.cpp.

◆ scaleDraw() [2/2]

const QwtScaleDraw * QwtPolarGrid::scaleDraw ( int  axisId) const

Returns the scale draw of a specified axis

Parameters
axisIdaxis index ( QwtPolar::AxisLeft <= axisId <= QwtPolar::AxisBottom)
Returns
specified scaleDraw for axis, or NULL if axis is invalid.
See also
azimuthScaleDraw()

Definition at line 1068 of file qwt_polar_grid.cpp.

◆ setAxisFont()

void QwtPolarGrid::setAxisFont ( int  axisId,
const QFont &  font 
)

Assign a font for the tick labels of a specific axis

Parameters
axisIdAxis id (QwtPolar::Axis)
fontnew Font

Definition at line 539 of file qwt_polar_grid.cpp.

◆ setAxisPen()

void QwtPolarGrid::setAxisPen ( int  axisId,
const QPen &  pen 
)

Assign a pen for painting an axis

Parameters
axisIdAxis id (QwtPolar::Axis)
penPen
See also
axisPen()

Definition at line 235 of file qwt_polar_grid.cpp.

◆ setAzimuthScaleDraw()

void QwtPolarGrid::setAzimuthScaleDraw ( QwtRoundScaleDraw scaleDraw)

Set a scale draw for the azimuth scale.

Parameters
scaleDrawobject responsible for drawing scales.
See also
azimuthScaleDraw(), setScaleDraw()

Definition at line 1139 of file qwt_polar_grid.cpp.

◆ setDisplayFlag()

void QwtPolarGrid::setDisplayFlag ( DisplayFlag  flag,
bool  on = true 
)

Change the display flags

Parameters
flagSee DisplayFlag
ontrue/false

Definition at line 174 of file qwt_polar_grid.cpp.

◆ setFont()

void QwtPolarGrid::setFont ( const QFont &  font)

Assign a font for all scale tick labels

Parameters
fontFont
See also
setAxisFont()

Definition at line 390 of file qwt_polar_grid.cpp.

◆ setGridAttribute()

void QwtPolarGrid::setGridAttribute ( GridAttribute  attribute,
bool  on = true 
)

Specify an attribute for the grid.

Parameters
attributeGrid attribute
onOn/Off

/sa GridAttribute, testGridAttribute(), updateScaleDiv(), QwtPolarPlot::zoom(), QwtPolarPlot::scaleDiv()

Definition at line 205 of file qwt_polar_grid.cpp.

◆ setMajorGridPen() [1/2]

void QwtPolarGrid::setMajorGridPen ( const QPen &  pen)

Assign a pen for the major grid lines

Parameters
penPen
See also
setPen(), setMinorGridPen(), majorGridPen

Definition at line 412 of file qwt_polar_grid.cpp.

◆ setMajorGridPen() [2/2]

void QwtPolarGrid::setMajorGridPen ( int  scaleId,
const QPen &  pen 
)

Assign a pen for the major grid lines of a specific scale

Parameters
scaleIdScale id ( QwtPolar::Scale )
penPen
See also
setPen(), setMinorGridPen(), majorGridPen

Definition at line 436 of file qwt_polar_grid.cpp.

◆ setMinorGridPen() [1/2]

void QwtPolarGrid::setMinorGridPen ( const QPen &  pen)

Assign a pen for the minor grid lines

Parameters
penPen
See also
setPen(), setMajorGridPen(), minorGridPen()

Definition at line 469 of file qwt_polar_grid.cpp.

◆ setMinorGridPen() [2/2]

void QwtPolarGrid::setMinorGridPen ( int  scaleId,
const QPen &  pen 
)

Assign a pen for the minor grid lines of a specific scale

Parameters
scaleIdScale id ( QwtPolar::Scale )
penPen
See also
setPen(), setMajorGridPen(), minorGridPen

Definition at line 493 of file qwt_polar_grid.cpp.

◆ setPen()

void QwtPolarGrid::setPen ( const QPen &  pen)

Assign a pen for all axes and grid lines

Parameters
penPen
See also
setMajorGridPen(), setMinorGridPen(), setAxisPen()

Definition at line 357 of file qwt_polar_grid.cpp.

◆ setScaleDraw()

void QwtPolarGrid::setScaleDraw ( int  axisId,
QwtScaleDraw scaleDraw 
)

Set a scale draw.

Parameters
axisIdaxis index ( QwtPolar::AxisLeft <= axisId <= QwtPolar::AxisBottom)
scaleDrawobject responsible for drawing scales.
See also
scaleDraw(), setAzimuthScaleDraw()

Definition at line 1099 of file qwt_polar_grid.cpp.

◆ showAxis()

void QwtPolarGrid::showAxis ( int  axisId,
bool  show = true 
)

Show/Hide an axis

Parameters
axisIdAxis id (QwtPolar::Axis)
showtrue/false
See also
isAxisVisible()

Definition at line 324 of file qwt_polar_grid.cpp.

◆ showGrid()

void QwtPolarGrid::showGrid ( int  scaleId,
bool  show = true 
)

Show/Hide grid lines for a scale

Parameters
scaleIdScale id ( QwtPolar::Scale )
showtrue/false

Definition at line 254 of file qwt_polar_grid.cpp.

◆ showMinorGrid()

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.

Parameters
scaleIdScale id ( QwtPolar::Scale )
showtrue/false
See also
showGrid

Definition at line 290 of file qwt_polar_grid.cpp.

◆ testDisplayFlag()

bool QwtPolarGrid::testDisplayFlag ( DisplayFlag  flag) const
Returns
true, if flag is enabled
Parameters
flagSee DisplayFlag

Definition at line 191 of file qwt_polar_grid.cpp.

◆ testGridAttribute()

bool QwtPolarGrid::testGridAttribute ( GridAttribute  attribute) const
Returns
true, if attribute is enabled
See also
GridAttribute, setGridAttribute()

Definition at line 222 of file qwt_polar_grid.cpp.

◆ updateScaleDiv()

void QwtPolarGrid::updateScaleDiv ( const QwtScaleDiv azimuthScaleDiv,
const QwtScaleDiv radialScaleDiv,
const QwtInterval 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.

Parameters
azimuthScaleDivScale division of the azimuth-scale
radialScaleDivScale division of the radius-axis
intervalThe interval of the radius-axis, that is visible on the canvas
See also
QwtPolarPlot::setGridAttributes()

Reimplemented from QwtPolarItem.

Definition at line 952 of file qwt_polar_grid.cpp.

◆ updateScaleDraws()

void QwtPolarGrid::updateScaleDraws ( const QwtScaleMap azimuthMap,
const QwtScaleMap radialMap,
const QPointF &  pole,
const double  radius 
) const
private

Update the axis scale draw geometries

Parameters
azimuthMapMaps azimuth values to values related to 0.0, M_2PI
radialMapMaps radius values into painter coordinates.
polePosition of the pole in painter coordinates
radiusRadius of the complete plot area in painter coordinates
See also
updateScaleDiv()

Definition at line 859 of file qwt_polar_grid.cpp.

Member Data Documentation

◆ m_data

PrivateData* QwtPolarGrid::m_data
private

Definition at line 176 of file qwt_polar_grid.h.


The documentation for this class was generated from the following files:


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:51