Changeset 4320 in ntrip


Ignore:
Timestamp:
Jun 23, 2012, 4:32:49 PM (12 years ago)
Author:
mervart
Message:
 
Location:
trunk/BNC/src/rinex
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/rinex/polarplot.cpp

    r4319 r4320  
    5353}
    5454
     55// Constructor
     56////////////////////////////////////////////////////////////////////////////
     57t_polarData::t_polarData(size_t size) {
     58  _zenithInterval.setMinValue(0.0);
     59  _zenithInterval.setMaxValue(90.0);
     60  _azimuthInterval.setMinValue(0.0);
     61  _azimuthInterval.setMaxValue(360.0);
     62  _size = size;
     63}
    5564
    56 const QwtInterval zenithInterval(0.0, 90.0);
    57 const QwtInterval azimuthInterval(0.0, 360.0);
     65// Sample (virtual)
     66////////////////////////////////////////////////////////////////////////////
     67t_polarPoint t_polarData::sample(size_t ii) const {
     68  const double stepA = 4 * _azimuthInterval.width() / _size;
     69  const double aa    = _azimuthInterval.minValue() + ii * stepA;
    5870
    59 // Data Class
     71  const double stepR = _zenithInterval.width() / _size;
     72  const double rr    = _zenithInterval.minValue() + ii * stepR;
     73
     74  return t_polarPoint(aa, rr);
     75}
     76
     77// Bounding Box (virtual)
    6078////////////////////////////////////////////////////////////////////////////
    61 class Data: public QwtSeriesData<QwtPointPolar> {
    62  public:
    63   Data(const QwtInterval &zenithInterval,
    64        const QwtInterval &azimuthInterval, size_t size) :
    65   _zenithInterval(zenithInterval), _azimuthInterval(azimuthInterval),
    66   _size(size) {}
    67 
    68   virtual size_t size() const {return _size;}
    69 
    70  protected:
    71   QwtInterval _zenithInterval;
    72   QwtInterval _azimuthInterval;
    73   size_t      _size;
    74 };
    75 
    76 // Spiral Data Class
    77 ////////////////////////////////////////////////////////////////////////////
    78 class SpiralData: public Data {
    79  public:
    80   SpiralData(const QwtInterval &zenithInterval,
    81              const QwtInterval &azimuthInterval, size_t size) :
    82   Data(zenithInterval, azimuthInterval, size) {}
    83 
    84   virtual QwtPointPolar sample(size_t ii) const {
    85     const double stepA = 4 * _azimuthInterval.width() / _size;
    86     const double aa    = _azimuthInterval.minValue() + ii * stepA;
    87 
    88     const double stepR = _zenithInterval.width() / _size;
    89     const double rr    = _zenithInterval.minValue() + ii * stepR;
    90 
    91     return QwtPointPolar(aa, rr);
    92   }
    93 
    94   virtual QRectF boundingRect() const {
    95     if (d_boundingRect.width() < 0.0) {
    96       d_boundingRect = qwtBoundingRect(*this);
    97     }
    98     return d_boundingRect;
    99   }
    100 };
     79QRectF t_polarData::boundingRect() const {
     80  return d_boundingRect;
     81}
    10182
    10283// Constructor
     
    11192  // Scales
    11293  // ------
    113   setScale(QwtPolar::Radius,
    114            zenithInterval.minValue(), zenithInterval.maxValue());
    115 
    116   setScale(QwtPolar::Azimuth,
    117            azimuthInterval.maxValue(), azimuthInterval.minValue(),
    118            azimuthInterval.width() / 12);
     94  setScale(QwtPolar::Radius, 0.0, 90.0);
     95  setScale(QwtPolar::Azimuth, 360.0, 0, 30.0);
    11996
    12097  // Grids, Axes
     
    159136                                 QBrush(Qt::red), QPen(Qt::red),
    160137                                 QSize(3, 3)));
    161   curve->setData(new SpiralData(zenithInterval, azimuthInterval, numPoints));
     138  QwtSeriesData<t_polarPoint>* data = new t_polarData(numPoints);
     139  curve->setData((QwtSeriesData<QwtPointPolar>*) data);
    162140  return curve;
    163141}
  • trunk/BNC/src/rinex/polarplot.h

    r4316 r4320  
    66#include <qwt_polar_curve.h>
    77
     8//
     9//////////////////////////////////////////////////////////////////////////////
    810class t_polarCurve : public QwtPolarCurve {
    911 public:
     
    1719};
    1820
     21//
     22//////////////////////////////////////////////////////////////////////////////
     23class t_polarPoint : public QwtPointPolar {
     24 public:
     25 t_polarPoint(double azimuth, double zenith) : QwtPointPolar(azimuth, zenith) {}
     26  ~t_polarPoint() {}
     27  double zz; // the third coordinate
     28};
     29
     30//
     31//////////////////////////////////////////////////////////////////////////////
     32class t_polarData: public QwtSeriesData<t_polarPoint> {
     33 public:
     34  t_polarData(size_t size);
     35  virtual t_polarPoint sample(size_t ii) const;
     36  virtual size_t size() const {return _size;}
     37  virtual QRectF boundingRect() const;
     38 protected:
     39  QwtInterval _zenithInterval;
     40  QwtInterval _azimuthInterval;
     41  size_t      _size;
     42};
     43
     44//
     45//////////////////////////////////////////////////////////////////////////////
    1946class t_polarPlot: public QwtPolarPlot {
    2047 Q_OBJECT
     
    3158
    3259#endif
    33 
    34 
Note: See TracChangeset for help on using the changeset viewer.