Changeset 4334 in ntrip


Ignore:
Timestamp:
Jun 24, 2012, 10:34:29 AM (12 years ago)
Author:
mervart
Message:
 
Location:
trunk/BNC/src/rinex
Files:
3 edited

Legend:

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

    r4333 r4334  
    3434  for (int ii = from; ii <= to; ii++) {
    3535    QwtSymbol ss(symbol);
    36     const QwtPointPolar& point    = sample(ii);
     36    const QwtPointPolar& point = sample(ii);
    3737    const QColor color = colorMap.color(QwtInterval(0.0, 1.0), point._value);
    3838    ss.setBrush(QBrush(color));
     
    4040    QwtPolarCurve::drawSymbols(painter, ss, azimuthMap, radialMap, pole, ii,ii);
    4141  }
    42 }
    43 
    44 // Sample (virtual) - this is for testing only
    45 ////////////////////////////////////////////////////////////////////////////
    46 QwtPointPolar t_polarData::sample(size_t ii) const {
    47   const QwtInterval zenithInterval(0.0, 90.0);
    48   const QwtInterval azimuthInterval(0.0, 360.0 );
    49 
    50   const double stepA = 4 * azimuthInterval.width() / _size;
    51   const double aa    = azimuthInterval.minValue() + ii * stepA;
    52 
    53   const double stepR = zenithInterval.width() / _size;
    54   const double rr    = zenithInterval.minValue() + ii * stepR;
    55 
    56   double value = static_cast<double>(ii) / _size;
    57 
    58   QwtPointPolar point(aa,rr);
    59   point._value = value;
    60 
    61   return point;
    62 }
    63 
    64 //
    65 ////////////////////////////////////////////////////////////////////////////
    66 t_polarCurve* t_polarPlot::createCurve() const {
    67   const int numPoints = 1000;
    68   t_polarCurve* curve = new t_polarCurve();
    69   curve->setStyle(QwtPolarCurve::NoCurve);  // draw only symbols
    70   curve->setSymbol(new QwtSymbol(QwtSymbol::Ellipse,
    71                                  QBrush(Qt::red), QPen(Qt::red),
    72                                  QSize(3, 3)));
    73   t_polarData* data = new t_polarData(numPoints);
    74   curve->setData(data);
    75   return curve;
    7642}
    7743
     
    11076
    11177  grid->attach(this);
     78}
    11279
    113   // Curves
    114   // ------
    115   t_polarCurve* curve = createCurve();
     80//
     81////////////////////////////////////////////////////////////////////////////
     82void t_polarPlot::addCurve(QVector<t_polarPoint*>* data) {
     83  t_polarCurve* curve = new t_polarCurve();
     84  curve->setStyle(QwtPolarCurve::NoCurve);  // draw only symbols
     85  curve->setSymbol(new QwtSymbol(QwtSymbol::Ellipse,
     86                                 QBrush(Qt::red), QPen(Qt::red),
     87                                 QSize(3, 3)));
     88  t_polarData* polarData = new t_polarData(data);
     89  curve->setData(polarData);
    11690  curve->attach(this);
    11791}
    118 
  • trunk/BNC/src/rinex/polarplot.h

    r4331 r4334  
    2020//
    2121//////////////////////////////////////////////////////////////////////////////
     22class 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//////////////////////////////////////////////////////////////////////////////
    2236class t_polarData: public QwtSeriesData<QwtPointPolar> {
    2337 public:
    24   t_polarData(size_t size) {
    25     _size = size;
     38  t_polarData(QVector<t_polarPoint*>* data) {
     39    _data = data;
     40    _size = data->size();
    2641  }
    27   virtual QwtPointPolar sample(size_t ii) const;
     42  ~t_polarData() {
     43    for (int ii = 0; ii < _data->size(); ii++) {
     44      delete _data->at(ii);
     45    }
     46  }
     47  virtual QwtPointPolar sample(size_t ii) const {
     48    const t_polarPoint* point = _data->at(ii);
     49    QwtPointPolar qp(point->_az, point->_zen); qp._value = point->_value;
     50    return qp;
     51  }
    2852  virtual size_t size() const {return _size;}
    29   virtual QRectF boundingRect() const {
    30     return d_boundingRect;
    31   }
     53  virtual QRectF boundingRect() const {return d_boundingRect;}
    3254 protected:
    3355  size_t _size;
     56 private:
     57  QVector<t_polarPoint*>* _data;
    3458};
    3559
     
    4165 public:
    4266  t_polarPlot(QWidget* = 0);
     67  void addCurve(QVector<t_polarPoint*>* data);
    4368
    4469 private:
    45   t_polarCurve* createCurve() const;
    4670};
    4771
  • trunk/BNC/src/rinex/reqcanalyze.cpp

    r4310 r4334  
    8585void t_reqcAnalyze::slotDisplayGraph() {
    8686  if (((bncApp*) qApp)->mode() == bncApp::interactive) {
     87
     88    QVector<t_polarPoint*>* data1 = new QVector<t_polarPoint*>;
     89
     90    //// beg test
     91    {   
     92      const QwtInterval zenithInterval(0.0, 90.0);
     93      const QwtInterval azimuthInterval(0.0, 360.0 );
     94      const int    numPoints = 1000;
     95      const double stepA     = 4 * azimuthInterval.width() / numPoints;
     96      const double stepR     = zenithInterval.width() / numPoints;
     97      for (int ii = 0; ii < numPoints; ii++) {
     98        double aa = azimuthInterval.minValue() + ii * stepA;
     99        double rr = zenithInterval.minValue() + ii * stepR;
     100        double vv = static_cast<double>(ii) / numPoints;
     101        (*data1) << (new t_polarPoint(aa, rr, vv));
     102      }
     103    }
     104    //// end test
     105
     106    t_polarPlot* plotMP1 = new t_polarPlot(0);
     107    plotMP1->addCurve(data1);
     108
     109    QVector<t_polarPoint*>* data2 = new QVector<t_polarPoint*>;
     110
     111    //// beg test
     112    {   
     113      const QwtInterval zenithInterval(0.0, 90.0);
     114      const QwtInterval azimuthInterval(0.0, 360.0 );
     115      const int    numPoints = 1000;
     116      const double stepA     = 4 * azimuthInterval.width() / numPoints;
     117      const double stepR     = zenithInterval.width() / numPoints;
     118      for (int ii = 0; ii < numPoints; ii++) {
     119        double aa = azimuthInterval.minValue() + ii * stepA;
     120        double rr = zenithInterval.minValue() + ii * stepR;
     121        double vv = static_cast<double>(ii) / numPoints;
     122        (*data2) << (new t_polarPoint(aa, rr, vv));
     123      }
     124    }
     125    //// end test
     126
     127    t_polarPlot* plotMP2 = new t_polarPlot(0);
     128    plotMP2->addCurve(data2);
     129   
    87130    QVector<QWidget*> plots;
    88     t_polarPlot* plotMP1 = new t_polarPlot(0); plots << plotMP1;
    89     t_polarPlot* plotMP2 = new t_polarPlot(0); plots << plotMP2;
    90    
     131    plots << plotMP1;
     132    plots << plotMP2;
     133
    91134    t_graphWin* graphWin = new t_graphWin(0, plots);
     135
    92136    graphWin->show();
    93137  }
Note: See TracChangeset for help on using the changeset viewer.