Changeset 2163 in ntrip


Ignore:
Timestamp:
Jan 1, 2010, 6:18:02 PM (14 years ago)
Author:
mervart
Message:

* empty log message *

Location:
trunk/BNC
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bncfigureppp.cpp

    r2162 r2163  
    3131 * Purpose:   
    3232 *
    33  * Author:     Perlt, Mervart
     33 * Author:     Mervart
    3434 *
    3535 * Created:    11-Nov-2009
     
    5050////////////////////////////////////////////////////////////////////////////
    5151bncFigurePPP::bncFigurePPP(QWidget *parent) : QWidget(parent) {
     52
     53  QString refCrdStr = "";
     54
     55  QStringList refCrdStrList = refCrdStr.split(' ', QString::SkipEmptyParts);
     56  if (refCrdStrList.size() == 3) {
     57    _xyzRef[0] = refCrdStrList[0].toDouble();   
     58    _xyzRef[1] = refCrdStrList[1].toDouble();   
     59    _xyzRef[2] = refCrdStrList[2].toDouble();   
     60  }
     61  else {
     62    _xyzRef[0] = 0.0;   
     63    _xyzRef[1] = 0.0;   
     64    _xyzRef[2] = 0.0;   
     65  }
    5266}
    5367
     
    89103QPoint bncFigurePPP::pltPoint(double tt, double yy) {
    90104
    91   const static double scale0  = 0.9;
    92   double tScale  = scale0 * _width  / _tRange;
    93   double yScale  = scale0 * _height / (2.0 * _neuMax);
     105  double tScale  = 0.85 * _width  / _tRange;
     106  double yScale  = 0.90 * _height / (2.0 * _neuMax);
    94107  double tOffset = _tRange / 10.0;
    95108  double yOffset = _neuMax / 10.0;
     
    118131    // Reference Coordinates
    119132    // ---------------------
    120     double xyzRef[3];
    121     xyzRef[0] = _pos[0]->xyz[0];
    122     xyzRef[1] = _pos[0]->xyz[1];
    123     xyzRef[2] = _pos[0]->xyz[2];
     133    if (_xyzRef[0] == 0.0 && _xyzRef[1] == 0.0  && _xyzRef[2] == 0.0) {
     134      _xyzRef[0] = _pos[0]->xyz[0];
     135      _xyzRef[1] = _pos[0]->xyz[1];
     136      _xyzRef[2] = _pos[0]->xyz[2];
     137    }
    124138    double ellRef[3];
    125     xyz2ell(xyzRef, ellRef);
     139    xyz2ell(_xyzRef, ellRef);
    126140
    127141    // North, East and Up differences wrt Reference Coordinates
     
    132146      double dXYZ[3];
    133147      for (int ic = 0; ic < 3; ++ic) {
    134         dXYZ[ic] = _pos[ii]->xyz[ic] - xyzRef[ic];
     148        dXYZ[ic] = _pos[ii]->xyz[ic] - _xyzRef[ic];
    135149      }
    136150      xyz2neu(ellRef, dXYZ, neu[ii]);
     
    147161        _neuMax = 0.15;
    148162      }
    149 
    150       // x-axis
    151       // ------
     163     
     164      // time-axis
     165      // ---------
    152166      painter.drawLine(pltPoint(_tMin, 0.0), pltPoint(_tMin+_tRange, 0.0));
    153167
    154       // y-axis
    155       // ------
     168      // neu-axis
     169      // --------
    156170      painter.drawLine(pltPoint(_tMin, -_neuMax), pltPoint(_tMin, _neuMax));
    157171
    158       if      (_neuMax <  0.2) {
    159         painter.drawText(pltPoint(_tMin,  0.1), " 0.1 m");
    160         painter.drawText(pltPoint(_tMin, -0.1), "-0.1 m");
    161       }
    162       else if (_neuMax <  0.5) {
    163         painter.drawText(pltPoint(_tMin,  0.2), " 0.2 m");
    164         painter.drawText(pltPoint(_tMin, -0.2), "-0.2 m");
    165       }
    166       else if (_neuMax <  1.0) {
    167         painter.drawText(pltPoint(_tMin,  0.5), " 0.5 m");
    168         painter.drawText(pltPoint(_tMin, -0.5), "-0.5 m");
    169       }
    170       else if (_neuMax <  2.0) {
    171         painter.drawText(pltPoint(_tMin,  1.0), " 1.0 m");
    172         painter.drawText(pltPoint(_tMin, -1.0), "-1.0 m");
    173       }
    174       else if (_neuMax < 10.0) {
    175         painter.drawText(pltPoint(_tMin,  5.0), " 5.0 m");
    176         painter.drawText(pltPoint(_tMin, -5.0), "-5.0 m");
    177       }
    178       else {
    179         painter.drawText(pltPoint(_tMin, 10.0), " 10.0 m");
    180         painter.drawText(pltPoint(_tMin,-10.0), "-10.0 m");
    181       }
    182 
     172      // neu-tics
     173      // --------
     174      double tic = floor(20.0 * (_neuMax - 0.05)) / 20.0;
     175      QString strP = QString("%1 m").arg( tic,0,'f',2);
     176      QString strM = QString("%1 m").arg(-tic,0,'f',2);
     177
     178      QPoint pntP = pltPoint(_tMin, tic);
     179      QPoint pntM = pltPoint(_tMin,-tic);
     180
     181      int ww = QFontMetrics(this->font()).width('w');
     182
     183      painter.drawText(pntP.x() - ww * strP.length(), pntP.y()+ww, strP);
     184      painter.drawText(pntM.x() - ww * strM.length(), pntM.y(),    strM);
     185
     186      painter.drawLine(pntP.x(), pntP.y(), pntP.x()+ww, pntP.y());
     187      painter.drawLine(pntM.x(), pntM.y(), pntM.x()+ww, pntM.y());
     188
     189      // time-tic
     190      // --------
     191      painter.drawText(pltPoint(_tMin+_tRange,0.0),
     192                       QString("  %1 s").arg(_tRange));
     193
     194      // neu components
     195      // --------------
    183196      for (int ii = 1; ii < _pos.size(); ++ii) {
    184197        double t1 = _tMin + (_pos[ii-1]->time - _pos[0]->time);
  • trunk/BNC/bncfigureppp.h

    r2158 r2163  
    5757  int              _width;
    5858  int              _height;
     59  double           _xyzRef[3];
    5960};
    6061
Note: See TracChangeset for help on using the changeset viewer.