1 |
|
---|
2 | #ifndef POLARPLOT_H
|
---|
3 | #define POLARPLOT_H
|
---|
4 |
|
---|
5 | #include <qwt_polar_plot.h>
|
---|
6 | #include <qwt_polar_curve.h>
|
---|
7 | //
|
---|
8 | //////////////////////////////////////////////////////////////////////////////
|
---|
9 | class t_polarCurve : public QwtPolarCurve {
|
---|
10 | public:
|
---|
11 | t_polarCurve() {}
|
---|
12 | virtual ~t_polarCurve() {}
|
---|
13 | protected:
|
---|
14 | virtual void drawSymbols (QPainter* painter, const QwtSymbol& symbol,
|
---|
15 | const QwtScaleMap& azimuthMap,
|
---|
16 | const QwtScaleMap& radialMap,
|
---|
17 | const QPointF& pole, int from, int to) const;
|
---|
18 | };
|
---|
19 |
|
---|
20 | //
|
---|
21 | //////////////////////////////////////////////////////////////////////////////
|
---|
22 | class t_polarPoint {
|
---|
23 | public:
|
---|
24 | t_polarPoint(double az, double zen, double value) {
|
---|
25 | _az = az;
|
---|
26 | _zen = zen;
|
---|
27 | _value = value;
|
---|
28 | }
|
---|
29 | double _az;
|
---|
30 | double _zen;
|
---|
31 | double _value;
|
---|
32 | };
|
---|
33 |
|
---|
34 | //
|
---|
35 | //////////////////////////////////////////////////////////////////////////////
|
---|
36 | class t_polarData: public QwtSeriesData<QwtPointPolar> {
|
---|
37 | public:
|
---|
38 | t_polarData(QVector<t_polarPoint*>* data) {
|
---|
39 | _data = data;
|
---|
40 | _size = data->size();
|
---|
41 | }
|
---|
42 | ~t_polarData() {
|
---|
43 | for (int ii = 0; ii < _data->size(); ii++) {
|
---|
44 | delete _data->at(ii);
|
---|
45 | }
|
---|
46 | delete _data;
|
---|
47 | }
|
---|
48 | virtual QwtPointPolar sample(size_t ii) const {
|
---|
49 | const t_polarPoint* point = _data->at(ii);
|
---|
50 | QwtPointPolar qp(point->_az, point->_zen); qp._value = point->_value;
|
---|
51 | return qp;
|
---|
52 | }
|
---|
53 | virtual size_t size() const {return _size;}
|
---|
54 | virtual QRectF boundingRect() const {return d_boundingRect;}
|
---|
55 | protected:
|
---|
56 | size_t _size;
|
---|
57 | private:
|
---|
58 | QVector<t_polarPoint*>* _data;
|
---|
59 | };
|
---|
60 |
|
---|
61 | //
|
---|
62 | //////////////////////////////////////////////////////////////////////////////
|
---|
63 | class t_polarPlot: public QwtPolarPlot {
|
---|
64 | Q_OBJECT
|
---|
65 |
|
---|
66 | public:
|
---|
67 | t_polarPlot(QWidget* = 0);
|
---|
68 | void addCurve(QVector<t_polarPoint*>* data);
|
---|
69 |
|
---|
70 | private:
|
---|
71 | };
|
---|
72 |
|
---|
73 | #endif
|
---|