QwtPolarPlot Class Reference
A plotting widget, displaying a polar coordinate system.
More...
#include <qwt_polar_plot.h>
List of all members.
Public Types |
enum | LegendPosition {
LeftLegend,
RightLegend,
BottomLegend,
TopLegend,
ExternalLegend
} |
Public Slots |
virtual void | replot () |
void | autoRefresh () |
void | setAzimuthOrigin (double) |
Signals |
void | legendClicked (QwtPolarItem *plotItem) |
void | legendChecked (QwtPolarItem *plotItem, bool on) |
void | layoutChanged () |
Public Member Functions |
| QwtPolarPlot (QWidget *parent=NULL) |
| QwtPolarPlot (const QwtText &title, QWidget *parent=NULL) |
virtual | ~QwtPolarPlot () |
void | setTitle (const QString &) |
void | setTitle (const QwtText &) |
QwtText | title () const |
QwtTextLabel * | titleLabel () |
const QwtTextLabel * | titleLabel () const |
void | setAutoReplot (bool tf=true) |
bool | autoReplot () const |
void | setAutoScale (int scaleId) |
bool | hasAutoScale (int scaleId) const |
void | setScaleMaxMinor (int scaleId, int maxMinor) |
int | scaleMaxMinor (int scaleId) const |
int | scaleMaxMajor (int scaleId) const |
void | setScaleMaxMajor (int scaleId, int maxMajor) |
QwtScaleEngine * | scaleEngine (int scaleId) |
const QwtScaleEngine * | scaleEngine (int scaleId) const |
void | setScaleEngine (int scaleId, QwtScaleEngine *) |
void | setScale (int scaleId, double min, double max, double step=0) |
void | setScaleDiv (int scaleId, const QwtScaleDiv &) |
const QwtScaleDiv * | scaleDiv (int scaleId) const |
QwtScaleDiv * | scaleDiv (int scaleId) |
QwtScaleMap | scaleMap (int scaleId, double radius) const |
QwtScaleMap | scaleMap (int scaleId) const |
void | updateScale (int scaleId) |
double | azimuthOrigin () const |
void | zoom (const QwtPolarPoint &, double factor) |
void | unzoom () |
QwtPolarPoint | zoomPos () const |
double | zoomFactor () const |
virtual void | polish () |
QwtPolarCanvas * | canvas () |
const QwtPolarCanvas * | canvas () const |
void | setPlotBackground (const QBrush &c) |
const QBrush & | plotBackground () const |
virtual void | drawCanvas (QPainter *, const QwtDoubleRect &) const |
void | insertLegend (QwtLegend *, LegendPosition=QwtPolarPlot::RightLegend, double ratio=-1.0) |
QwtLegend * | legend () |
const QwtLegend * | legend () const |
QwtPolarLayout * | plotLayout () |
const QwtPolarLayout * | plotLayout () const |
QwtDoubleInterval | visibleInterval () const |
QwtDoubleRect | plotRect () const |
QwtDoubleRect | plotRect (const QRect &) const |
int | plotMarginHint () const |
void | renderTo (QPaintDevice &) const |
virtual void | renderTo (QPainter *, const QRect &) const |
Protected Slots |
virtual void | legendItemClicked () |
virtual void | legendItemChecked (bool) |
Protected Member Functions |
virtual bool | event (QEvent *) |
virtual void | resizeEvent (QResizeEvent *) |
virtual void | updateLayout () |
virtual void | drawItems (QPainter *painter, const QwtScaleMap &radialMap, const QwtScaleMap &azimuthMap, const QwtDoublePoint &pole, double radius, const QwtDoubleRect &canvasRect) const |
virtual void | renderTitle (QPainter *, const QRect &) const |
virtual void | renderLegend (QPainter *, const QRect &) const |
virtual void | renderLegendItem (QPainter *, const QWidget *, const QRect &) const |
Detailed Description
A plotting widget, displaying a polar coordinate system.
An unlimited number of plot items can be displayed on its canvas. Plot items might be curves (QwtPolarCurve), markers (QwtPolarMarker), the grid (QwtPolarGrid), or anything else derived from QwtPolarItem.
The coordinate system is defined by a radial and a azimuth scale. The scales at the axes can be explicitely set (QwtScaleDiv), or are calculated from the plot items, using algorithms (QwtScaleEngine) which can be configured separately for each axis. Autoscaling is supported for the radial scale.
In opposite to QwtPlot the scales might be different from the view, that is displayed on the canvas. The view can be changed by zooming - f.e. by using QwtPolarPanner or QwtPolarMaginfier.
Member Enumeration Documentation
Position of the legend, relative to the canvas.
- LeftLegend
The legend will be left from the canvas.
- RightLegend
The legend will be right from the canvas.
- BottomLegend
The legend will be below the canvas.
- TopLegend
The legend will be between canvas and title.
- ExternalLegend
External means that only the content of the legend will be handled by QwtPlot, but not its geometry. This might be interesting if an application wants to have a legend in an external window ( or on the canvas ).
- Note:
- In case of ExternalLegend, the legend is not painted by renderTo().
- See also:
- insertLegend()
Constructor & Destructor Documentation
QwtPolarPlot::QwtPolarPlot |
( |
QWidget * |
parent = NULL |
) |
[explicit] |
QwtPolarPlot::QwtPolarPlot |
( |
const QwtText & |
title, |
|
|
QWidget * |
parent = NULL | |
|
) |
| | |
Constructor
- Parameters:
-
| title | Title text |
| parent | Parent widget |
QwtPolarPlot::~QwtPolarPlot |
( |
|
) |
[virtual] |
Member Function Documentation
void QwtPolarPlot::autoRefresh |
( |
|
) |
[slot] |
Replots the plot if QwtPlot::autoReplot() is true
.
bool QwtPolarPlot::autoReplot |
( |
|
) |
const |
- Returns:
- true if the autoReplot option is set.
double QwtPolarPlot::azimuthOrigin |
( |
|
) |
const |
The azimuth origin is the angle where the azimuth scale shows the value 0.0.
- Returns:
- Origin of the azimuth scale
- See also:
- setAzimuthOrigin()
- Returns:
- the plot's canvas
- Returns:
- the plot's canvas
void QwtPolarPlot::drawCanvas |
( |
QPainter * |
painter, |
|
|
const QwtDoubleRect & |
canvasRect | |
|
) |
| | const [virtual] |
Redraw the canvas.
- Parameters:
-
| painter | Painter used for drawing |
| canvasRect | Contents rect of the canvas |
void QwtPolarPlot::drawItems |
( |
QPainter * |
painter, |
|
|
const QwtScaleMap & |
azimuthMap, |
|
|
const QwtScaleMap & |
radialMap, |
|
|
const QwtDoublePoint & |
pole, |
|
|
double |
radius, |
|
|
const QwtDoubleRect & |
canvasRect | |
|
) |
| | const [protected, virtual] |
Redraw the canvas items.
- Parameters:
-
| painter | Painter used for drawing |
| 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 |
bool QwtPolarPlot::event |
( |
QEvent * |
e |
) |
[protected, virtual] |
Adds handling of polish requests.
bool QwtPolarPlot::hasAutoScale |
( |
int |
scaleId |
) |
const |
- Returns:
true
if autoscaling is enabled
- Parameters:
-
- See also:
- setAutoScale()
Insert a legend.
If the position legend is QwtPolarPlot::LeftLegend
or QwtPolarPlot::RightLegend
the legend will be organized in one column from top to down. Otherwise the legend items will be placed in a table with a best fit number of columns from left to right.
If pos != QwtPolarPlot::ExternalLegend the plot widget will become parent of the legend. It will be deleted when the plot is deleted, or another legend is set with insertLegend().
- Parameters:
-
| legend | Legend |
| pos | The legend's position. For top/left position the number of colums will be limited to 1, otherwise it will be set to unlimited. |
| ratio | Ratio between legend and the bounding rect of title, canvas and axes. The legend will be shrinked if it would need more space than the given ratio. The ratio is limited to ]0.0 .. 1.0]. In case of <= 0.0 it will be reset to the default ratio. The default vertical/horizontal ratio is 0.33/0.5. |
- See also:
- legend(), QwtPolarLayout::legendPosition(), QwtPolarLayout::setLegendPosition()
void QwtPolarPlot::layoutChanged |
( |
|
) |
[signal] |
A signal that is emitted, whenever the layout of the plot has been recalculated.
const QwtLegend * QwtPolarPlot::legend |
( |
|
) |
const |
QwtLegend * QwtPolarPlot::legend |
( |
|
) |
|
void QwtPolarPlot::legendChecked |
( |
QwtPolarItem * |
plotItem, |
|
|
bool |
on | |
|
) |
| | [signal] |
A signal which is emitted when the user has clicked on a legend item, which is in QwtLegend::CheckableItem mode
- Parameters:
-
| plotItem | Corresponding plot item of the selected legend item |
| on | True when the legen item is checked |
- Note:
- clicks are disabled as default
- See also:
- QwtLegend::setItemMode, QwtLegend::itemMode
void QwtPolarPlot::legendClicked |
( |
QwtPolarItem * |
plotItem |
) |
[signal] |
A signal which is emitted when the user has clicked on a legend item, which is in QwtLegend::ClickableItem mode.
- Parameters:
-
| plotItem | Corresponding plot item of the selected legend item |
- Note:
- clicks are disabled as default
- See also:
- QwtLegend::setItemMode, QwtLegend::itemMode
void QwtPolarPlot::legendItemChecked |
( |
bool |
on |
) |
[protected, virtual, slot] |
Called internally when the legend has been checked Emits a legendClicked() signal.
void QwtPolarPlot::legendItemClicked |
( |
|
) |
[protected, virtual, slot] |
Called internally when the legend has been clicked on. Emits a legendClicked() signal.
const QBrush & QwtPolarPlot::plotBackground |
( |
|
) |
const |
- Returns:
- Layout, responsible for the geometry of the plot components
- Returns:
- Layout, responsible for the geometry of the plot components
int QwtPolarPlot::plotMarginHint |
( |
|
) |
const |
- Returns:
- Maximum of all item margin hints.
- See also:
- QwtPolarItem::marhinHint()
QwtDoubleRect QwtPolarPlot::plotRect |
( |
const QRect & |
canvasRect |
) |
const |
Calculate the bounding rect of the plot area.
The plot area depends on the zoom parameters.
- Parameters:
-
| canvasRect | Rectangle of the canvas |
- Returns:
- Rectangle for displaying 100% of the plot
QwtDoubleRect QwtPolarPlot::plotRect |
( |
|
) |
const |
Calculate the bounding rect of the plot area.
The plot area depends on the size of the canvas and the zoom parameters.
void QwtPolarPlot::polish |
( |
|
) |
[virtual] |
void QwtPolarPlot::renderLegend |
( |
QPainter * |
painter, |
|
|
const QRect & |
rect | |
|
) |
| | const [protected, virtual] |
Render the legend into a given rectangle.
- Parameters:
-
| painter | Painter |
| rect | Bounding rectangle |
void QwtPolarPlot::renderLegendItem |
( |
QPainter * |
painter, |
|
|
const QWidget * |
w, |
|
|
const QRect & |
rect | |
|
) |
| | const [protected, virtual] |
Render the legend item into a given rectangle.
- Parameters:
-
| painter | Painter |
| w | Widget representing a legend item |
| rect | Bounding rectangle |
void QwtPolarPlot::renderTitle |
( |
QPainter * |
painter, |
|
|
const QRect & |
rect | |
|
) |
| | const [protected, virtual] |
Render the title into a given rectangle.
- Parameters:
-
| painter | Painter |
| rect | Bounding rectangle |
void QwtPolarPlot::renderTo |
( |
QPainter * |
painter, |
|
|
const QRect & |
plotRect | |
|
) |
| | const [virtual] |
Render the plot to a given rectangle ( f.e on a QPrinter, QSvgRenderer ).
- Parameters:
-
| painter | Painter |
| plotRect | Bounding rectangle for the plot |
void QwtPolarPlot::renderTo |
( |
QPaintDevice & |
paintDev |
) |
const |
Render the plot to a paint device ( f.e a QPrinter ).
A convenience method, that calculates the target rectangle from the paintdevice metrics.
- See also:
- renderTo(QPainter *, const QRect &)
void QwtPolarPlot::replot |
( |
|
) |
[virtual, slot] |
Redraw the plot.
If the autoReplot option is not set (which is the default) or if any curves are attached to raw data, the plot has to be refreshed explicitly in order to make changes visible.
- See also:
- setAutoReplot()
- Warning:
- Calls canvas()->repaint, take care of infinite recursions
void QwtPolarPlot::resizeEvent |
( |
QResizeEvent * |
e |
) |
[protected, virtual] |
Resize and update internal layout.
QwtScaleDiv * QwtPolarPlot::scaleDiv |
( |
int |
scaleId |
) |
|
Return the scale division of a specified scale.
scaleDiv(scaleId)->lBound(), scaleDiv(scaleId)->hBound() are the current limits of the scale.
- Parameters:
-
- Returns:
- Scale division
- See also:
- QwtScaleDiv, setScaleDiv(), setScale()
const QwtScaleDiv * QwtPolarPlot::scaleDiv |
( |
int |
scaleId |
) |
const |
Return the scale division of a specified scale.
scaleDiv(scaleId)->lBound(), scaleDiv(scaleId)->hBound() are the current limits of the scale.
- Parameters:
-
- Returns:
- Scale division
- See also:
- QwtScaleDiv, setScaleDiv(), setScale()
const QwtScaleEngine * QwtPolarPlot::scaleEngine |
( |
int |
scaleId |
) |
const |
QwtScaleEngine * QwtPolarPlot::scaleEngine |
( |
int |
scaleId |
) |
|
QwtScaleMap QwtPolarPlot::scaleMap |
( |
int |
scaleId |
) |
const |
Build a scale map
The azimuth map translates between the scale values and angles from [0.0, 2 * PI[. The radial map translates scale values into the distance from the pole. The radial map is calculated from the current geometry of the canvas.
- Parameters:
-
- Returns:
- Map for the scale on the canvas. With this map pixel coordinates can translated to plot coordinates and vice versa.
- See also:
- QwtScaleMap, transform(), invTransform()
QwtScaleMap QwtPolarPlot::scaleMap |
( |
int |
scaleId, |
|
|
double |
radius | |
|
) |
| | const |
Build a scale map
The azimuth map translates between the scale values and angles from [0.0, 2 * PI[. The radial map translates scale values into the distance from the pole.
- Parameters:
-
| scaleId | Scale index |
| radius | Radius of the plot are in pixels |
- Returns:
- Map for the scale on the canvas. With this map pixel coordinates can translated to plot coordinates and vice versa.
- See also:
- QwtScaleMap, transform(), invTransform()
int QwtPolarPlot::scaleMaxMajor |
( |
int |
scaleId |
) |
const |
- Returns:
- the maximum number of major ticks for a specified axis
- Parameters:
-
- See also:
- setScaleMaxMajor()
int QwtPolarPlot::scaleMaxMinor |
( |
int |
scaleId |
) |
const |
- Returns:
- the maximum number of minor ticks for a specified axis
- Parameters:
-
- See also:
- setScaleMaxMinor()
void QwtPolarPlot::setAutoReplot |
( |
bool |
enable = true |
) |
|
Set or reset the autoReplot option.
If the autoReplot option is set, the plot will be updated implicitly by manipulating member functions. Since this may be time-consuming, it is recommended to leave this option switched off and call replot() explicitly if necessary.
The autoReplot option is set to false by default, which means that the user has to call replot() in order to make changes visible.
- Parameters:
-
| enable | true or false . Defaults to true . |
- See also:
- replot()
void QwtPolarPlot::setAutoScale |
( |
int |
scaleId |
) |
|
Enable autoscaling.
This member function is used to switch back to autoscaling mode after a fixed scale has been set. Autoscaling calculates a useful scale division from the bounding interval of all plot items with the QwtPolarItem::AutoScale attribute.
Autoscaling is only supported for the radial scale and enabled as default.
- Parameters:
-
- See also:
- hasAutoScale(), setScale(), setScaleDiv(), QwtPolarItem::boundingInterval()
void QwtPolarPlot::setAzimuthOrigin |
( |
double |
origin |
) |
[slot] |
Change the origin of the azimuth scale.
The azimuth origin is the angle where the azimuth scale shows the value 0.0. The default origin is 0.0.
- Parameters:
-
- See also:
- azimuthOrigin()
void QwtPolarPlot::setPlotBackground |
( |
const QBrush & |
brush |
) |
|
Set the background of the plot area.
The plot area is the circle around the pole. It's radius is defined by the radial scale.
- Parameters:
-
- See also:
- plotBackground(), plotArea()
void QwtPolarPlot::setScale |
( |
int |
scaleId, |
|
|
double |
min, |
|
|
double |
max, |
|
|
double |
stepSize = 0 | |
|
) |
| | |
Disable autoscaling and specify a fixed scale for a selected scale.
- Parameters:
-
| scaleId | Scale index |
| min | |
| max | minimum and maximum of the scale |
| stepSize | Major step size. If step == 0 , the step size is calculated automatically using the maxMajor setting. |
- See also:
- setScaleMaxMajor(), setAutoScale()
void QwtPolarPlot::setScaleDiv |
( |
int |
scaleId, |
|
|
const QwtScaleDiv & |
scaleDiv | |
|
) |
| | |
Disable autoscaling and specify a fixed scale for a selected scale.
- Parameters:
-
| scaleId | Scale index |
| scaleDiv | Scale division |
- See also:
- setScale(), setAutoScale()
void QwtPolarPlot::setScaleEngine |
( |
int |
scaleId, |
|
|
QwtScaleEngine * |
scaleEngine | |
|
) |
| | |
Change the scale engine for an axis
- Parameters:
-
| scaleId | Scale index |
| scaleEngine | Scale engine |
- See also:
- axisScaleEngine()
void QwtPolarPlot::setScaleMaxMajor |
( |
int |
scaleId, |
|
|
int |
maxMajor | |
|
) |
| | |
Set the maximum number of major scale intervals for a specified scale
- Parameters:
-
| scaleId | Scale index |
| maxMajor | maximum number of major steps |
- See also:
- scaleMaxMajor()
void QwtPolarPlot::setScaleMaxMinor |
( |
int |
scaleId, |
|
|
int |
maxMinor | |
|
) |
| | |
Set the maximum number of major scale intervals for a specified scale
- Parameters:
-
| scaleId | Scale index |
| maxMinor | maximum number of minor steps |
- See also:
- scaleMaxMajor()
void QwtPolarPlot::setTitle |
( |
const QwtText & |
title |
) |
|
Change the plot's title
- Parameters:
-
void QwtPolarPlot::setTitle |
( |
const QString & |
title |
) |
|
Change the plot's title
- Parameters:
-
QwtText QwtPolarPlot::title |
( |
|
) |
const |
const QwtTextLabel * QwtPolarPlot::titleLabel |
( |
|
) |
const |
- Returns:
- the plot's titel label.
QwtTextLabel * QwtPolarPlot::titleLabel |
( |
|
) |
|
void QwtPolarPlot::unzoom |
( |
|
) |
|
Unzoom the plot
- See also:
- zoom()
void QwtPolarPlot::updateLayout |
( |
|
) |
[protected, virtual] |
void QwtPolarPlot::updateScale |
( |
int |
scaleId |
) |
|
Rebuild the scale
- Parameters:
-
QwtDoubleInterval QwtPolarPlot::visibleInterval |
( |
|
) |
const |
Calculate the bounding interval of the radial scale that is visible on the canvas.
void QwtPolarPlot::zoom |
( |
const QwtPolarPoint & |
zoomPos, |
|
|
double |
zoomFactor | |
|
) |
| | |
Translate and in/decrease the zoom factor.
In zoom mode the zoom position is in the center of the canvas. The radius of the circle depends on the size of the plot canvas, that is devided by the zoom factor. Thus a factor < 1.0 zoom in.
Setting an invalid zoom position disables zooming.
- Parameters:
-
| zoomPos | Center of the translation |
| zoomFactor | Zoom factor |
- See also:
- unzoom(), zoomPos(), zoomFactor()
double QwtPolarPlot::zoomFactor |
( |
|
) |
const |