Changeset 11200 in ntrip for trunk/BNC/src/rinex/rnxnavfile.cpp
- Timestamp:
- Nov 11, 2026, 11:17:08 AM (less than one hour ago)
- File:
-
- 1 edited
-
trunk/BNC/src/rinex/rnxnavfile.cpp (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/rinex/rnxnavfile.cpp
r11192 r11200 52 52 //////////////////////////////////////////////////////////////////////////// 53 53 t_rnxNavFile::t_rnxNavHeader::t_rnxNavHeader() { 54 _mergedFiles = 0; 54 55 _version = 0.0; 55 56 _glonass = false; … … 86 87 else if (key == "PGM / RUN BY / DATE") { 87 88 _runByDate.append(value.trimmed()); 89 } 90 else if (key == "MERGED FILE") { 91 // number of merged files, set for the written file 92 _mergedFiles = qMax(1, value.toInt()); 93 } 94 else if (!key.isEmpty()) { 95 // e.g. LEAP SECONDS, IONOSPHERIC CORR, TIME SYSTEM CORR, ION ALPHA, 96 // ION BETA, DELTA-UTC: A0,A1,T,W, DOI, LICENSE OF USE: kept verbatim 97 _otherRecords.append(line.left(60).leftJustified(60) + key); 88 98 } 89 99 } … … 153 163 QString prn; 154 164 bool ephPending = false; // RINEX 4: "> EPH" line read, data lines follow 165 bool recordPending = false; // RINEX 4: other record, data lines follow 155 166 156 167 while (stream->status() == QTextStream::Ok && !stream->atEnd()) { … … 177 188 navType = ""; 178 189 } 179 // RINEX version 4: data lines of an EPH record follow its "> EPH" line ;180 // anything else (e.g. the remainder of arecordthat could not be read)181 // is skipped 190 // RINEX version 4: data lines of an EPH record follow its "> EPH" line, 191 // those of other records (STO, EOP, ION, unknown types) are kept 192 // verbatim up to the next ">" line; anything else is skipped 182 193 else if (version() >= 4.0 && firstStr != ">") { 194 if (recordPending) { 195 t_rnxNavRecord& record = _records.last(); 196 if (record.lines.size() == 1) { // first data line: epoch 197 QTextStream in(line.mid(4, 19).toLatin1(), QIODevice::ReadOnly); 198 int year = 0, month = 0, day = 0, hour = 0, min = 0; 199 double sec = 0.0; 200 in >> year >> month >> day >> hour >> min >> sec; 201 if (year > 0) { 202 record.tt.set(year, month, day, hour, min, sec); 203 } 204 } 205 record.lines << line; 206 continue; 207 } 183 208 if (!ephPending || line.left(1) != prn.left(1)) { 184 209 ephPending = false; … … 189 214 } 190 215 else if (version() >= 4.0 && firstStr == ">") { 191 ephPending = false; 216 ephPending = false; 217 recordPending = false; 192 218 if (hlp.size() < 4) { 193 219 continue; … … 197 223 sys = prn[0].toLatin1(); 198 224 navType = hlp.at(3); 199 ephPending = (key == "EPH"); 200 201 // ALL Non-EPH messages are currently ignored 202 int lines2skip = 0; 203 // STO 204 if (key == "STO") { 205 lines2skip = 2; 206 } 207 // EOP 208 else if (key == "EOP") { 209 lines2skip = 3; 210 } 211 // ION 212 else if (key == "ION") { 213 if (sys == 'R') { 214 lines2skip = 1; //if (navType == "LXOC") {} 215 } 216 else if (sys == 'E') { 217 lines2skip = 2; 218 } 219 else if (sys == 'G' || sys == 'C' || 220 sys == 'J' || sys == 'I') { 221 lines2skip = 3; 222 if ((sys == 'I' && navType == "L1NV") || // I: KLOB, NEQN 223 (sys == 'J' && navType == "CNVX")) { // J: WIDE, JAPN 224 QString navSubType = hlp.value(4); // RINEX >= 4.02 only 225 if (navSubType == "KLOB") { 226 lines2skip += 1; 227 } 228 else if (navSubType == "NEQN") { 229 lines2skip += 4; 230 } 231 } 232 } 233 } 234 if (lines2skip) { 235 for (int ii = 0; ii < lines2skip; ii++) { 236 stream->readLine(); 237 } 225 if (key == "EPH") { 226 ephPending = true; 227 } 228 else { 229 t_rnxNavRecord record; 230 record.key = key; 231 record.lines << line; 232 _records.append(record); 233 recordPending = true; 238 234 } 239 235 continue; … … 379 375 // 380 376 //////////////////////////////////////////////////////////////////////////// 381 void t_rnxNavFile::writeHeader(const QMap<QString, QString>* txtMap, int numMergedFiles, int leapSecs) { 377 void t_rnxNavFile::writeHeader(const QMap<QString, QString>* txtMap, int numMergedFiles, int leapSecs, 378 const QStringList* headerRecords) { 379 380 // LEAP SECONDS of the input header (may hold future leap seconds) preferred 381 // --------------------------------------------------------------------------- 382 bool haveLeapSecs = false; 383 if (headerRecords) { 384 for (int ii = 0; ii < headerRecords->size(); ii++) { 385 if (headerRecords->at(ii).mid(60).trimmed() == "LEAP SECONDS") { 386 haveLeapSecs = true; 387 } 388 } 389 } 390 382 391 383 392 QString runBy = BNC_CORE->userName(); … … 459 468 << "PGM / RUN BY / DATE\n"; 460 469 } 461 *_stream << QString("%1").arg(leapSecs, 6, 10, QLatin1Char(' ')).left(60).leftJustified(60) 462 << "LEAP SECONDS\n"; 463 464 *_stream << QString("%1").arg(numMergedFiles, 19, 10, QLatin1Char(' ')).leftJustified(60) 465 << "MERGED FILE\n"; 470 if (!haveLeapSecs) { 471 *_stream << QString("%1").arg(leapSecs, 6, 10, QLatin1Char(' ')).left(60).leftJustified(60) 472 << "LEAP SECONDS\n"; 473 } 474 475 if (numMergedFiles > 1) { 476 *_stream << QString("%1").arg(numMergedFiles, 9).leftJustified(60) 477 << "MERGED FILE\n"; 478 } 466 479 } 467 480 … … 471 484 } 472 485 486 if (headerRecords) { 487 for (int ii = 0; ii < headerRecords->size(); ii++) { 488 *_stream << headerRecords->at(ii) << "\n"; 489 } 490 } 491 473 492 *_stream << QString() 474 493 .leftJustified(60) … … 476 495 } 477 496 497 // Write RINEX 4 STO, EOP or ION record (verbatim) 498 //////////////////////////////////////////////////////////////////////////// 499 void t_rnxNavFile::writeRecord(const t_rnxNavRecord& record) { 500 if (version() < 4.0) { 501 return; 502 } 503 for (int ii = 0; ii < record.lines.size(); ii++) { 504 QString line = record.lines[ii]; 505 int len = line.length(); 506 while (len > 0 && line[len-1] == ' ') { 507 len--; 508 } 509 line.truncate(len); 510 *_stream << line << "\n"; 511 } 512 } 513 478 514 // 479 515 ////////////////////////////////////////////////////////////////////////////
Note:
See TracChangeset
for help on using the changeset viewer.
