Changeset 11192 in ntrip for trunk/BNC/src/rinex/rnxobsfile.h


Ignore:
Timestamp:
Nov 10, 2026, 12:13:23 PM (12 days ago)
Author:
stuerze
Message:

rinex version 4.02 now fully supported

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/rinex/rnxobsfile.h

    r11023 r11192  
    7373  void        write(QTextStream* stream, const QMap<QString, QString>* txtMap = 0) const;
    7474  bncTime     startTime() const {return _startTime;}
     75  int         rcvClkOffsAppl() const {return _rcvClkOffsAppl;}
     76  int         scaleFactor(char sys, const QString& type) const;
     77  static QString convertRecord(const QString& line, double outVersion, double inVersion);
    7578  void        setStartTime(const bncTime& startTime) {_startTime = startTime;}
    7679
    … …  
    107110  int                     _wlFactorsL2[t_prn::MAXPRN_GPS+1];
    108111  bncTime                 _startTime;
     112  QString                 _timeSystem;     // TIME OF FIRST OBS system time
     113  int                     _rcvClkOffsAppl; // RCV CLOCK OFFS APPL, -1: not given
     114  char                    _satSystem;      // RINEX VERSION / TYPE satellite system
     115  QMap<char, QMap<QString, int> > _scaleFactors; // SYS / SCALE FACTOR, type "": all types
     116  // Header records not interpreted (or not written) by BNC, kept verbatim
     117  QStringList             _otherRecords;
     118  double                  _otherRecordsVersion; // RINEX version of _otherRecords
     119  // TIME OF LAST OBS, # OF SATELLITES and PRN / # OF OBS: written if given
     120  // in the input header, with the values of the written file
     121  bool                    _hasLastObs;
     122  bool                    _hasObsCounts;   // # OF SATELLITES
     123  bool                    _hasPrnObs;      // PRN / # OF OBS
     124  bncTime                 _lastTime;
     125  QMap<QString, QVector<int> > _obsCounts; // per PRN and obs. type
    109126  bool                    _writeRinexOnlyWithSklObsTypes;
    110127
    … …  
    136153  };
    137154
     155  // Event (epoch flag 2-6) with its special records
     156  class t_rnxEvent {
     157   public:
     158    t_rnxEvent() {flag = 0; epochValid = false; psec = -1; version = 0.0;}
     159    int                   flag;
     160    double                version;    // RINEX version of the input file
     161    bool                  epochValid; // epoch fields not blank
     162    bncTime               tt;         // incl. psec (if given)
     163    int                   psec;
     164    QStringList           records;    // flag 2-5: header records
     165    std::vector<t_rnxSat> slips;      // flag 6: cycle slip records
     166  };
     167
    138168  class t_rnxEpo {
    139169   public:
    … …  
    142172      tt.reset();
    143173      rnxSat.clear();
    144     }
    145     bncTime               tt;
     174      clkOffset      = 0.0;
     175      clkOffsetValid = false;
     176      psec           = -1;
     177      flag           = 0;
     178      events.clear();
     179    }
     180    bncTime               tt;             // incl. psec (if given)
    146181    std::vector<t_rnxSat> rnxSat;
     182    double                clkOffset;      // receiver clock offset estimate [s]
     183    bool                  clkOffsetValid; // clock offset given in epoch record
     184    int                   psec;           // additional pico-sec digits of the
     185                                          // epoch (RINEX >= 4.02, 0..99999),
     186                                          // -1: not given
     187    int                   flag;           // epoch flag 0 or 1 (power failure)
     188    QList<t_rnxEvent>     events;         // events preceding this epoch
    147189  };
    148190
    … …  
    233275    }
    234276    t_rnxEpo epoLocal;
    235     epoLocal.tt = epo->tt;
     277    epoLocal.tt             = epo->tt;
     278    epoLocal.clkOffset      = epo->clkOffset;
     279    epoLocal.clkOffsetValid = epo->clkOffsetValid;
     280    epoLocal.psec           = epo->psec;
     281    epoLocal.flag           = epo->flag;
    236282    for (unsigned ii = 0; ii < epo->rnxSat.size(); ii++) {
    237283      const t_rnxSat& rnxSat = epo->rnxSat[ii];
    … …  
    248294    std::stable_sort(epoLocal.rnxSat.begin(), epoLocal.rnxSat.end(), t_rnxSat::prnSort);
    249295
     296    writeEvents(stream, header, epo->events);
    250297    if (header.version() >= 3.0) {
    251298      writeEpochV3(stream, header, &epoLocal);
    … …  
    256303  }
    257304
     305  // Write events (e.g. the ones after the last epoch, see pendingEvents())
     306  void writeEvents(const QList<t_rnxEvent>& events) {
     307    writeEvents(_epoStream ? _epoStream : _stream, _header, events);
     308  }
     309  static void writeEvents(QTextStream* stream, const t_rnxObsHeader& header,
     310                          const QList<t_rnxEvent>& events);
     311
     312  // Events read after the last observation epoch
     313  QList<t_rnxEvent> pendingEvents();
     314
     315  // Output: header written on close(), with TIME OF FIRST/LAST OBS and
     316  // PRN / # OF OBS of the written epochs; epochs go to a temporary file
     317  void writeHeaderOnClose(const QMap<QString, QString>& txtMap);
     318
    258319 private:
    259   static void writeEpochV2(QTextStream* stream, const t_rnxObsHeader& header, const t_rnxEpo* epo);
    260   static void writeEpochV3(QTextStream* stream, const t_rnxObsHeader& header, const t_rnxEpo* epo);
     320  typedef QMap<QString, QVector<int> > t_obsCounts;
     321  static void writeEpochV2(QTextStream* stream, const t_rnxObsHeader& header, const t_rnxEpo* epo,
     322                           t_obsCounts* obsCounts = 0);
     323  static void writeEpochV3(QTextStream* stream, const t_rnxObsHeader& header, const t_rnxEpo* epo,
     324                           t_obsCounts* obsCounts = 0);
    261325  t_rnxObsFile() {};
    262326  void openRead(const QString& fileName);
    … …  
    265329  t_rnxEpo* nextEpochV2();
    266330  t_rnxEpo* nextEpochV3();
    267   void handleEpochFlag(int flag, const QString& line, bool& headerReRead);
     331  static std::vector<t_rnxSat> selectSats(const t_rnxObsHeader& header,
     332                                          const std::vector<t_rnxSat>& rnxSats);
     333  void readEvent(int flag, QString& line);
     334  void readSatRecordsV3(int numSat, std::vector<t_rnxSat>& rnxSats);
     335  void readSatRecordsV2(QString& line, int numSat, std::vector<t_rnxSat>& rnxSats);
     336  void writeDeferredHeader();
    268337
    269338  e_inpOut       _inpOut;
    … …  
    274343  t_rnxEpo       _currEpo;
    275344  bool           _flgPowerFail;
     345  QList<t_rnxEvent> _pendingEvents;
     346  // header written on close
     347  QTemporaryFile*         _epoFile;
     348  QTextStream*            _epoStream;
     349  QMap<QString, QString>  _txtMap;
     350  bncTime                 _firstEpoTime;
     351  bncTime                 _lastEpoTime;
     352  t_obsCounts             _obsCounts;
    276353};
    277354
Note: See TracChangeset for help on using the changeset viewer.