Qwt User's Guide 6.3.0
|
A plotting widget, displaying a polar coordinate system. More...
#include <qwt_polar_plot.h>
Public Types | |
enum | LegendPosition { LeftLegend , RightLegend , BottomLegend , TopLegend , ExternalLegend } |
Public Slots | |
virtual void | replot () |
Redraw the plot. | |
void | autoRefresh () |
Replots the plot if QwtPlot::autoReplot() is true . | |
void | setAzimuthOrigin (double) |
Change the origin of the azimuth scale. | |
Signals | |
void | itemAttached (QwtPolarItem *plotItem, bool on) |
void | legendDataChanged (const QVariant &itemInfo, const QList< QwtLegendData > &data) |
void | layoutChanged () |
Public Member Functions | |
QwtPolarPlot (QWidget *parent=NULL) | |
QwtPolarPlot (const QwtText &title, QWidget *parent=NULL) | |
virtual | ~QwtPolarPlot () |
Destructor. | |
void | setTitle (const QString &) |
void | setTitle (const QwtText &) |
QwtText | title () const |
QwtTextLabel * | titleLabel () |
const QwtTextLabel * | titleLabel () const |
void | setAutoReplot (bool tf=true) |
Set or reset the autoReplot option. | |
bool | autoReplot () const |
void | setAutoScale (int scaleId) |
Enable autoscaling. | |
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) |
Disable autoscaling and specify a fixed scale for a selected scale. | |
void | setScaleDiv (int scaleId, const QwtScaleDiv &) |
Disable autoscaling and specify a fixed scale for a selected scale. | |
const QwtScaleDiv * | scaleDiv (int scaleId) const |
Return the scale division of a specified scale. | |
QwtScaleDiv * | scaleDiv (int scaleId) |
Return the scale division of a specified scale. | |
QwtScaleMap | scaleMap (int scaleId, double radius) const |
QwtScaleMap | scaleMap (int scaleId) const |
void | updateScale (int scaleId) |
double | azimuthOrigin () const |
void | zoom (const QwtPointPolar &, double factor) |
Translate and in/decrease the zoom factor. | |
void | unzoom () |
QwtPointPolar | zoomPos () const |
double | zoomFactor () const |
QwtPolarCanvas * | canvas () |
const QwtPolarCanvas * | canvas () const |
void | setPlotBackground (const QBrush &c) |
Set the background of the plot area. | |
const QBrush & | plotBackground () const |
virtual void | drawCanvas (QPainter *, const QRectF &) const |
void | insertLegend (QwtAbstractLegend *, LegendPosition=RightLegend, double ratio=-1.0) |
Insert a legend. | |
QwtAbstractLegend * | legend () |
const QwtAbstractLegend * | legend () const |
void | updateLegend () |
void | updateLegend (const QwtPolarItem *) |
QwtPolarLayout * | plotLayout () |
const QwtPolarLayout * | plotLayout () const |
QwtInterval | visibleInterval () const |
QRectF | plotRect () const |
QRectF | plotRect (const QRectF &) const |
Calculate the bounding rect of the plot area. | |
int | plotMarginHint () const |
virtual QVariant | itemToInfo (QwtPolarItem *) const |
Build an information, that can be used to identify a plot item on the legend. | |
virtual QwtPolarItem * | infoToItem (const QVariant &) const |
Identify the plot item according to an item info object, that has bee generated from itemToInfo(). | |
Public Member Functions inherited from QwtPolarItemDict | |
QwtPolarItemDict () | |
~QwtPolarItemDict () | |
void | setAutoDelete (bool) |
bool | autoDelete () const |
const QwtPolarItemList & | itemList () const |
A QwtPolarItemList of all attached plot items. | |
void | detachItems (int rtti=QwtPolarItem::Rtti_PolarItem, bool autoDelete=true) |
Protected Member Functions | |
virtual bool | event (QEvent *) override |
Qt event handler. | |
virtual void | resizeEvent (QResizeEvent *) override |
Resize and update internal layout. | |
virtual void | updateLayout () |
Rebuild the layout. | |
virtual void | drawItems (QPainter *painter, const QwtScaleMap &radialMap, const QwtScaleMap &azimuthMap, const QPointF &pole, double radius, const QRectF &canvasRect) const |
Protected Member Functions inherited from QwtPolarItemDict | |
void | insertItem (QwtPolarItem *) |
void | removeItem (QwtPolarItem *) |
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 explicitly 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.
Definition at line 46 of file qwt_polar_plot.h.
Position of the legend, relative to the canvas.
Enumerator | |
---|---|
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 ).
|
Definition at line 59 of file qwt_polar_plot.h.
|
explicit |
QwtPolarPlot::QwtPolarPlot | ( | const QwtText & | title, |
QWidget * | parent = NULL ) |
Constructor
title | Title text |
parent | Parent widget |
Definition at line 99 of file qwt_polar_plot.cpp.
|
virtual |
Destructor.
Definition at line 106 of file qwt_polar_plot.cpp.
|
slot |
Replots the plot if QwtPlot::autoReplot() is true
.
Definition at line 847 of file qwt_polar_plot.cpp.
bool QwtPolarPlot::autoReplot | ( | ) | const |
Definition at line 348 of file qwt_polar_plot.cpp.
double QwtPolarPlot::azimuthOrigin | ( | ) | const |
The azimuth origin is the angle where the azimuth scale shows the value 0.0.
Definition at line 632 of file qwt_polar_plot.cpp.
QwtPolarCanvas * QwtPolarPlot::canvas | ( | ) |
Definition at line 914 of file qwt_polar_plot.cpp.
const QwtPolarCanvas * QwtPolarPlot::canvas | ( | ) | const |
Definition at line 920 of file qwt_polar_plot.cpp.
|
virtual |
Redraw the canvas.
painter | Painter used for drawing |
canvasRect | Contents rect of the canvas |
Definition at line 930 of file qwt_polar_plot.cpp.
|
protectedvirtual |
Redraw the canvas items.
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 |
Definition at line 975 of file qwt_polar_plot.cpp.
|
overrideprotectedvirtual |
Qt event handler.
Handles QEvent::LayoutRequest and QEvent::PolishRequest
e | Qt Event |
Definition at line 762 of file qwt_polar_plot.cpp.
bool QwtPolarPlot::hasAutoScale | ( | int | scaleId | ) | const |
true
if autoscaling is enabled scaleId | Scale index |
Definition at line 386 of file qwt_polar_plot.cpp.
|
virtual |
Identify the plot item according to an item info object, that has bee generated from itemToInfo().
The default implementation simply tries to unwrap a QwtPlotItem pointer:
itemInfo | Plot item |
Definition at line 1357 of file qwt_polar_plot.cpp.
void QwtPolarPlot::insertLegend | ( | QwtAbstractLegend * | legend, |
QwtPolarPlot::LegendPosition | pos = RightLegend, | ||
double | ratio = -1.0 ) |
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().
legend | Legend |
pos | The legend's position. For top/left position the number of columns 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 shrunk 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. |
Definition at line 191 of file qwt_polar_plot.cpp.
|
signal |
A signal indicating, that an item has been attached/detached
plotItem | Plot item |
on | Attached/Detached |
|
virtual |
Build an information, that can be used to identify a plot item on the legend.
The default implementation simply wraps the plot item into a QVariant object. When overloading itemToInfo() usually infoToItem() needs to reimplemeted too.
plotItem | Plot item |
Definition at line 1337 of file qwt_polar_plot.cpp.
|
signal |
A signal that is emitted, whenever the layout of the plot has been recalculated.
QwtAbstractLegend * QwtPolarPlot::legend | ( | ) |
const QwtAbstractLegend * QwtPolarPlot::legend | ( | ) | const |
|
signal |
A signal with the attributes how to update the legend entries for a plot item.
itemInfo | Info about a plot, build from itemToInfo() |
data | Attributes of the entries ( usually <= 1 ) for the plot item. |
const QBrush & QwtPolarPlot::plotBackground | ( | ) | const |
Definition at line 322 of file qwt_polar_plot.cpp.
QwtPolarLayout * QwtPolarPlot::plotLayout | ( | ) |
Definition at line 1274 of file qwt_polar_plot.cpp.
const QwtPolarLayout * QwtPolarPlot::plotLayout | ( | ) | const |
Definition at line 1282 of file qwt_polar_plot.cpp.
int QwtPolarPlot::plotMarginHint | ( | ) | const |
Definition at line 1095 of file qwt_polar_plot.cpp.
QRectF QwtPolarPlot::plotRect | ( | ) | const |
The plot area depends on the size of the canvas and the zoom parameters.
Definition at line 1120 of file qwt_polar_plot.cpp.
QRectF QwtPolarPlot::plotRect | ( | const QRectF & | canvasRect | ) | const |
Calculate the bounding rect of the plot area.
The plot area depends on the zoom parameters.
canvasRect | Rectangle of the canvas |
Definition at line 1133 of file qwt_polar_plot.cpp.
|
virtualslot |
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.
Definition at line 899 of file qwt_polar_plot.cpp.
|
overrideprotectedvirtual |
Resize and update internal layout.
Definition at line 784 of file qwt_polar_plot.cpp.
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.
scaleId | Scale index |
Definition at line 598 of file qwt_polar_plot.cpp.
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.
scaleId | Scale index |
Definition at line 579 of file qwt_polar_plot.cpp.
QwtScaleEngine * QwtPolarPlot::scaleEngine | ( | int | scaleId | ) |
scaleId | Scale index |
Definition at line 499 of file qwt_polar_plot.cpp.
const QwtScaleEngine * QwtPolarPlot::scaleEngine | ( | int | scaleId | ) | const |
scaleId | Scale index |
Definition at line 513 of file qwt_polar_plot.cpp.
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.
scaleId | Scale index |
Definition at line 710 of file qwt_polar_plot.cpp.
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.
scaleId | Scale index |
radius | Radius of the plot are in pixels |
Definition at line 730 of file qwt_polar_plot.cpp.
int QwtPolarPlot::scaleMaxMajor | ( | int | scaleId | ) | const |
scaleId | Scale index |
Definition at line 460 of file qwt_polar_plot.cpp.
int QwtPolarPlot::scaleMaxMinor | ( | int | scaleId | ) | const |
scaleId | Scale index |
Definition at line 423 of file qwt_polar_plot.cpp.
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.
enable | true or false . Defaults to true . |
Definition at line 342 of file qwt_polar_plot.cpp.
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.
scaleId | Scale index |
Definition at line 368 of file qwt_polar_plot.cpp.
|
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.
origin | New origin |
Definition at line 615 of file qwt_polar_plot.cpp.
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.
brush | Background Brush |
Definition at line 309 of file qwt_polar_plot.cpp.
void QwtPolarPlot::setScale | ( | int | scaleId, |
double | min, | ||
double | max, | ||
double | stepSize = 0 ) |
Disable autoscaling and specify a fixed scale for a selected scale.
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. |
Definition at line 530 of file qwt_polar_plot.cpp.
void QwtPolarPlot::setScaleDiv | ( | int | scaleId, |
const QwtScaleDiv & | scaleDiv ) |
Disable autoscaling and specify a fixed scale for a selected scale.
scaleId | Scale index |
scaleDiv | Scale division |
Definition at line 554 of file qwt_polar_plot.cpp.
void QwtPolarPlot::setScaleEngine | ( | int | scaleId, |
QwtScaleEngine * | scaleEngine ) |
Change the scale engine for an axis
scaleId | Scale index |
scaleEngine | Scale engine |
Definition at line 476 of file qwt_polar_plot.cpp.
void QwtPolarPlot::setScaleMaxMajor | ( | int | scaleId, |
int | maxMajor ) |
Set the maximum number of major scale intervals for a specified scale
scaleId | Scale index |
maxMajor | maximum number of major steps |
Definition at line 438 of file qwt_polar_plot.cpp.
void QwtPolarPlot::setScaleMaxMinor | ( | int | scaleId, |
int | maxMinor ) |
Set the maximum number of major scale intervals for a specified scale
scaleId | Scale index |
maxMinor | maximum number of minor steps |
Definition at line 401 of file qwt_polar_plot.cpp.
void QwtPolarPlot::setTitle | ( | const QString & | title | ) |
Change the plot's title
title | New title |
Definition at line 118 of file qwt_polar_plot.cpp.
void QwtPolarPlot::setTitle | ( | const QwtText & | title | ) |
Change the plot's title
title | New title |
Definition at line 134 of file qwt_polar_plot.cpp.
QwtText QwtPolarPlot::title | ( | ) | const |
Definition at line 147 of file qwt_polar_plot.cpp.
QwtTextLabel * QwtPolarPlot::titleLabel | ( | ) |
Definition at line 153 of file qwt_polar_plot.cpp.
const QwtTextLabel * QwtPolarPlot::titleLabel | ( | ) | const |
Definition at line 159 of file qwt_polar_plot.cpp.
void QwtPolarPlot::unzoom | ( | ) |
|
protectedvirtual |
Rebuild the layout.
Definition at line 854 of file qwt_polar_plot.cpp.
void QwtPolarPlot::updateLegend | ( | ) |
Emit legendDataChanged() for all plot item
Definition at line 252 of file qwt_polar_plot.cpp.
void QwtPolarPlot::updateLegend | ( | const QwtPolarItem * | plotItem | ) |
Emit legendDataChanged() for a plot item
plotItem | Plot item |
Definition at line 268 of file qwt_polar_plot.cpp.
void QwtPolarPlot::updateScale | ( | int | scaleId | ) |
QwtInterval QwtPolarPlot::visibleInterval | ( | ) | const |
Definition at line 1170 of file qwt_polar_plot.cpp.
void QwtPolarPlot::zoom | ( | const QwtPointPolar & | 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 divided by the zoom factor. Thus a factor < 1.0 zoom in.
Setting an invalid zoom position disables zooming.
zoomPos | Center of the translation |
zoomFactor | Zoom factor |
Definition at line 651 of file qwt_polar_plot.cpp.
double QwtPolarPlot::zoomFactor | ( | ) | const |
QwtPointPolar QwtPolarPlot::zoomPos | ( | ) | const |
Definition at line 682 of file qwt_polar_plot.cpp.