Changeset 4311 in ntrip


Ignore:
Timestamp:
Jun 23, 2012, 2:26:04 PM (12 years ago)
Author:
mervart
Message:
 
File:
1 edited

Legend:

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

    r4309 r4311  
    2727#include "polarplot.h"
    2828
    29 const QwtInterval radialInterval( 0.0, 10.0 );
    30 const QwtInterval azimuthInterval( 0.0, 360.0 );
     29const QwtInterval zenithInterval(0.0, 90.0);
     30const QwtInterval azimuthInterval(0.0, 360.0);
    3131
    32 //
     32// Data Class
    3333////////////////////////////////////////////////////////////////////////////
    3434class Data: public QwtSeriesData<QwtPointPolar> {
    3535 public:
    36   Data( const QwtInterval &radialInterval,
    37         const QwtInterval &azimuthInterval, size_t size ):
    38       _radialInterval( radialInterval ),
    39       _azimuthInterval( azimuthInterval ),
    40       _size( size ) {}
     36  Data(const QwtInterval &zenithInterval,
     37       const QwtInterval &azimuthInterval, size_t size) :
     38  _zenithInterval(zenithInterval), _azimuthInterval(azimuthInterval),
     39  _size(size) {}
    4140
    4241  virtual size_t size() const {return _size;}
    4342
    4443 protected:
    45   QwtInterval _radialInterval;
     44  QwtInterval _zenithInterval;
    4645  QwtInterval _azimuthInterval;
    4746  size_t      _size;
    4847};
    4948
    50 //
     49// Spiral Data Class
    5150////////////////////////////////////////////////////////////////////////////
    5251class SpiralData: public Data {
    5352 public:
    54   SpiralData( const QwtInterval &radialInterval,
    55           const QwtInterval &azimuthInterval, size_t size ):
    56     Data( radialInterval, azimuthInterval, size ) {}
     53  SpiralData(const QwtInterval &zenithInterval,
     54             const QwtInterval &azimuthInterval, size_t size) :
     55  Data(zenithInterval, azimuthInterval, size) {}
    5756
    58   virtual QwtPointPolar sample(size_t i) const {
     57  virtual QwtPointPolar sample(size_t ii) const {
    5958    const double stepA = 4 * _azimuthInterval.width() / _size;
    60     const double a = _azimuthInterval.minValue() + i * stepA;
     59    const double aa    = _azimuthInterval.minValue() + ii * stepA;
    6160
    62     const double stepR = _radialInterval.width() / _size;
    63     const double r = _radialInterval.minValue() + i * stepR;
     61    const double stepR = _zenithInterval.width() / _size;
     62    const double rr    = _zenithInterval.minValue() + ii * stepR;
    6463
    65     return QwtPointPolar( a, r );
     64    return QwtPointPolar(aa, rr);
    6665  }
    6766
    6867  virtual QRectF boundingRect() const {
    69     if ( d_boundingRect.width() < 0.0 ) {
    70        d_boundingRect = qwtBoundingRect( *this );
     68    if (d_boundingRect.width() < 0.0) {
     69      d_boundingRect = qwtBoundingRect(*this);
    7170    }
    7271    return d_boundingRect;
     
    7776////////////////////////////////////////////////////////////////////////////
    7877t_polarPlot::t_polarPlot( QWidget *parent ) :
    79 QwtPolarPlot(QwtText("Polar Plot"), parent ) {
     78QwtPolarPlot(QwtText("Polar Plot"), parent) {
    8079
    81   ///  setAutoReplot(false);
    8280  setPlotBackground(Qt::darkBlue);
    8381
    8482  // Scales
    8583  // ------
     84  setScale(QwtPolar::Radius,
     85           zenithInterval.minValue(), zenithInterval.maxValue());
     86
    8687  setScale(QwtPolar::Azimuth,
    8788           azimuthInterval.minValue(), azimuthInterval.maxValue(),
    8889           azimuthInterval.width() / 12);
    8990
    90   setScaleMaxMinor( QwtPolar::Azimuth, 2 );
    91   setScale( QwtPolar::Radius,
    92       radialInterval.minValue(), radialInterval.maxValue() );
     91  setScaleMaxMinor(QwtPolar::Azimuth, 2);
    9392
    9493  // Grids, Axes
    9594  // -----------
    9695  _grid = new QwtPolarGrid();
    97   _grid->setPen( QPen( Qt::white ) );
     96  _grid->setPen(QPen(Qt::white));
    9897  for ( int scaleId = 0; scaleId < QwtPolar::ScaleCount; scaleId++ ) {
    9998    _grid->showGrid( scaleId );
    10099    _grid->showMinorGrid( scaleId );
    101 
    102100    QPen minorPen( Qt::gray );
    103     _grid->setMinorGridPen( scaleId, minorPen );
     101    _grid->setMinorGridPen(scaleId, minorPen);
    104102  }
    105103
    106   _grid->setAxisPen( QwtPolar::AxisAzimuth, QPen( Qt::black ) );
     104  _grid->setAxisPen(QwtPolar::AxisAzimuth, QPen(Qt::black));
    107105
    108   _grid->showAxis( QwtPolar::AxisAzimuth, true );
    109   _grid->showAxis( QwtPolar::AxisLeft, false );
    110   _grid->showAxis( QwtPolar::AxisRight, true );
    111   _grid->showAxis( QwtPolar::AxisTop, true );
    112   _grid->showAxis( QwtPolar::AxisBottom, false );
    113   _grid->showGrid( QwtPolar::Azimuth, true );
    114   _grid->showGrid( QwtPolar::Radius, true );
     106  _grid->showAxis(QwtPolar::AxisAzimuth, true );
     107  _grid->showAxis(QwtPolar::AxisLeft,    false);
     108  _grid->showAxis(QwtPolar::AxisRight,   true);
     109  _grid->showAxis(QwtPolar::AxisTop,     true);
     110  _grid->showAxis(QwtPolar::AxisBottom,  false);
     111
     112  _grid->showGrid(QwtPolar::Azimuth, true);
     113  _grid->showGrid(QwtPolar::Radius,  true);
     114
    115115  _grid->attach( this );
    116116
     
    124124  // ------
    125125  QwtLegend *legend = new QwtLegend;
    126   insertLegend( legend,  QwtPolarPlot::BottomLegend );
     126  insertLegend(legend,  QwtPolarPlot::BottomLegend);
    127127}
    128128
     
    136136QwtPolarCurve* t_polarPlot::createCurve() const {
    137137  const int numPoints = 200;
    138 
    139138  QwtPolarCurve* curve = new QwtPolarCurve();
    140   curve->setStyle( QwtPolarCurve::Lines );
    141   curve->setTitle( "Spiral" );
    142   curve->setPen( QPen( Qt::yellow, 2 ) );
     139  curve->setStyle(QwtPolarCurve::Lines);
     140  curve->setTitle("Example Curve");
     141  curve->setPen(QPen( Qt::yellow, 2));
    143142  curve->setSymbol(new QwtSymbol(QwtSymbol::Rect,
    144                                  QBrush(Qt::cyan), QPen(Qt::white), QSize(3, 3)));
    145   curve->setData(
    146       new SpiralData( radialInterval, azimuthInterval, numPoints ) );
     143                                 QBrush(Qt::cyan), QPen(Qt::white),
     144                                 QSize(3, 3)));
     145  curve->setData(new SpiralData(zenithInterval, azimuthInterval, numPoints));
    147146  return curve;
    148147}
Note: See TracChangeset for help on using the changeset viewer.