QwtPolarItem Class Reference

Base class for items on a polar plot. More...

#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_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 ()
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 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

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 Enumeration Documentation

Plot Item Attributes.

  • Legend
    The item is represented on the legend.
  • AutoScale
    The boundingRect() of the item is included in the autoscaling calculation.
See also:
setItemAttribute(), testItemAttribute()

Render hints.

Runtime type information.

RttiValues is used to cast plot items, without having to enable runtime type information of the compiler.


Constructor & Destructor Documentation

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

Constructor

Parameters:
title Item 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:
plot Plot widget
See also:
QwtPolarItem::detach()
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.

Parameters:
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 )

See also:
attach( QwtPolarPlot* plot )
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.

Parameters:
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 QwtPolarCurve, QwtPolarGrid, QwtPolarMarker, and QwtPolarSpectrogram.

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

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

Returns:
rtti value
See also:
RttiValues

Reimplemented in QwtPolarCurve, QwtPolarGrid, QwtPolarMarker, and QwtPolarSpectrogram.

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

Toggle an item attribute

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

Toggle an render hint

Parameters:
hint Render hint
on true/false
See also:
testRenderHint(), RenderHint
void QwtPolarItem::setTitle ( const QwtText &  title  ) 

Set a new title

Parameters:
title Title
See also:
title()
void QwtPolarItem::setTitle ( const QString &  title  ) 

Set a new title

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

Show/Hide the item

Parameters:
on Show 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:
z Z-value
See also:
z(), QwtPolarItemDict::itemList()
void QwtPolarItem::show (  ) 

Show the item.

bool QwtPolarItem::testItemAttribute ( ItemAttribute  attribute  )  const

Test an item attribute

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

Test a render hint

Parameters:
hint Render 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 &  ,
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()

Parameters:
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
See also:
QwtPolarPlot::updateAxes()

Reimplemented in QwtPolarGrid.

double QwtPolarItem::z (  )  const

Plot items are painted in increasing z-order.

Returns:
setZ(), QwtPolarItemDict::itemList()

Generated on 10 Apr 2012 for Qwt Polar User's Guide by  doxygen 1.6.1