Changeset 2201 in ntrip


Ignore:
Timestamp:
Jan 6, 2010, 11:29:17 AM (14 years ago)
Author:
mervart
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bncfigureppp.cpp

    r2197 r2201  
    175175      }
    176176     
     177      unsigned hour, minute;
     178      double   second;
     179      int      ww = QFontMetrics(this->font()).width('w');
     180
     181      // neu components
     182      // --------------
     183      for (int ii = 1; ii < _pos.size(); ++ii) {
     184        double t1 = _tMin + (_pos[ii-1]->time - _pos[0]->time);
     185        double t2 = _tMin + (_pos[ii]->time   - _pos[0]->time);
     186
     187
     188        // dots
     189        // ----
     190        painter.setPen(QColor(Qt::red));
     191        painter.setBrush(QColor(Qt::red));
     192        painter.drawLine(pltPoint(t1, neu[ii-1][0]), pltPoint(t2, neu[ii][0]));
     193        painter.drawEllipse(pltPoint(t1,neu[ii-1][0]), ww/5, ww/5);
     194
     195        painter.setPen(QColor(Qt::green));
     196        painter.setBrush(QColor(Qt::green));
     197        painter.drawLine(pltPoint(t1, neu[ii-1][1]), pltPoint(t2, neu[ii][1]));
     198        painter.drawEllipse(pltPoint(t1,neu[ii-1][1]), ww/5, ww/5);
     199
     200        painter.setPen(QColor(Qt::blue));
     201        painter.setBrush(QColor(Qt::blue));
     202        painter.drawLine(pltPoint(t1, neu[ii-1][2]), pltPoint(t2, neu[ii][2]));
     203        painter.drawEllipse(pltPoint(t1,neu[ii-1][2]), ww/5, ww/5);
     204
     205        // time-tics
     206        // ---------
     207        if ( fmod(_pos[ii-1]->time.daysec(), 60.0) == 0 ) {
     208          _pos[ii-1]->time.civil_time(hour, minute, second);
     209          QPoint pntTic = pltPoint(t1, 0.0);
     210          QString strTic = QString("%1:%2").arg(hour,   2, 10, QChar('0'))
     211                                           .arg(minute, 2, 10, QChar('0'));
     212          double xFirstCharTic = pntTic.x() - ww * 1.2;
     213          if ( xFirstCharTic > pltPoint(_tMin, 0.0).x()) {
     214            painter.setPen(QColor(Qt::black));
     215            painter.drawText(int(xFirstCharTic), int(pntTic.y() + ww * 1.7),
     216                             strTic);
     217            painter.drawLine(pntTic.x(), pntTic.y(),
     218                             pntTic.x(), pntTic.y()+ww/2);
     219          }
     220        }
     221      }
     222
    177223      // time-axis
    178224      // ---------
     225      painter.setPen(QColor(Qt::black));
    179226      painter.drawLine(pltPoint(_tMin, 0.0), pltPoint(_tMin+_tRange, 0.0));
    180227
     
    185232      // neu-tics
    186233      // --------
    187 
    188       double tic = floor(20.0 * (_neuMax - 0.05)) / 20.0;
     234      double  tic  = floor(20.0 * (_neuMax - 0.05)) / 20.0;
    189235      QString strP = QString("%1 m").arg( tic,0,'f',2);
    190236      QString strM = QString("%1 m").arg(-tic,0,'f',2);
     
    194240      QPoint pntM = pltPoint(_tMin,-tic);
    195241      QPoint pntZ = pltPoint(_tMin, 0.0);
    196 
    197       int ww = QFontMetrics(this->font()).width('w');
    198242
    199243      painter.setPen(QColor(Qt::red));
     
    217261      // Start Time
    218262      // ----------
    219       unsigned hour, minute;
    220       double   second;
    221263      _startTime.civil_time(hour, minute, second);
    222264      QString startStr = QString("Start %1:%2:%3")
     
    227269      painter.drawText(0, ww, pntP.x() + 16*ww, pntP.x(),
    228270                       Qt::AlignRight, startStr);
    229 
    230       // neu components
    231       // --------------
    232       for (int ii = 1; ii < _pos.size(); ++ii) {
    233         double t1 = _tMin + (_pos[ii-1]->time - _pos[0]->time);
    234         double t2 = _tMin + (_pos[ii]->time   - _pos[0]->time);
    235  
    236 
    237         // time-tics
    238         // ---------
    239         if ( fmod(_pos[ii-1]->time.daysec(), 60.0) == 0 ) {
    240           _pos[ii-1]->time.civil_time(hour, minute, second);
    241           QPoint pntTic = pltPoint(t1, 0.0);
    242           QString strTic = QString("%1:%2").arg(hour,   2, 10, QChar('0'))
    243                                            .arg(minute, 2, 10, QChar('0'));
    244           painter.setPen(QColor(Qt::black));
    245           double xFirstCharTic = pntTic.x() - ww * 1.2;
    246           if ( xFirstCharTic > pntZ.x()) {
    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);
    251           }
    252         }
    253 
    254         // lines
    255         // -----
    256         painter.setPen(QColor(Qt::gray));
    257         painter.drawLine(pltPoint(t1, neu[ii-1][0]), pltPoint(t2, neu[ii][0]));
    258         painter.drawLine(pltPoint(t1, neu[ii-1][1]), pltPoint(t2, neu[ii][1]));
    259         painter.drawLine(pltPoint(t1, neu[ii-1][2]), pltPoint(t2, neu[ii][2]));
    260 
    261         // dots
    262         // ----
    263         QPointF pntDot;
    264         pntDot = pltPoint(t1,neu[ii-1][0]);
    265         painter.setBrush(QColor(Qt::red));
    266         painter.drawEllipse(pntDot,ww*0.2,ww*0.2);
    267         pntDot = pltPoint(t1,neu[ii-1][1]);
    268         painter.setBrush(QColor(Qt::green));
    269         painter.drawEllipse(pntDot,ww*0.2,ww*0.2);
    270         pntDot = pltPoint(t1,neu[ii-1][2]);
    271         painter.setBrush(QBrush(Qt::blue));
    272         painter.drawEllipse(pntDot,ww*0.2,ww*0.2);
    273       }
    274271    }
    275272  }
Note: See TracChangeset for help on using the changeset viewer.