Changeset 11192 in ntrip for trunk/BNC/src/rinex/reqcedit.cpp


Ignore:
Timestamp:
Nov 10, 2026, 12:13:23 PM (less than one hour ago)
Author:
stuerze
Message:

rinex version 4.02 now fully supported

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/rinex/reqcedit.cpp

    r11158 r11192  
    357357        addRnxConversionDetails(obsFile, txtMap);
    358358      }
    359       outObsFile.header().write(outObsFile.stream(), &txtMap);
     359      // header with TIME OF FIRST/LAST OBS etc. of the written epochs
     360      outObsFile.writeHeaderOnClose(txtMap);
    360361    }
    361362    t_rnxObsFile::t_rnxEpo* epo = 0;
    362363    try {
     364      // Events (epoch flags 2-6) of epochs not written (time window,
     365      // sampling) are written with the next epoch; events with an epoch
     366      // outside the time window are skipped
     367      QList<t_rnxObsFile::t_rnxEvent> pendingEvents;
     368      bool pendingPowerFail = false;
     369      bool endReached       = false;
    363370      while ( (epo = obsFile->nextEpoch()) != 0) {
     371        collectEvents(epo->events, pendingEvents);
     372        if (epo->flag == 1) {
     373          pendingPowerFail = true;
     374        }
    364375        if (_begTime.valid() && epo->tt < _begTime) {
    365376          continue;
    366377        }
    367378        if (_endTime.valid() && epo->tt > _endTime) {
     379          endReached = true;
    368380          break;
    369381        }
    370382
    371         int sec = int(nint(epo->tt.gpssec()*10));
    372         if (sec % (int(_samplingRate)*10) == 0) {
     383        // sampling in units of 0.1 sec (int(0.1)*10 would be zero)
     384        int sec     = int(nint(epo->tt.gpssec()*10));
     385        int sampl10 = int(nint(_samplingRate*10));
     386        if (sampl10 <= 0 || sec % sampl10 == 0) {
    373387          applyLLI(obsFile, epo);
    374388          if (_minEle > 0.0) {
    375389            applyElevationMask(obsFile, epo);
    376390          }
     391          epo->events = pendingEvents;
     392          pendingEvents.clear();
     393          if (pendingPowerFail) {
     394            epo->flag = 1;
     395            pendingPowerFail = false;
     396          }
    377397          outObsFile.writeEpoch(epo);
    378398        }
    … …  
    380400          rememberLLI(obsFile, epo);
    381401        }
     402      }
     403      // events after the last epoch of the file
     404      if (!endReached) {
     405        collectEvents(obsFile->pendingEvents(), pendingEvents);
     406        outObsFile.writeEvents(pendingEvents);
    382407      }
    383408    }
    … …  
    400425      return;
    401426    }
     427  }
     428}
     429
     430// Events to be written: events after the time window are skipped, events
     431// before it only if they refer to their epoch (flag 5: external event,
     432// flag 6: cycle slips); flags 2-4 change the state of the following data
     433////////////////////////////////////////////////////////////////////////////
     434void t_reqcEdit::collectEvents(const QList<t_rnxObsFile::t_rnxEvent>& events,
     435                               QList<t_rnxObsFile::t_rnxEvent>& pendingEvents) const {
     436  for (int ii = 0; ii < events.size(); ii++) {
     437    const t_rnxObsFile::t_rnxEvent& event = events[ii];
     438    if (event.epochValid && _endTime.valid() && event.tt > _endTime) {
     439      continue;
     440    }
     441    if (event.epochValid && _begTime.valid() && event.tt < _begTime &&
     442        (event.flag == 5 || event.flag == 6)) {
     443      continue;
     444    }
     445    pendingEvents.append(event);
    402446  }
    403447}
Note: See TracChangeset for help on using the changeset viewer.