Qwt Polar User's Guide
0.1.0
|
#include <qwt_polar_item.h>
Public Types | |
enum | RttiValues { Rtti_PolarItem = 0, Rtti_PolarGrid, Rtti_PolarScale, Rtti_PolarMarker, Rtti_PolarCurve, Rtti_PolarSpectrogram, Rtti_PolarUserItem = 1000 } |
enum | ItemAttribute { Legend = 1, AutoScale = 2 } |
enum | RenderHint { RenderAntialiased = 1 } |
Public Member Functions | |
QwtPolarItem (const QwtText &title=QwtText()) | |
virtual | ~QwtPolarItem () |
void | attach (QwtPolarPlot *plot) |
void | detach () |
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 |
double | z () const |
void | setZ (double z) |
void | show () |
void | hide () |
virtual void | setVisible (bool) |
bool | isVisible () const |
virtual void | itemChanged () |
virtual void | draw (QPainter *painter, const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap, const QwtDoublePoint &pole, double radius, const QwtDoubleRect &canvasRect) const =0 |
virtual QwtDoubleInterval | boundingInterval (int scaleId) const |
virtual QWidget * | legendItem () const |
virtual void | updateLegend (QwtLegend *) const |
virtual void | updateScaleDiv (const QwtScaleDiv &, const QwtScaleDiv &, const QwtDoubleInterval &) |
virtual int | marginHint () 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.
Render hints.
Runtime type information.
RttiValues is used to cast plot items, without having to enable runtime type information of the compiler.
QwtPolarItem::QwtPolarItem | ( | const QwtText & | title = QwtText() | ) | [explicit] |
QwtPolarItem::~QwtPolarItem | ( | ) | [virtual] |
Destroy the QwtPolarItem.
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 |
QwtDoubleInterval QwtPolarItem::boundingInterval | ( | int | scaleId | ) | const [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, QwtPolarMarker, and QwtPolarSpectrogram.
void QwtPolarItem::detach | ( | ) | [inline] |
This method detaches a QwtPolarItem from any QwtPolarPlot it has been associated with.
detach() is equivalent to calling attach( NULL )
virtual void QwtPolarItem::draw | ( | QPainter * | painter, |
const QwtScaleMap & | azimuthMap, | ||
const QwtScaleMap & | radialMap, | ||
const QwtDoublePoint & | pole, | ||
double | radius, | ||
const QwtDoubleRect & | canvasRect | ||
) | const [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, QwtPolarMarker, and QwtPolarSpectrogram.
void QwtPolarItem::hide | ( | ) |
Hide the item.
bool QwtPolarItem::isVisible | ( | ) | const |
void QwtPolarItem::itemChanged | ( | ) | [virtual] |
Update the legend and call QwtPolarPlot::autoRefresh for the parent plot.
QWidget * QwtPolarItem::legendItem | ( | ) | const [virtual] |
Allocate the widget that represents the item on the legend.
The default implementation is made for QwtPolarCurve and returns a QwtLegendItem(), but an item could be represented by any type of widget, by overloading legendItem() and updateLegend().
int QwtPolarItem::marginHint | ( | ) | 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 |
Return attached plot.
int QwtPolarItem::rtti | ( | ) | 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, QwtPolarMarker, and QwtPolarSpectrogram.
void QwtPolarItem::setItemAttribute | ( | ItemAttribute | attribute, |
bool | on = true |
||
) |
Toggle an item attribute
attribute | Attribute type |
on | true/false |
void QwtPolarItem::setRenderHint | ( | RenderHint | hint, |
bool | on = true |
||
) |
Toggle an render hint
hint | Render hint |
on | true/false |
void QwtPolarItem::setTitle | ( | const QString & | title | ) |
void QwtPolarItem::setTitle | ( | const QwtText & | title | ) |
void QwtPolarItem::setVisible | ( | bool | on | ) | [virtual] |
void QwtPolarItem::setZ | ( | double | z | ) |
Set the z value.
Plot items are painted in increasing z-order.
z | Z-value |
void QwtPolarItem::show | ( | ) |
Show the item.
bool QwtPolarItem::testItemAttribute | ( | ItemAttribute | attribute | ) | const |
Test an item attribute
attribute | Attribute type |
bool QwtPolarItem::testRenderHint | ( | RenderHint | hint | ) | const |
Test a render hint
hint | Render hint |
const QwtText & QwtPolarItem::title | ( | ) | const |
void QwtPolarItem::updateLegend | ( | QwtLegend * | legend | ) | const [virtual] |
Update the widget that represents the item on the legend.
updateLegend() is called from itemChanged() to adopt the widget representing the item on the legend to its new configuration.
The default implementation is made for QwtPolarCurve and updates a QwtLegendItem(), but an item could be represented by any type of widget, by overloading legendItem() and updateLegend().
Reimplemented in QwtPolarCurve.
void QwtPolarItem::updateScaleDiv | ( | const QwtScaleDiv & | , |
const QwtScaleDiv & | , | ||
const QwtDoubleInterval & | |||
) | [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.