/* Generates the PRN/epoch line and outputs it to strm * @param strm RINEX Nav stream */ void Rinex3NavData::putPRNEpoch(Rinex3NavStream& strm) const throw(StringException) { string line; CivilTime civtime(time); if(strm.header.version >= 3) { // version 3 line = sat.toString(); line += " "; line += rightJustify(asString<short>(civtime.year), 4); line += " "; line += rightJustify(asString<short>(civtime.month), 2, '0'); line += " "; line += rightJustify(asString<short>(civtime.day), 2, '0'); line += " "; line += rightJustify(asString<short>(civtime.hour), 2, '0'); line += " "; line += rightJustify(asString<short>(civtime.minute), 2, '0'); line += " "; line += rightJustify(asString<short>(civtime.second), 2, '0'); } else { // version 2 line = rightJustify(asString<short>(PRNID), 2); line += " "; line += rightJustify(asString<short>(civtime.year), 2, '0'); line += " "; line += rightJustify(asString<short>(civtime.month), 2); line += " "; line += rightJustify(asString<short>(civtime.day), 2); line += " "; line += rightJustify(asString<short>(civtime.hour), 2); line += " "; line += rightJustify(asString<short>(civtime.minute), 2); line += " "; line += rightJustify(asString(civtime.second,1), 4); } if(satSys == "R" || satSys == "S") { line += doubleToScientific(TauN,19,12,2); line += doubleToScientific(GammaN,19,12,2); line += doubleToScientific((double)MFtime,19,12,2); } else if(satSys == "G" || satSys == "E" || satSys == "J" || satSys == "C") { line += doubleToScientific(af0,19,12,2); line += doubleToScientific(af1,19,12,2); line += doubleToScientific(af2,19,12,2); } strm << stripTrailing(line) << endl; strm.lineNumber++; } // End of 'Rinex3NavData::putPRNEpoch(Rinex3NavStream& strm)'
void RinexClockData::reallyPutRecord(FFStream& ffs) const throw(exception, FFStreamError, StringException) { // cast the stream to be an RinexClockStream RinexClockStream& strm = dynamic_cast<RinexClockStream&>(ffs); string line; line = datatype; line += string(1,' '); if(datatype == string("AR")) { line += rightJustify(site,4); } else if(datatype == string("AS")) { line += string(1,sat.systemChar()); line += rightJustify(asString(sat.id),2); if(line[4] == ' ') line[4] = '0'; line += string(1,' '); } else { FFStreamError e("Unknown data type: " + datatype); GPSTK_THROW(e); } line += string(1,' '); line += printTime(time,"%4Y %02m %02d %02H %02M %9.6f"); // must count the data to output int n(2); if(drift != 0.0) n=3; if(sig_drift != 0.0) n=4; if(accel != 0.0) n=5; if(sig_accel != 0.0) n=6; line += rightJustify(asString(n),3); line += string(3,' '); line += doubleToScientific(bias, 19, 12, 2); line += string(1,' '); line += doubleToScientific(sig_bias, 19, 12, 2); strm << line << endl; strm.lineNumber++; // continuation line if(n > 2) { line = doubleToScientific(drift, 19, 12, 2); line += string(1,' '); if(n > 3) { line += doubleToScientific(sig_drift, 19, 12, 2); line += string(1,' '); } if(n > 4) { line += doubleToScientific(accel, 19, 12, 2); line += string(1,' '); } if(n > 5) { line += doubleToScientific(sig_accel, 19, 12, 2); line += string(1,' '); } strm << line << endl; strm.lineNumber++; } } // end reallyPutRecord()
// Construct and write the nth record after the epoch record // @param int n Record number (1-7), for nth record // after the epoch line. // @param Rinex3NavStream strm Stream to read from. void Rinex3NavData::putRecord(const int& nline, Rinex3NavStream& strm) const throw(StringException, FFStreamError) { if(nline < 1 || nline > 7) { FFStreamError fse(string("Invalid line number ") + asString(nline)); GPSTK_THROW(fse); } try { string line; if(strm.header.version < 3) line += string(3, ' '); else line += string(4, ' '); if(nline == 1) { if(satSys == "R" || satSys == "S") { // GLO and GEO line += doubleToScientific(px,19,12,2); line += doubleToScientific(vx,19,12,2); line += doubleToScientific(ax,19,12,2); line += doubleToScientific((double)health,19,12,2); } else if(satSys == "G" || satSys == "C" || satSys == "J") {// GPS,BDS,QZS line += doubleToScientific(IODE,19,12,2); line += doubleToScientific(Crs,19,12,2); line += doubleToScientific(dn,19,12,2); line += doubleToScientific(M0,19,12,2); } else if(satSys == "E") { // GAL line += doubleToScientific(IODnav,19,12,2); line += doubleToScientific(Crs,19,12,2); line += doubleToScientific(dn,19,12,2); line += doubleToScientific(M0,19,12,2); } } else if(nline == 2) { if(satSys == "R" || satSys == "S") { // GLO and GEO line += doubleToScientific(py,19,12,2); line += doubleToScientific(vy,19,12,2); line += doubleToScientific(ay,19,12,2); if(satSys == "R") line += doubleToScientific((double)freqNum,19,12,2); else line += doubleToScientific(accCode,19,12,2); } else { // GPS,GAL,BDS,QZS line += doubleToScientific(Cuc,19,12,2); line += doubleToScientific(ecc,19,12,2); line += doubleToScientific(Cus,19,12,2); line += doubleToScientific(Ahalf,19,12,2); } } else if(nline == 3) { if(satSys == "R" || satSys == "S") { // GLO GEO line += doubleToScientific(pz,19,12,2); line += doubleToScientific(vz,19,12,2); line += doubleToScientific(az,19,12,2); if(satSys == "R") line += doubleToScientific(ageOfInfo,19,12,2); else // GEO line += doubleToScientific(IODN,19,12,2); } else { // GPS,GAL,BDS,QZS line += doubleToScientific(Toe,19,12,2); line += doubleToScientific(Cic,19,12,2); line += doubleToScientific(OMEGA0,19,12,2); line += doubleToScientific(Cis,19,12,2); } } // SBAS and GLO end here else if(nline == 4) { // GPS,GAL,BDS,QZS line += doubleToScientific(i0,19,12,2); line += doubleToScientific(Crc,19,12,2); line += doubleToScientific(w,19,12,2); line += doubleToScientific(OMEGAdot,19,12,2); } else if(nline == 5) { // Internally (Rinex3NavData), weeknum=week of HOW // In RINEX 3 *files*, weeknum is the week of TOE. double wk = double(weeknum); if(HOWtime - Toe > HALFWEEK) wk++; else if(HOWtime - Toe < -(HALFWEEK)) wk--; if(satSys == "G" || satSys == "J") { // GPS QZS line += doubleToScientific(idot,19,12,2); line += doubleToScientific((double)codeflgs,19,12,2); line += doubleToScientific(wk,19,12,2); line += doubleToScientific((double)L2Pdata,19,12,2); } else if(satSys == "E") { // GAL line += doubleToScientific(idot,19,12,2); line += doubleToScientific((double)datasources,19,12,2); line += doubleToScientific(wk,19,12,2); line += doubleToScientific((double) 0,19,12,2); } else if(satSys == "C") { // BDS line += doubleToScientific(idot,19,12,2); line += doubleToScientific((double) 0,19,12,2); line += doubleToScientific(wk,19,12,2); line += doubleToScientific((double) 0,19,12,2); } } else if(nline == 6) { line += doubleToScientific(accuracy,19,12,2); line += doubleToScientific((double)health,19,12,2); if(satSys == "G" || satSys == "J") { // GPS, QZS line += doubleToScientific(Tgd,19,12,2); line += doubleToScientific(IODC,19,12,2); } else if(satSys == "E" || satSys == "C") { // GAL, BDS line += doubleToScientific(Tgd,19,12,2); line += doubleToScientific(Tgd2,19,12,2); } } else if(nline == 7) { line += doubleToScientific(HOWtime,19,12,2); if(satSys == "G" || satSys == "J") { line += doubleToScientific(fitint,19,12,2); } else if(satSys == "E") { ; } else if(satSys == "C") { line += doubleToScientific(IODC,19,12,2); } } strm << stripTrailing(line) << endl; strm.lineNumber++; } catch (std::exception &e) { FFStreamError err("std::exception: " + string(e.what())); GPSTK_THROW(err); } } // End of method 'Rinex3NavData::putRecord(const int& nline,...'