Changeset 2177 in ntrip


Ignore:
Timestamp:
Jan 4, 2010, 12:50:27 PM (14 years ago)
Author:
mervart
Message:

* empty log message *

Location:
trunk/BNC
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bncfigureppp.cpp

    r2169 r2177  
    5050////////////////////////////////////////////////////////////////////////////
    5151bncFigurePPP::bncFigurePPP(QWidget *parent) : QWidget(parent) {
     52  reset();
     53}
     54
     55
     56// Destructor
     57////////////////////////////////////////////////////////////////////////////
     58bncFigurePPP::~bncFigurePPP() {
     59  for (int ii = 0; ii < _pos.size(); ++ii) {
     60    delete _pos[ii];
     61  }
     62}
     63
     64//
     65////////////////////////////////////////////////////////////////////////////
     66void bncFigurePPP::reset() {
     67  QMutexLocker locker(&_mutex);
    5268
    5369  bncSettings settings;
     
    5773  _xyzRef[2] = settings.value("pppRefCrdZ").toDouble();
    5874
    59 }
    60 
    61 // Destructor
    62 ////////////////////////////////////////////////////////////////////////////
    63 bncFigurePPP::~bncFigurePPP() {
    6475  for (int ii = 0; ii < _pos.size(); ++ii) {
    6576    delete _pos[ii];
    6677  }
     78  _pos.clear();
     79
     80  update();
    6781}
    6882
     
    8296  _pos.push_back(newPos);
    8397
     98  if (_pos.size() == 1) {
     99    _startTime = time;
     100  }
     101
    84102  if (_pos.size() > MAXNUMPOS) {
    85103    delete _pos[0];
     
    114132  _height = painter.viewport().height();
    115133
    116   QFont font;
    117   font.setPointSize(int(font.QFont::pointSize()*0.8));
     134  QFont font = this->font();
     135  font.setPointSize(int(this->font().pointSize()*0.9));
    118136  painter.setFont(font);
    119137
     
    121139  // -----------------------------------------------------
    122140  if (_pos.size() > 1) {
    123 //  _tRange = _pos[_pos.size()-1]->time - _pos[0]->time;
    124141    _tRange = MAXNUMPOS;
    125142    _tMin   = _pos[0]->time.gpssec();
     
    168185      // neu-tics
    169186      // --------
     187
    170188      double tic = floor(20.0 * (_neuMax - 0.05)) / 20.0;
    171189      QString strP = QString("%1 m").arg( tic,0,'f',2);
     
    180198
    181199      painter.setPen(QColor(Qt::red));
    182       painter.drawText(0,int( ww * 1.0),int(pntP.x() + ww * 3.00),
    183                                         int(pntP.x()),Qt::AlignRight,"N");
    184       painter.setPen(QColor(0,210,0,127));
    185       painter.drawText(0,int( ww * 1.0),int(pntP.x() + ww * 4.00),
    186                                         int(pntP.x()),Qt::AlignRight,"E");
     200      painter.drawText(0, ww, pntP.x() + 3*ww, pntP.x(), Qt::AlignRight, "N");
     201      painter.setPen(QColor(Qt::green));
     202      painter.drawText(0, ww, pntP.x() + 4*ww, pntP.x(), Qt::AlignRight, "E");
    187203      painter.setPen(QColor(Qt::blue));
    188       painter.drawText(0,int( ww * 1.0),int(pntP.x() + ww * 5.00),
    189                                         int(pntP.x()),Qt::AlignRight,"U");
     204      painter.drawText(0, ww, pntP.x() + 5*ww, pntP.x(), Qt::AlignRight, "U");
     205
    190206      painter.setPen(QColor(Qt::black));
    191 
    192       painter.drawText(0,int(pntP.y() - ww * 0.5),int(pntP.x() - ww * 0.25),
    193                                                   int(pntP.x()),Qt::AlignRight,strP);
    194       painter.drawText(0,int(pntM.y() - ww * 0.5),int(pntM.x() - ww * 0.25),
    195                                                   int(pntM.y()),Qt::AlignRight,strM);
    196       painter.drawText(0,int(pntZ.y() - ww * 0.5),int(pntZ.x() - ww * 0.25),
    197                                                   int(pntZ.y()),Qt::AlignRight,strZ);
     207      painter.drawText(0, pntP.y()-ww/2, pntP.x()- ww/4, pntP.x(),
     208                       Qt::AlignRight, strP);
     209      painter.drawText(0, pntM.y()-ww/2, pntM.x()- ww/4, pntM.x(),
     210                       Qt::AlignRight, strM);
     211      painter.drawText(0, pntZ.y()-ww/2, pntZ.x()- ww/4, pntZ.x(),
     212                       Qt::AlignRight, strZ);
    198213
    199214      painter.drawLine(pntP.x(), pntP.y(), pntP.x()+ww, pntP.y());
    200215      painter.drawLine(pntM.x(), pntM.y(), pntM.x()+ww, pntM.y());
     216
     217      // Start Time
     218      // ----------
     219      unsigned hour, minute;
     220      double   second;
     221      _startTime.civil_time(hour, minute, second);
     222      QString startStr = QString("Start %1:%2:%3")
     223                              .arg(hour,   2, 10, QChar('0'))
     224                              .arg(minute, 2, 10, QChar('0'))
     225                              .arg(int(second), 2, 10, QChar('0'));
     226      painter.setPen(QColor(Qt::black));
     227      painter.drawText(0, ww, pntP.x() + 14*ww, pntP.x(),
     228                       Qt::AlignRight, startStr);
    201229
    202230      // neu components
     
    206234        double t2 = _tMin + (_pos[ii]->time   - _pos[0]->time);
    207235 
    208         // start time
    209         // ----------
    210         if (ii == 1) {
    211           _daySec = int(fmod(t1,86400.));
    212           _hours = int(_daySec / 3600);
    213           _minutes = int((_daySec - _hours * 3600)/ 60.);
    214           _seconds = int(fmod(t1,60.));
    215           _strTic = QString("Start %1:%2:%3").arg(_hours,   2, 10, QChar('0'))
    216                                                      .arg(_minutes, 2, 10, QChar('0'))
    217                                                      .arg(_seconds, 2, 10, QChar('0'));
    218           painter.setPen(QColor(Qt::black));
    219           painter.drawText(0,int( ww * 1.0),int(pntP.x() + ww * 13.50),
    220                                             int(pntP.x()),Qt::AlignRight,_strTic);
    221         }
    222236
    223237        // time-tics
    224238        // ---------
    225         if (fmod(t1,60.) == 0) {
     239        if ( fmod(_pos[ii-1]->time.daysec(), 60.0) == 0 ) {
     240          _pos[ii-1]->time.civil_time(hour, minute, second);
    226241          QPoint pntTic = pltPoint(t1, 0.0);
    227           _daySec = int(fmod(t1,86400.));
    228           _hours = int(_daySec / 3600);
    229           _minutes = int((_daySec - _hours * 3600)/ 60.);
    230           _strTic = QString("%1:%2").arg(_hours,   2, 10, QChar('0'))
    231                                     .arg(_minutes, 2, 10, QChar('0'));
     242          QString strTic = QString("%1:%2").arg(hour,   2, 10, QChar('0'))
     243                                           .arg(minute, 2, 10, QChar('0'));
    232244          painter.setPen(QColor(Qt::black));
    233245          double xFirstCharTic = pntTic.x() - ww * 1.2;
    234246          if ( xFirstCharTic > pntZ.x()) {
    235             painter.drawText(int(xFirstCharTic),int(pntTic.y() + ww * 1.7),_strTic);
    236             painter.drawLine(int(pntTic.x()),int(pntTic.y()),
    237                              int(pntTic.x()),int(pntTic.y() + ww * 0.5));
     247            painter.drawText(int(xFirstCharTic), int(pntTic.y() + ww * 1.7),
     248                             strTic);
     249            painter.drawLine(pntTic.x(), pntTic.y(),
     250                             pntTic.x(), pntTic.y()+ww/2);
    238251          }
    239252        }
  • trunk/BNC/bncfigureppp.h

    r2169 r2177  
    3434  bncFigurePPP(QWidget *parent);
    3535  ~bncFigurePPP();
     36  void reset();
    3637
    3738 public slots:
     
    4243
    4344 private:
     45  const static int MAXNUMPOS = 300;
     46
    4447  class pppPos {
    4548   public:
     
    5255  QMutex           _mutex;
    5356  QVector<pppPos*> _pos;
     57  bncTime          _startTime;
    5458  double           _neuMax;
    5559  double           _tRange;
     
    5862  int              _height;
    5963  double           _xyzRef[3];
    60   int              _daySec;
    61   int              _hours;
    62   int              _minutes;
    63   int              _seconds;
    64   QString          _strTic;
    65   const static int MAXNUMPOS = 300;
    6664};
    6765
  • trunk/BNC/bnctime.h

    r2123 r2177  
    1616  unsigned int gpsw()   const;
    1717  double       gpssec() const;
     18  void         civil_time (unsigned int& hour, unsigned int& min,
     19                           double& sec) const;
    1820
    1921  bool   operator!=(const bncTime &time1) const;
     
    2729  bncTime&     setmjd(double daysec, int mjd);
    2830  void        reset() {_mjd = 0; _sec = 0;}
    29   void        civil_time (unsigned int& hour, unsigned int& min,   double& sec) const;
    3031  static void jdgp(double tjul, double & second, long & nweek);
    3132
  • trunk/BNC/bncwindow.cpp

    r2176 r2177  
    10641064  slotSaveOptions();
    10651065
     1066  _bncFigurePPP->reset();
     1067
    10661068  _actDeleteMountPoints->setEnabled(false);
    10671069  _actGetData->setEnabled(false);
Note: See TracChangeset for help on using the changeset viewer.