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