qwt_polar_plot.h
Go to the documentation of this file.
1 /******************************************************************************
2  * QwtPolar Widget Library
3  * Copyright (C) 2008 Uwe Rathmann
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the Qwt License, Version 1.0
7  *****************************************************************************/
8 
9 #ifndef QWT_POLAR_PLOT_H
10 #define QWT_POLAR_PLOT_H
11 
12 #include "qwt_global.h"
13 #include "qwt_polar.h"
14 #include "qwt_polar_itemdict.h"
15 #include "qwt_interval.h"
16 #include "qwt_scale_map.h"
17 #include "qwt_point_polar.h"
18 #include <qframe.h>
19 
20 class QwtRoundScaleDraw;
21 class QwtScaleEngine;
22 class QwtScaleDiv;
23 class QwtTextLabel;
24 class QwtPolarCanvas;
25 class QwtPolarLayout;
26 class QwtAbstractLegend;
27 
46 class QWT_EXPORT QwtPolarPlot : public QFrame, public QwtPolarItemDict
47 {
48  Q_OBJECT
49 
50  Q_PROPERTY( QBrush plotBackground READ plotBackground WRITE setPlotBackground )
51  Q_PROPERTY( double azimuthOrigin READ azimuthOrigin WRITE setAzimuthOrigin )
52 
53 
54  public:
60  {
63 
66 
69 
72 
81  ExternalLegend
82  };
83 
84  explicit QwtPolarPlot( QWidget* parent = NULL );
85  QwtPolarPlot( const QwtText& title, QWidget* parent = NULL );
86 
87  virtual ~QwtPolarPlot();
88 
89  void setTitle( const QString& );
90  void setTitle( const QwtText& );
91 
92  QwtText title() const;
93 
94  QwtTextLabel* titleLabel();
95  const QwtTextLabel* titleLabel() const;
96 
97  void setAutoReplot( bool tf = true );
98  bool autoReplot() const;
99 
100  void setAutoScale( int scaleId );
101  bool hasAutoScale( int scaleId ) const;
102 
103  void setScaleMaxMinor( int scaleId, int maxMinor );
104  int scaleMaxMinor( int scaleId ) const;
105 
106  int scaleMaxMajor( int scaleId ) const;
107  void setScaleMaxMajor( int scaleId, int maxMajor );
108 
109  QwtScaleEngine* scaleEngine( int scaleId );
110  const QwtScaleEngine* scaleEngine( int scaleId ) const;
111  void setScaleEngine( int scaleId, QwtScaleEngine* );
112 
113  void setScale( int scaleId, double min, double max, double step = 0 );
114 
115  void setScaleDiv( int scaleId, const QwtScaleDiv& );
116  const QwtScaleDiv* scaleDiv( int scaleId ) const;
117  QwtScaleDiv* scaleDiv( int scaleId );
118 
119  QwtScaleMap scaleMap( int scaleId, double radius ) const;
120  QwtScaleMap scaleMap( int scaleId ) const;
121 
122  void updateScale( int scaleId );
123 
124  double azimuthOrigin() const;
125 
126  void zoom( const QwtPointPolar&, double factor );
127  void unzoom();
128 
129  QwtPointPolar zoomPos() const;
130  double zoomFactor() const;
131 
132  // Canvas
133 
134  QwtPolarCanvas* canvas();
135  const QwtPolarCanvas* canvas() const;
136 
137  void setPlotBackground ( const QBrush& c );
138  const QBrush& plotBackground() const;
139 
140  virtual void drawCanvas( QPainter*, const QRectF& ) const;
141 
142  // Legend
143 
144  void insertLegend( QwtAbstractLegend*,
145  LegendPosition = RightLegend, double ratio = -1.0 );
146 
147  QwtAbstractLegend* legend();
148  const QwtAbstractLegend* legend() const;
149 
150  void updateLegend();
151  void updateLegend( const QwtPolarItem* );
152 
153  // Layout
154  QwtPolarLayout* plotLayout();
155  const QwtPolarLayout* plotLayout() const;
156 
157  QwtInterval visibleInterval() const;
158  QRectF plotRect() const;
159  QRectF plotRect( const QRectF& ) const;
160 
161  int plotMarginHint() const;
162 
163  virtual QVariant itemToInfo( QwtPolarItem* ) const;
164  virtual QwtPolarItem* infoToItem( const QVariant& ) const;
165 
166  Q_SIGNALS:
173  void itemAttached( QwtPolarItem* plotItem, bool on );
174 
184  void legendDataChanged( const QVariant& itemInfo,
185  const QList< QwtLegendData >& data );
186 
191  void layoutChanged();
192 
193  public Q_SLOTS:
194  virtual void replot();
195  void autoRefresh();
196  void setAzimuthOrigin( double );
197 
198  protected:
199  virtual bool event( QEvent* ) QWT_OVERRIDE;
200  virtual void resizeEvent( QResizeEvent* ) QWT_OVERRIDE;
201 
202  virtual void updateLayout();
203 
204  virtual void drawItems( QPainter* painter,
205  const QwtScaleMap& radialMap, const QwtScaleMap& azimuthMap,
206  const QPointF& pole, double radius,
207  const QRectF& canvasRect ) const;
208 
209  private:
210  friend class QwtPolarItem;
211  void attachItem( QwtPolarItem*, bool );
212 
213  void initPlot( const QwtText& );
214 
215  class PrivateData;
217 };
218 
219 #endif
QwtRoundScaleDraw
A class for drawing round scales.
Definition: qwt_round_scale_draw.h:31
QwtPolarPlot
A plotting widget, displaying a polar coordinate system.
Definition: qwt_polar_plot.h:46
QwtPolarPlot::PrivateData
Definition: qwt_polar_plot.cpp:65
QwtPolarCanvas
Canvas of a QwtPolarPlot.
Definition: qwt_polar_canvas.h:27
qwt_polar.h
QwtAbstractLegend
Abstract base class for legend widgets.
Definition: qwt_abstract_legend.h:34
qwt_global.h
qwt_interval.h
QList
Definition: qwt_abstract_legend.h:17
QwtPolarPlot::BottomLegend
@ BottomLegend
The legend will be below the canvas.
Definition: qwt_polar_plot.h:68
QwtPointPolar
A point in polar coordinates.
Definition: qwt_point_polar.h:28
QwtPolarPlot::TopLegend
@ TopLegend
The legend will be between canvas and title.
Definition: qwt_polar_plot.h:71
QwtPolarItemDict
A dictionary for polar plot items.
Definition: qwt_polar_itemdict.h:28
QwtInterval
A class representing an interval.
Definition: qwt_interval.h:22
QwtPolarPlot::LeftLegend
@ LeftLegend
The legend will be left from the canvas.
Definition: qwt_polar_plot.h:62
QwtPolarLayout
Layout class for QwtPolarPlot.
Definition: qwt_polar_layout.h:23
qwt_scale_map.h
QwtText
A class representing a text.
Definition: qwt_text.h:51
QwtTextLabel
A Widget which displays a QwtText.
Definition: qwt_text_label.h:26
QwtPolarItem
Base class for items on a polar plot.
Definition: qwt_polar_item.h:37
QwtPolarPlot::m_data
PrivateData * m_data
Definition: qwt_polar_plot.h:215
qwt_point_polar.h
QwtScaleMap
A scale map.
Definition: qwt_scale_map.h:26
QwtScaleEngine
Base class for scale engines.
Definition: qwt_scale_engine.h:45
QwtPolarPlot::RightLegend
@ RightLegend
The legend will be right from the canvas.
Definition: qwt_polar_plot.h:65
QWT_OVERRIDE
#define QWT_OVERRIDE
Definition: qwt_global.h:53
QWT_EXPORT
#define QWT_EXPORT
Definition: qwt_global.h:38
mqtt_test.data
dictionary data
Definition: mqtt_test.py:22
QwtScaleDiv
A class representing a scale division.
Definition: qwt_scale_div.h:33
QwtPolarPlot::LegendPosition
LegendPosition
Definition: qwt_polar_plot.h:59
qwt_polar_itemdict.h


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Aug 11 2024 02:24:24