Changeset 2165 in ntrip for trunk/BNC/bncfigureppp.cpp


Ignore:
Timestamp:
Jan 3, 2010, 9:47:44 AM (14 years ago)
Author:
weber
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bncfigureppp.cpp

    r2164 r2165  
    5353  bncSettings settings;
    5454
    55   _xyzRef[0] = 0.0;   
    56   _xyzRef[1] = 0.0;   
    57   _xyzRef[2] = 0.0;   
    58 
    59   QString refCrdStr = settings.value("pppRefCrd").toString();
    60   if (!refCrdStr.isEmpty()) {
    61     QStringList refCrdStrList = refCrdStr.split(' ', QString::SkipEmptyParts);
    62     if (refCrdStrList.size() == 3) {
    63       _xyzRef[0] = refCrdStrList[0].toDouble();   
    64       _xyzRef[1] = refCrdStrList[1].toDouble();   
    65       _xyzRef[2] = refCrdStrList[2].toDouble();   
    66     }
    67   }
     55  _xyzRef[0] = settings.value("pppRefCrdX").toDouble();
     56  _xyzRef[1] = settings.value("pppRefCrdY").toDouble();
     57  _xyzRef[2] = settings.value("pppRefCrdZ").toDouble();
     58
    6859}
    6960
     
    8071void bncFigurePPP::slotNewPosition(bncTime time, double x, double y, double z){
    8172
    82   const static int MAXNUMPOS = 300;
    83 
    8473  QMutexLocker locker(&_mutex);
    8574
     
    10594QPoint bncFigurePPP::pltPoint(double tt, double yy) {
    10695
    107   double tScale  = 0.85 * _width  / _tRange;
     96  double tScale  = 0.90 * _width  / _tRange;
    10897  double yScale  = 0.90 * _height / (2.0 * _neuMax);
    109   double tOffset = _tRange / 10.0;
     98  double tOffset = _tRange / 13.0;
    11099  double yOffset = _neuMax / 10.0;
    111100
     
    121110
    122111  QPainter painter(this);
     112
    123113  _width  = painter.viewport().width();
    124114  _height = painter.viewport().height();
     115
     116  QFont font;
     117  font.setPointSize(int(font.QFont::pointSize()*0.8));
     118  painter.setFont(font);
    125119
    126120  // Plot X-coordinates as a function of time (in seconds)
     
    128122  if (_pos.size() > 1) {
    129123
    130     _tRange = _pos[_pos.size()-1]->time - _pos[0]->time; // in sec
     124//  _tRange = _pos[_pos.size()-1]->time - _pos[0]->time;
     125    _tRange = MAXNUMPOS; // GW
    131126    _tMin   = _pos[0]->time.gpssec();
    132127
     
    177172      QString strP = QString("%1 m").arg( tic,0,'f',2);
    178173      QString strM = QString("%1 m").arg(-tic,0,'f',2);
     174      QString strZ = QString("%1 m").arg(0.0,0,'f',2);
    179175
    180176      QPoint pntP = pltPoint(_tMin, tic);
    181177      QPoint pntM = pltPoint(_tMin,-tic);
     178      QPoint pntZ = pltPoint(_tMin, 0.0);
    182179
    183180      int ww = QFontMetrics(this->font()).width('w');
    184181
    185       painter.drawText(pntP.x() - ww * strP.length(), pntP.y()+ww, strP);
    186       painter.drawText(pntM.x() - ww * strM.length(), pntM.y(),    strM);
     182      painter.drawText(0,pntP.y() - ww * 0.5,pntP.x() - ww * 0.25,pntP.x(),Qt::AlignRight,strP);
     183      painter.drawText(0,pntM.y() - ww * 0.5,pntM.x() - ww * 0.25,pntM.y(),Qt::AlignRight,strM);
     184      painter.drawText(0,pntZ.y() - ww * 0.5,pntZ.x() - ww * 0.25,pntZ.y(),Qt::AlignRight,strZ);
    187185
    188186      painter.drawLine(pntP.x(), pntP.y(), pntP.x()+ww, pntP.y());
    189187      painter.drawLine(pntM.x(), pntM.y(), pntM.x()+ww, pntM.y());
    190 
    191       // time-tic
    192       // --------
    193       painter.drawText(pltPoint(_tMin+_tRange,0.0),
    194                        QString("  %1 s").arg(_tRange));
    195188
    196189      // neu components
     
    199192        double t1 = _tMin + (_pos[ii-1]->time - _pos[0]->time);
    200193        double t2 = _tMin + (_pos[ii]->time   - _pos[0]->time);
     194
     195        // time-tics
     196        // ---------
     197        if (fmod(t1,60.) == 0) {
     198          QPoint pntTic = pltPoint(t1, 0.0);
     199          int daySec = int(fmod(t1,86400.));
     200          int hours = int(daySec / 3600);
     201          int minutes = int((daySec - hours * 3600)/ 60.);
     202          QString strTic = QString("%1:%2").arg(hours, 2, 10, QChar('0'))
     203                                         .arg(minutes, 2, 10, QChar('0'));
     204          painter.setPen(QColor(Qt::black));
     205          double xFirstCharTic = pntTic.x() - ww * 1.2;
     206          if ( xFirstCharTic > pntZ.x()) {
     207            painter.drawText(xFirstCharTic,pntTic.y() + ww * 1.7,strTic);
     208            painter.drawLine(pntTic.x(),pntTic.y(),pntTic.x(),pntTic.y() + ww * 0.5);
     209          }
     210        }
    201211        painter.setPen(QColor(Qt::red));
    202212        painter.drawLine(pltPoint(t1, neu[ii-1][0]), pltPoint(t2, neu[ii][0]));
Note: See TracChangeset for help on using the changeset viewer.