Changeset 3562 in ntrip for trunk/BNC/RTCM/RTCM2Decoder.cpp


Ignore:
Timestamp:
Dec 25, 2011, 3:50:24 PM (12 years ago)
Author:
mervart
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/RTCM/RTCM2Decoder.cpp

    r3257 r3562  
    6565
    6666RTCM2Decoder::~RTCM2Decoder() {
    67   for (t_listMap::iterator ii = _ephList.begin(); ii != _ephList.end(); ii++) {
    68     delete ii->second;
    69   }
    7067}
    7168
     
    222219}
    223220
    224 
    225 
    226 bool RTCM2Decoder::storeEph(const gpsephemeris& gpseph, string& storedPRN, vector<int>& IODs) {
    227   t_ephGPS eph; eph.set(&gpseph);
    228 
    229   return storeEph(eph, storedPRN, IODs);
    230 }
    231 
    232 
    233 bool RTCM2Decoder::storeEph(const t_ephGPS& gpseph, string& storedPRN, vector<int>& IODs) {
    234   t_ephGPS* eph = new t_ephGPS(gpseph);
    235 
    236   string prn = eph->prn().toAscii().data();
    237 
    238   t_listMap::iterator ip = _ephList.find(prn);
    239   if (ip == _ephList.end() ) {
    240     ip = _ephList.insert(pair<string, t_ephList*>(prn, new t_ephList)).first;
    241   }
    242   t_ephList* ephList = ip->second;
    243 
    244   bool stored = ephList->store(eph);
    245 
    246   if ( stored ) {
    247     storedPRN = string(eph->prn().toAscii().data());
    248     ephList->getIODs(IODs);
    249     return true;
    250   }
    251 
    252   delete eph;
    253 
    254   return false;
    255 }
    256  
    257  
    258221void RTCM2Decoder::translateCorr2Obs(vector<string>& errmsg) {
    259222
     
    298261    // end test
    299262
    300 
    301     ostringstream oPRN; oPRN.fill('0');
    302 
    303     oPRN <<            (corr->PRN < 200 ? 'G'       : 'R')
    304          << setw(2) << (corr->PRN < 200 ? corr->PRN : corr->PRN - 200);
    305 
    306     string PRN(oPRN.str());
    307 
    308     t_listMap::const_iterator ieph = _ephList.find(PRN);
     263    QString prn;
     264    if (corr->PRN < 200) {
     265      prn = 'G' + QString("%1").arg(corr->PRN, 2, 10, QChar('0'));
     266    }
     267    else {
     268      prn = 'R' + QString("%1").arg(corr->PRN - 200, 2, 10, QChar('0'));
     269    }
     270
     271    const t_ephPair* ePair = ephPair(prn);
    309272
    310273    double L1 = 0;
     
    356319
    357320      // Select corresponding ephemerides
    358       if ( ieph != _ephList.end() ) {
    359         eph = ieph->second->getEph(IODcorr);
     321      if (ePair) {
     322        if      (ePair->last && ePair->last->IOD() == IODcorr) {
     323          eph = ePair->last;
     324        }
     325        else if (ePair->prev && ePair->prev->IOD() == IODcorr) {
     326          eph = ePair->prev;
     327        }
    360328      }
    361329
     
    431399      copy(missingIOD.begin(), missingIOD.end(), ostream_iterator<string>(missingIODstr, "   "));
    432400
    433       errmsg.push_back("missing eph for " + PRN + " , IODs " + missingIODstr.str());
     401      errmsg.push_back("missing eph for " + string(prn.toAscii().data()) + " , IODs " + missingIODstr.str());
    434402    }
    435403
Note: See TracChangeset for help on using the changeset viewer.