Changeset 6137 in ntrip for trunk/BNC/src/bncrinex.cpp
- Timestamp:
- Sep 13, 2014, 12:19:37 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/bncrinex.cpp
r6120 r6137 439 439 // Stores Observation into Internal Array 440 440 //////////////////////////////////////////////////////////////////////////// 441 void bncRinex::deepCopy(t_ obs obs) {441 void bncRinex::deepCopy(t_satObs obs) { 442 442 _obs.push_back(obs); 443 443 } … … 449 449 // Select observations older than maxTime 450 450 // -------------------------------------- 451 QList<t_ obs> dumpList;452 QMutableListIterator<t_ obs> mIt(_obs);451 QList<t_satObs> dumpList; 452 QMutableListIterator<t_satObs> mIt(_obs); 453 453 while (mIt.hasNext()) { 454 t_ obs obs = mIt.next();455 if (obs. GPSWeek * 7*24*3600 + obs.GPSWeeks< maxTime - 0.05) {454 t_satObs obs = mIt.next(); 455 if (obs._time.gpsw() * 7*24*3600 + obs._time.gpssec() < maxTime - 0.05) { 456 456 dumpList.push_back(obs); 457 457 mIt.remove(); … … 467 467 // Time of Epoch 468 468 // ------------- 469 const t_ obs& fObs = dumpList.first();470 QDateTime datTim = dateAndTimeFromGPSweek(fObs. GPSWeek, fObs.GPSWeeks);471 QDateTime datTimNom = dateAndTimeFromGPSweek(fObs. GPSWeek,472 floor(fObs. GPSWeeks+0.5));469 const t_satObs& fObs = dumpList.first(); 470 QDateTime datTim = dateAndTimeFromGPSweek(fObs._time.gpsw(), fObs._time.gpssec()); 471 QDateTime datTimNom = dateAndTimeFromGPSweek(fObs._time.gpsw(), 472 floor(fObs._time.gpssec()+0.5)); 473 473 474 474 // Close the file … … 482 482 // ------------------ 483 483 if (!_headerWritten) { 484 _header._startTime.set(fObs. GPSWeek, fObs.GPSWeeks);484 _header._startTime.set(fObs._time.gpsw(), fObs._time.gpssec()); 485 485 writeHeader(format, datTimNom); 486 486 } … … 488 488 // Check whether observation types available 489 489 // ----------------------------------------- 490 QMutableListIterator<t_ obs> mItDump(dumpList);490 QMutableListIterator<t_satObs> mItDump(dumpList); 491 491 while (mItDump.hasNext()) { 492 t_ obs& obs = mItDump.next();493 if (!_header._obsTypes.contains(obs. satSys) && !_header._obsTypes.contains(obs.satSys)) {492 t_satObs& obs = mItDump.next(); 493 if (!_header._obsTypes.contains(obs._prn.system()) && !_header._obsTypes.contains(obs._prn.system())) { 494 494 mItDump.remove(); 495 495 } … … 499 499 } 500 500 501 double sec = double(datTim.time().second()) + fmod(fObs. GPSWeeks,1.0);501 double sec = double(datTim.time().second()) + fmod(fObs._time.gpssec(),1.0); 502 502 503 503 // Epoch header line: RINEX Version 3 … … 515 515 << " " << 0 << setw(3) << dumpList.size(); 516 516 517 QListIterator<t_ obs> it(dumpList); int iSat = 0;517 QListIterator<t_satObs> it(dumpList); int iSat = 0; 518 518 while (it.hasNext()) { 519 519 iSat++; 520 const t_ obs& obs = it.next();521 _out << obs. satSys << setw(2) << obs.satNum;520 const t_satObs& obs = it.next(); 521 _out << obs._prn; 522 522 if (iSat == 12 && it.hasNext()) { 523 523 _out << endl << " "; … … 528 528 } 529 529 530 QListIterator<t_ obs> it(dumpList);530 QListIterator<t_satObs> it(dumpList); 531 531 while (it.hasNext()) { 532 const t_ obs& obs = it.next();532 const t_satObs& obs = it.next(); 533 533 534 534 // Cycle slips detection 535 535 // --------------------- 536 QString prn = QString("%1%2").arg(obs.satSys) 537 .arg(obs.satNum, 2, 10, QChar('0')); 538 539 char lli1 = ' '; 540 char lli2 = ' '; 541 char lli5 = ' '; 542 if ( obs.slip_cnt_L1 >= 0 ) { 543 if ( _slip_cnt_L1.find(prn) != _slip_cnt_L1.end() && 544 _slip_cnt_L1.find(prn).value() != obs.slip_cnt_L1 ) { 545 lli1 = '1'; 546 } 547 } 548 549 if ( obs.slip_cnt_L2 >= 0 ) { 550 if ( _slip_cnt_L2.find(prn) != _slip_cnt_L2.end() && 551 _slip_cnt_L2.find(prn).value() != obs.slip_cnt_L2 ) { 552 lli2 = '1'; 553 } 554 } 555 556 if ( obs.slip_cnt_L5 >= 0 ) { 557 if ( _slip_cnt_L5.find(prn) != _slip_cnt_L5.end() && 558 _slip_cnt_L5.find(prn).value() != obs.slip_cnt_L5 ) { 559 lli5 = '1'; 560 } 561 } 562 563 _slip_cnt_L1[prn] = obs.slip_cnt_L1; 564 _slip_cnt_L2[prn] = obs.slip_cnt_L2; 565 _slip_cnt_L5[prn] = obs.slip_cnt_L5; 536 QString prn(obs._prn.toString().c_str()); 537 char lli1 = ' '; 538 char lli2 = ' '; 539 char lli5 = ' '; 540 char* lli = 0; 541 542 for (unsigned iFrq = 0; iFrq < obs._obs.size(); iFrq++) { 543 const t_frqObs* frqObs = obs._obs[iFrq]; 544 QMap<QString, int>* slip_cnt = 0; 545 if (frqObs->_rnxType2ch[0] == '1') { 546 slip_cnt = &_slip_cnt_L1; 547 lli = &lli1; 548 } 549 else if (frqObs->_rnxType2ch[0] == '2') { 550 slip_cnt = &_slip_cnt_L2; 551 lli = &lli2; 552 } 553 else if (frqObs->_rnxType2ch[0] == '5') { 554 slip_cnt = &_slip_cnt_L5; 555 lli = &lli5; 556 } 557 else { 558 continue; 559 } 560 if (frqObs->_slip) { 561 if ( slip_cnt->find(prn) != slip_cnt->end() && 562 slip_cnt->find(prn).value() != frqObs->_slipCounter ) { 563 *lli = '1'; 564 } 565 } 566 (*slip_cnt)[prn] = frqObs->_slipCounter; 567 } 566 568 567 569 // Write the data … … 594 596 // One Line in RINEX v2 or v3 595 597 //////////////////////////////////////////////////////////////////////////// 596 string bncRinex::rinexSatLine(const t_obs& obs, char lli1, char lli2, 597 char lli5) { 598 string bncRinex::rinexSatLine(const t_satObs& obs, char lli1, char lli2, char lli5) { 598 599 ostringstream str; 599 str.setf(ios::showpoint | ios::fixed); 600 601 if (_header._version >= 3.0) { 602 str << obs.satSys 603 << setw(2) << setfill('0') << obs.satNum << setfill(' '); 604 } 605 606 const QVector<QString>& types = _header._obsTypes[obs.satSys]; 607 for (int ii = 0; ii < types.size(); ii++) { 608 if (_header._version < 3.0 && ii > 0 && ii % 5 == 0) { 609 str << endl; 610 } 611 double value = obs.measdata(types[ii], _header._version); 612 str << setw(14) << setprecision(3) << value; 613 if (value != 0.0 && types[ii].indexOf("L1") == 0) { 614 str << lli1 << ' '; 615 } 616 else if (value != 0.0 && types[ii].indexOf("L2") == 0) { 617 str << lli2 << ' '; 618 } 619 else if (value != 0.0 && types[ii].indexOf("L5") == 0) { 620 str << lli5 << ' '; 621 } 622 else { 623 str << " "; 624 } 625 } 600 //// str.setf(ios::showpoint | ios::fixed); 601 //// 602 //// if (_header._version >= 3.0) { 603 //// str << obs._prn; 604 //// } 605 //// 606 //// const QVector<QString>& types = _header._obsTypes[obs._prn.system()]; 607 //// for (int ii = 0; ii < types.size(); ii++) { 608 //// if (_header._version < 3.0 && ii > 0 && ii % 5 == 0) { 609 //// str << endl; 610 //// } 611 //// for (unsigned iFrq = 0; iFrq < obs._obs.size(); iFrq++) { 612 //// const t_frqObs* frqObs = obs._obs[iFrq]; 613 //// 614 //// 615 //// double value = obs.measdata(types[ii], _header._version); 616 //// str << setw(14) << setprecision(3) << value; 617 //// if (value != 0.0 && types[ii].indexOf("L1") == 0) { 618 //// str << lli1 << ' '; 619 //// } 620 //// else if (value != 0.0 && types[ii].indexOf("L2") == 0) { 621 //// str << lli2 << ' '; 622 //// } 623 //// else if (value != 0.0 && types[ii].indexOf("L5") == 0) { 624 //// str << lli5 << ' '; 625 //// } 626 //// else { 627 //// str << " "; 628 //// } 629 //// } 626 630 627 631 return str.str(); … … 644 648 // One Line in ASCII (Internal) Format 645 649 //////////////////////////////////////////////////////////////////////////// 646 string bncRinex::asciiSatLine(const t_ obs& obs) {650 string bncRinex::asciiSatLine(const t_satObs& obs) { 647 651 648 652 ostringstream str; 649 str.setf(ios::showpoint | ios::fixed); 650 651 str << obs.satSys << setw(2) << setfill('0') << obs.satNum << setfill(' '); 652 653 if (obs.satSys == 'R') { // Glonass 654 str << ' ' << setw(2) << obs.slotNum << ' '; 655 } 656 else { 657 str << " "; 658 } 659 660 float rnxVers = 3.0; 661 662 for (int ie = 0; ie < GNSSENTRY_NUMBER; ie++) { 663 QString rnxStr = obs.rnxStr(ie); 664 if (rnxStr.length() >= 2) { 665 double data = obs.measdata(rnxStr, rnxVers); 666 if (data != 0.0) { 667 int width = (rnxStr[0] == 'S') ? 8 : 14; 668 int prec = 3; 669 str << ' ' << rnxStr.toAscii().data() 670 << ' ' << obsToStr(data, width, prec); 671 if (rnxStr[0] == 'L') { 672 int slipCnt = 0; 673 if (rnxStr[1] == '1') { 674 slipCnt = obs.slip_cnt_L1; 675 } 676 else if (rnxStr[1] == '2') { 677 slipCnt = obs.slip_cnt_L2; 678 } 679 else if (rnxStr[1] == '5') { 680 slipCnt = obs.slip_cnt_L5; 681 } 682 str << ' ' << setw(3) << slipCnt; 683 } 684 } 685 } 686 } 653 //// str.setf(ios::showpoint | ios::fixed); 654 //// 655 //// str << obs._prn << ' '; 656 //// 657 //// float rnxVers = 3.0; 658 //// 659 //// for (int ie = 0; ie < GNSSENTRY_NUMBER; ie++) { 660 //// QString rnxStr = obs.rnxStr(ie); 661 //// if (rnxStr.length() >= 2) { 662 //// double data = obs.measdata(rnxStr, rnxVers); 663 //// if (data != 0.0) { 664 //// int width = (rnxStr[0] == 'S') ? 8 : 14; 665 //// int prec = 3; 666 //// str << ' ' << rnxStr.toAscii().data() 667 //// << ' ' << obsToStr(data, width, prec); 668 //// if (rnxStr[0] == 'L') { 669 //// int slipCnt = 0; 670 //// if (rnxStr[1] == '1') { 671 //// slipCnt = obs.slip_cnt_L1; 672 //// } 673 //// else if (rnxStr[1] == '2') { 674 //// slipCnt = obs.slip_cnt_L2; 675 //// } 676 //// else if (rnxStr[1] == '5') { 677 //// slipCnt = obs.slip_cnt_L5; 678 //// } 679 //// str << ' ' << setw(3) << slipCnt; 680 //// } 681 //// } 682 //// } 683 //// } 687 684 688 685 return str.str();
Note:
See TracChangeset
for help on using the changeset viewer.