Qwt Polar User's Guide  1.0.1
Public Types | Public Member Functions
QwtPolarItem Class Reference

#include <qwt_polar_item.h>

Inheritance diagram for QwtPolarItem:
Inheritance graph
[legend]

List of all members.

Public Types

enum  RttiValues {
  Rtti_PolarItem = 0,
  Rtti_PolarGrid,
  Rtti_PolarMarker,
  Rtti_PolarCurve,
  Rtti_PolarSpectrogram,
  Rtti_PolarUserItem = 1000
}
enum  ItemAttribute {
  Legend = 0x01,
  AutoScale = 0x02
}
enum  RenderHint { RenderAntialiased = 0x01 }
typedef QFlags< ItemAttributeItemAttributes
typedef QFlags< RenderHintRenderHints

Public Member Functions

 QwtPolarItem (const QwtText &title=QwtText())
virtual ~QwtPolarItem ()
void attach (QwtPolarPlot *plot)
void detach ()
QwtPolarPlotplot () 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 QPointF &pole, double radius, const QRectF &canvasRect) const =0
virtual QwtInterval boundingInterval (int scaleId) const
virtual QWidget * legendItem () const
virtual void updateLegend (QwtLegend *) const
virtual void updateScaleDiv (const QwtScaleDiv &, const QwtScaleDiv &, const QwtInterval &)
virtual int marginHint () const

Detailed Description

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.


Member Typedef Documentation

Item attributes.

Item attributes.


Member Enumeration Documentation

Plot Item Attributes.

See also:
setItemAttribute(), testItemAttribute()
Enumerator:
Legend 

The item is represented on the legend.

AutoScale 

The boundingRect() of the item is included in the autoscaling calculation.

Render hints.

See also:
setRenderHint(), testRenderHint()
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.


Constructor & Destructor Documentation

QwtPolarItem::QwtPolarItem ( const QwtText &  title = QwtText()) [explicit]

Constructor

Parameters:
titleItem title, f.e used on a legend
See also:
setTitle()
QwtPolarItem::~QwtPolarItem ( ) [virtual]

Destroy the QwtPolarItem.


Member Function Documentation

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.

Parameters:
plotPlot widget
See also:
QwtPolarItem::detach()
QwtInterval 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.

Parameters:
scaleIdScale id ( QwtPolar::Scale )
Returns:
Bounding interval of the plot item for a specific scale

Reimplemented in QwtPolarCurve, QwtPolarSpectrogram, and QwtPolarMarker.

void QwtPolarItem::detach ( ) [inline]

This method detaches a QwtPolarItem from any QwtPolarPlot it has been associated with.

detach() is equivalent to calling attach( NULL )

See also:
attach( QwtPolarPlot* plot )
virtual void QwtPolarItem::draw ( QPainter *  painter,
const QwtScaleMap &  azimuthMap,
const QwtScaleMap &  radialMap,
const QPointF &  pole,
double  radius,
const QRectF &  canvasRect 
) const [pure virtual]

Draw the item.

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

Implemented in QwtPolarGrid, QwtPolarCurve, QwtPolarSpectrogram, and QwtPolarMarker.

void QwtPolarItem::hide ( )

Hide the item.

bool QwtPolarItem::isVisible ( ) const
Returns:
true if visible
See also:
setVisible(), show(), hide()
void QwtPolarItem::itemChanged ( ) [virtual]

Update the legend and call QwtPolarPlot::autoRefresh for the parent plot.

See also:
updateLegend()
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().

Returns:
QwtLegendItem()
See also:
updateLegend() QwtLegend()
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

Returns:
Hint for the margin

Reimplemented in QwtPolarGrid.

QwtPolarPlot * QwtPolarItem::plot ( ) const
Returns:
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<...>.

Returns:
rtti value
See also:
RttiValues

Reimplemented in QwtPolarGrid, QwtPolarCurve, QwtPolarSpectrogram, and QwtPolarMarker.

void QwtPolarItem::setItemAttribute ( ItemAttribute  attribute,
bool  on = true 
)

Toggle an item attribute

Parameters:
attributeAttribute type
ontrue/false
See also:
testItemAttribute(), ItemAttribute
void QwtPolarItem::setRenderHint ( RenderHint  hint,
bool  on = true 
)

Toggle an render hint

Parameters:
hintRender hint
ontrue/false
See also:
testRenderHint(), RenderHint
void QwtPolarItem::setTitle ( const QString &  title)

Set a new title

Parameters:
titleTitle
See also:
title()
void QwtPolarItem::setTitle ( const QwtText &  title)

Set a new title

Parameters:
titleTitle
See also:
title()
void QwtPolarItem::setVisible ( bool  on) [virtual]

Show/Hide the item

Parameters:
onShow if true, otherwise hide
See also:
isVisible(), show(), hide()
void QwtPolarItem::setZ ( double  z)

Set the z value.

Plot items are painted in increasing z-order.

Parameters:
zZ-value
See also:
z(), QwtPolarItemDict::itemList()
void QwtPolarItem::show ( )

Show the item.

bool QwtPolarItem::testItemAttribute ( ItemAttribute  attribute) const

Test an item attribute

Parameters:
attributeAttribute type
Returns:
true/false
See also:
setItemAttribute(), ItemAttribute
bool QwtPolarItem::testRenderHint ( RenderHint  hint) const

Test a render hint

Parameters:
hintRender hint
Returns:
true/false
See also:
setRenderHint(), RenderHint
const QwtText & QwtPolarItem::title ( ) const
Returns:
Title of the item
See also:
setTitle()
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().

See also:
legendItem(), itemChanged(), QwtLegend()

Reimplemented in QwtPolarCurve.

void QwtPolarItem::updateScaleDiv ( const QwtScaleDiv &  azimuthScaleDiv,
const QwtScaleDiv &  radialScaleDiv,
const QwtInterval &  interval 
) [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()

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::updateAxes()

Reimplemented in QwtPolarGrid.

double QwtPolarItem::z ( ) const

Plot items are painted in increasing z-order.

Returns:
Z value
See also:
setZ(), QwtPolarItemDict::itemList()