Changeset 6183 in ntrip for trunk


Ignore:
Timestamp:
Sep 14, 2014, 3:24:07 PM (10 years ago)
Author:
mervart
Message:
 
Location:
trunk/BNC/src/rinex
Files:
2 edited

Legend:

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

    r6146 r6183  
    5454  _stream = new QTextStream();
    5555  _stream->setDevice(_file);
     56  _lastOrbCorr = 0;
     57  _lastClkCorr = 0;
    5658}
    5759
     
    7173  }
    7274
    73   QStringList lines;
    74 
    75   if (!_lastLine.isEmpty()) {
    76     lines << _lastLine;
    77   }
     75  _orbCorr.clear();
     76  _clkCorr.clear();
    7877
    7978  while (_stream->status() == QTextStream::Ok && !_stream->atEnd()) {
    80     QString line = _stream->readLine();
     79    QString line = _stream->readLine().trimmed();
    8180    if (line.isEmpty() || line[0] == '!') {
    8281      continue;
    8382    }
    84     _lastLine = line;
     83    if      (line[0] == 'O') {
     84      delete _lastOrbCorr; _lastOrbCorr = new t_orbCorr(line.toAscii().data());
     85    }
     86    else if (line[0] == 'C') {
     87      delete _lastClkCorr; _lastClkCorr = new t_clkCorr(line.toAscii().data());
     88    }
     89    if (stopRead(tt)) {
     90      break;
     91    }
     92  }
    8593
    86     if (stopRead(tt)) {
    87       QList<t_orbCorr> orbCorr;
    88       QList<t_clkCorr> clkCorr;
    89       QListIterator<QString> it(lines);
    90       while (it.hasNext()) {
    91         const QString& str = it.next();
    92         if      (str[0] == 'C') {
    93           t_clkCorr corr(str.toAscii().data());
    94           _lastTime = corr._time;
    95           _corrIODs[QString(corr._prn.toString().c_str())] = corr.IOD();
    96           clkCorr.push_back(corr);
    97         }
    98         else if (str[0] == 'O') {
    99           t_orbCorr corr(str.toAscii().data());
    100           _lastTime = corr._time;
    101           _corrIODs[QString(corr._prn.toString().c_str())] = corr.IOD();
    102           orbCorr.push_back(corr);
    103         }
    104       }         
    105       if (orbCorr.size() > 0) {
    106         emit newOrbCorrections(orbCorr);
    107       }
    108       if (clkCorr.size() > 0) {
    109         emit newClkCorrections(clkCorr);
    110       }
    111       return;
    112     }
    113     else {
    114       lines << _lastLine;
    115     }
     94  if (_orbCorr.size() > 0) {
     95    emit newOrbCorrections(_orbCorr);
     96    _orbCorr.clear();
     97  }
     98  if (_clkCorr.size() > 0) {
     99    emit newClkCorrections(_clkCorr);
     100    _clkCorr.clear();
    116101  }
    117102}
     
    120105////////////////////////////////////////////////////////////////////////////
    121106bool t_corrFile::stopRead(const bncTime& tt) {
    122 
    123   if (_lastTime.undef()) {
    124     return false;
     107  if (_lastOrbCorr) {
     108    if (_lastOrbCorr->_time > tt) {
     109      return true;
     110    }
     111    else {
     112      _orbCorr.push_back(*_lastOrbCorr);
     113      _corrIODs[QString(_lastOrbCorr->_prn.toString().c_str())] = _lastOrbCorr->_iod;
     114      delete _lastOrbCorr; _lastOrbCorr = 0;
     115    }
    125116  }
    126 
    127   if (_lastTime > tt) {
    128     return true;
    129   }   
    130   else {
    131     return false;
     117  if (_lastClkCorr) {
     118    if (_lastClkCorr->_time > tt) {
     119      return true;
     120    }
     121    else {
     122      _clkCorr.push_back(*_lastClkCorr);
     123      _corrIODs[QString(_lastClkCorr->_prn.toString().c_str())] = _lastClkCorr->_iod;
     124      delete _lastClkCorr; _lastClkCorr = 0;
     125    }
    132126  }
     127  return false;
    133128}
  • trunk/BNC/src/rinex/corrfile.h

    r6141 r6183  
    4848  QFile*             _file;
    4949  QTextStream*       _stream;
    50   QString            _lastLine;
     50  QList<t_orbCorr>   _orbCorr;
     51  QList<t_clkCorr>   _clkCorr;
     52  t_orbCorr*         _lastOrbCorr;
     53  t_clkCorr*         _lastClkCorr;
    5154  QMap<QString, int> _corrIODs;
    52   bncTime            _lastTime;
    5355};
    5456
Note: See TracChangeset for help on using the changeset viewer.