Base class for items on a polar plot. More...
#include <qwt_polar_item.h>
Public Types | |
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... | |
typedef QFlags< ItemAttribute > | ItemAttributes |
Item attributes. | |
typedef QFlags< RenderHint > | RenderHints |
Item attributes. | |
Public Member Functions | |
QwtPolarItem (const QwtText &title=QwtText()) | |
virtual | ~QwtPolarItem () |
Destroy the QwtPolarItem. | |
void | attach (QwtPolarPlot *plot) |
Attach the item to a plot. More... | |
void | detach () |
This method detaches a QwtPolarItem from the QwtPolarPlot it has been associated with. More... | |
QwtPolarPlot * | plot () const |
void | setTitle (const QString &title) |
void | setTitle (const QwtText &title) |
const QwtText & | title () const |
virtual int | rtti () const |
void | setItemAttribute (ItemAttribute, bool on=true) |
bool | testItemAttribute (ItemAttribute) const |
void | setRenderHint (RenderHint, bool on=true) |
bool | testRenderHint (RenderHint) const |
void | setRenderThreadCount (uint numThreads) |
uint | renderThreadCount () const |
double | z () const |
void | setZ (double z) |
Set the z value. More... | |
void | show () |
Show the item. | |
void | hide () |
Hide the item. | |
virtual void | setVisible (bool) |
bool | isVisible () const |
virtual void | itemChanged () |
virtual void | legendChanged () |
virtual void | draw (QPainter *painter, const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap, const QPointF &pole, double radius, const QRectF &canvasRect) const =0 |
Draw the item. More... | |
virtual QwtInterval | boundingInterval (int scaleId) const |
virtual void | updateScaleDiv (const QwtScaleDiv &, const QwtScaleDiv &, const QwtInterval &) |
Update the item to changes of the axes scale division. More... | |
virtual int | marginHint () const |
void | setLegendIconSize (const QSize &) |
QSize | legendIconSize () const |
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 |
Base class for items on a polar plot.
A QwtPolarItem is "something that can be painted on the canvas". It is connected to the QwtPolar framework by a couple of virtual methods, that are individually implemented in derived item classes.
QwtPolar offers an implementation of the most common types of items, but deriving from QwtPolarItem makes it easy to implement additional types of items.
Plot Item Attributes.
Enumerator | |
---|---|
Legend |
The item is represented on the legend. |
AutoScale |
The boundingRect() of the item is included in the autoscaling calculation. |
Render hints.
Enumerator | |
---|---|
RenderAntialiased |
Enable antialiasing. |
Runtime type information.
RttiValues is used to cast plot items, without having to enable runtime type information of the compiler.
Enumerator | |
---|---|
Rtti_PolarItem |
Unspecific value, that can be used, when it doesn't matter. |
Rtti_PolarGrid |
For QwtPolarGrid. |
Rtti_PolarMarker |
For QwtPolarMarker. |
Rtti_PolarCurve |
For QwtPolarCurve. |
Rtti_PolarSpectrogram |
For QwtPolarSpectrogram. |
Rtti_PolarUserItem |
Values >= Rtti_PolarUserItem are reserved for plot items not implemented in the QwtPolar library. |
|
explicit |
void QwtPolarItem::attach | ( | QwtPolarPlot * | plot | ) |
Attach the item to a plot.
This method will attach a QwtPolarItem to the QwtPolarPlot argument. It will first detach the QwtPolarItem from any plot from a previous call to attach (if necessary). If a NULL argument is passed, it will detach from any QwtPolarPlot it was attached to.
plot | Plot widget |
|
virtual |
Interval, that is necessary to display the item
This interval can be useful for operations like clipping or autoscaling For items ( like the grid ), where a bounding interval makes no sense an invalid interval is returned.
scaleId | Scale id ( QwtPolar::Scale ) |
Reimplemented in QwtPolarCurve, QwtPolarSpectrogram, and QwtPolarMarker.
void QwtPolarItem::detach | ( | ) |
This method detaches a QwtPolarItem from the QwtPolarPlot it has been associated with.
detach() is equivalent to calling attach( NULL )
|
pure virtual |
Draw the item.
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 |
Implemented in QwtPolarGrid, QwtPolarCurve, QwtPolarSpectrogram, and QwtPolarMarker.
bool QwtPolarItem::isVisible | ( | ) | const |
|
virtual |
Update the legend and call QwtPolarPlot::autoRefresh for the parent plot.
|
virtual |
Update the legend of the parent plot.
|
virtual |
Return all information, that is needed to represent the item on the legend.
Most items are represented by one entry on the legend showing an icon and a text.
QwtLegendData is basically a list of QVariants that makes it possible to overload and reimplement legendData() to return almost any type of information, that is understood by the receiver that acts as the legend.
The default implementation returns one entry with the title() of the item and the legendIcon().
|
virtual |
The default implementation returns an invalid icon
index | Index of the legend entry ( usually there is only one ) |
size | Icon size |
Reimplemented in QwtPolarCurve.
QSize QwtPolarItem::legendIconSize | ( | ) | const |
|
virtual |
Some items like to display something (f.e. the azimuth axis) outside of the area of the interval of the radial scale. The default implementation returns 0 pixels
Reimplemented in QwtPolarGrid.
QwtPolarPlot * QwtPolarItem::plot | ( | ) | const |
uint QwtPolarItem::renderThreadCount | ( | ) | const |
|
virtual |
Return rtti for the specific class represented. QwtPolarItem is simply a virtual interface class, and base classes will implement this method with specific rtti values so a user can differentiate them.
The rtti value is useful for environments, where the runtime type information is disabled and it is not possible to do a dynamic_cast<...>.
Reimplemented in QwtPolarGrid, QwtPolarCurve, QwtPolarSpectrogram, and QwtPolarMarker.
void QwtPolarItem::setItemAttribute | ( | ItemAttribute | attribute, |
bool | on = true |
||
) |
Toggle an item attribute
attribute | Attribute type |
on | true/false |
void QwtPolarItem::setLegendIconSize | ( | const QSize & | size | ) |
Set the size of the legend icon
The default setting is 8x8 pixels
size | Size |
void QwtPolarItem::setRenderHint | ( | RenderHint | hint, |
bool | on = true |
||
) |
void QwtPolarItem::setRenderThreadCount | ( | uint | numThreads | ) |
On multi core systems rendering of certain plot item ( f.e QwtPolarSpectrogram ) can be done in parallel in several threads.
The default setting is set to 1.
numThreads | Number of threads to be used for rendering. If numThreads is set to 0, the system specific ideal thread count is used. |
The default thread count is 1 ( = no additional threads )
void QwtPolarItem::setTitle | ( | const QString & | title | ) |
void QwtPolarItem::setTitle | ( | const QwtText & | title | ) |
|
virtual |
void QwtPolarItem::setZ | ( | double | z | ) |
Set the z value.
Plot items are painted in increasing z-order.
z | Z-value |
bool QwtPolarItem::testItemAttribute | ( | ItemAttribute | attribute | ) | const |
Test an item attribute
attribute | Attribute type |
bool QwtPolarItem::testRenderHint | ( | RenderHint | hint | ) | const |
const QwtText & QwtPolarItem::title | ( | ) | const |
|
virtual |
Update the item to changes of the axes scale division.
Update the item, when the axes of plot have changed. The default implementation does nothing, but items that depend on the scale division (like QwtPolarGrid()) have to reimplement updateScaleDiv()
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 in QwtPolarGrid.
double QwtPolarItem::z | ( | ) | const |
Plot items are painted in increasing z-order.