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