Ignore:
Timestamp:
Mar 30, 2011, 8:39:39 PM (13 years ago)
Author:
mervart
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/upload/bncuploadcaster.cpp

    r3208 r3209  
    182182    _t0  = settings.value("trafo_t0").toDouble();
    183183  }
    184  
    185   // Deep copy of ephemerides
    186   // ------------------------
    187   _ephMap = 0;
     184
     185  // Member that receives the ephemeris
     186  // ----------------------------------
     187  _ephUser = new bncEphUser();
    188188}
    189189
     
    204204    wait();
    205205  }
    206   if (_ephMap) {
    207     QMapIterator<QString, t_eph*> it(*_ephMap);
    208     while (it.hasNext()) {
    209       it.next();
    210       t_eph* eph = it.value();
    211       delete eph;
    212     }
    213     delete _ephMap;
    214   }
    215206  delete _outFile;
    216207  delete _rnx;
    217208  delete _sp3;
     209  delete _ephUser;
    218210}
    219211
     
    306298//
    307299////////////////////////////////////////////////////////////////////////////
    308 void bncUploadCaster::decodeRtnetStream(char* buffer, int bufLen,
    309                       const QMap<QString, bncEphUser::t_ephPair*>& ephPairMap) {
     300void bncUploadCaster::decodeRtnetStream(char* buffer, int bufLen) {
    310301                                       
    311302  QMutexLocker locker(&_mutex);
    312 
    313   // Delete old ephemeris
    314   // --------------------
    315   if (_ephMap) {
    316     QMapIterator<QString, t_eph*> it(*_ephMap);
    317     while (it.hasNext()) {
    318       it.next();
    319       t_eph* eph = it.value();
    320       delete eph;
    321     }
    322     delete _ephMap;
    323   }
    324   _ephMap = new QMap<QString, t_eph*>;
    325 
    326   // Make a deep copy of ephemeris
    327   // -----------------------------
    328   QMapIterator<QString, bncEphUser::t_ephPair*> it(ephPairMap);
    329   while (it.hasNext()) {
    330     it.next();
    331     bncEphUser::t_ephPair* pair = it.value();
    332     t_eph* ep = pair->last;
    333     if (pair->prev && ep &&
    334         ep->receptDateTime().secsTo(QDateTime::currentDateTime()) < 60) {
    335       ep = pair->prev;
    336     }
    337     QString prn(ep->prn().c_str());
    338     if      (prn[0] == 'G') {
    339       t_ephGPS* epGPS = static_cast<t_ephGPS*>(ep);
    340       (*_ephMap)[prn] = new t_ephGPS(*epGPS);
    341     }
    342     else if (prn[0] == 'R') {
    343       t_ephGlo* epGlo = static_cast<t_ephGlo*>(ep);
    344       (*_ephMap)[prn] = new t_ephGlo(*epGlo);
    345     }
    346     else if (prn[0] == 'E') {
    347       t_ephGal* epGal = static_cast<t_ephGal*>(ep);
    348       (*_ephMap)[prn] = new t_ephGal(*epGal);
    349     }
    350   }
    351303
    352304  // Append to buffer
     
    418370    }
    419371
    420     if ( _ephMap->contains(prn) ) {
    421       t_eph* ep = (*_ephMap)[prn];
     372    const bncEphUser::t_ephPair* ephPair = _ephUser->ephPair(prn);
     373    if (ephPair) {
     374      t_eph* eph = ephPair->last;
     375      if (ephPair->prev &&
     376           eph->receptDateTime().secsTo(QDateTime::currentDateTime()) < 60) {
     377        eph = ephPair->prev;
     378      }
    422379
    423380      in >> xx(1) >> xx(2) >> xx(3) >> xx(4) >> xx(5)
     
    448405      if (sd) {
    449406        QString outLine;
    450         processSatellite(ep, _epoTime.gpsw(), _epoTime.gpssec(), prn, xx, sd, outLine);
     407        processSatellite(eph, _epoTime.gpsw(), _epoTime.gpssec(), prn,
     408                         xx, sd, outLine);
    451409        if (_outFile) {
    452410          _outFile->write(_epoTime.gpsw(), _epoTime.gpssec(), outLine);
Note: See TracChangeset for help on using the changeset viewer.