[3716] | 1 | // Part of BNC, a utility for retrieving decoding and
|
---|
| 2 | // converting GNSS data streams from NTRIP broadcasters.
|
---|
| 3 | //
|
---|
| 4 | // Copyright (C) 2007
|
---|
| 5 | // German Federal Agency for Cartography and Geodesy (BKG)
|
---|
| 6 | // http://www.bkg.bund.de
|
---|
| 7 | // Czech Technical University Prague, Department of Geodesy
|
---|
| 8 | // http://www.fsv.cvut.cz
|
---|
| 9 | //
|
---|
| 10 | // Email: euref-ip@bkg.bund.de
|
---|
| 11 | //
|
---|
| 12 | // This program is free software; you can redistribute it and/or
|
---|
| 13 | // modify it under the terms of the GNU General Public License
|
---|
| 14 | // as published by the Free Software Foundation, version 2.
|
---|
| 15 | //
|
---|
| 16 | // This program is distributed in the hope that it will be useful,
|
---|
| 17 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 18 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 19 | // GNU General Public License for more details.
|
---|
| 20 | //
|
---|
| 21 | // You should have received a copy of the GNU General Public License
|
---|
| 22 | // along with this program; if not, write to the Free Software
|
---|
| 23 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
---|
| 24 |
|
---|
| 25 | #ifndef RNXOBSFILE_H
|
---|
| 26 | #define RNXOBSFILE_H
|
---|
| 27 |
|
---|
[3718] | 28 | #include <QtCore>
|
---|
[3717] | 29 |
|
---|
[3716] | 30 | #include <fstream>
|
---|
| 31 | #include <vector>
|
---|
| 32 | #include <map>
|
---|
| 33 |
|
---|
| 34 | #include "newmat.h"
|
---|
| 35 | #include "bncconst.h"
|
---|
| 36 | #include "bnctime.h"
|
---|
[5742] | 37 | #include "t_prn.h"
|
---|
[6137] | 38 | #include "satObs.h"
|
---|
[3716] | 39 |
|
---|
[4480] | 40 | class t_rnxObsHeader {
|
---|
[6119] | 41 |
|
---|
| 42 | friend class t_rnxObsFile;
|
---|
[6120] | 43 | friend class bncRinex;
|
---|
[6119] | 44 |
|
---|
[4480] | 45 | public:
|
---|
[6119] | 46 | static const double defaultRnxObsVersion2 = 2.11;
|
---|
| 47 | static const double defaultRnxObsVersion3 = 3.02;
|
---|
| 48 | static const QString defaultSystems;
|
---|
[5375] | 49 |
|
---|
[4480] | 50 | t_rnxObsHeader();
|
---|
| 51 | ~t_rnxObsHeader();
|
---|
| 52 |
|
---|
[6119] | 53 | t_irc read(QTextStream* stream, int maxLines = 0);
|
---|
| 54 | int numSys() const;
|
---|
[6130] | 55 | char system(int iSys) const;
|
---|
[6119] | 56 | int nTypes(char sys) const;
|
---|
[6126] | 57 | QString obsType(char sys, int index, double version = 0.0) const;
|
---|
[6119] | 58 | QStringList obsTypesStrings() const;
|
---|
| 59 | void write(QTextStream* stream, const QMap<QString, QString>* txtMap = 0) const;
|
---|
[4480] | 60 |
|
---|
[6119] | 61 | private:
|
---|
[4480] | 62 | float _version;
|
---|
| 63 | double _interval;
|
---|
| 64 | QString _antennaNumber;
|
---|
| 65 | QString _antennaName;
|
---|
| 66 | QString _markerName;
|
---|
| 67 | QString _markerNumber;
|
---|
| 68 | QString _observer;
|
---|
| 69 | QString _agency;
|
---|
| 70 | QString _receiverNumber;
|
---|
| 71 | QString _receiverType;
|
---|
| 72 | QString _receiverVersion;
|
---|
[4493] | 73 | QStringList _comments;
|
---|
[4480] | 74 | ColumnVector _antNEU;
|
---|
| 75 | ColumnVector _antXYZ;
|
---|
| 76 | ColumnVector _antBSG;
|
---|
| 77 | ColumnVector _xyz;
|
---|
[6119] | 78 | QMap<char, QVector<QString> > _obsTypes;
|
---|
[5742] | 79 | int _wlFactorsL1[t_prn::MAXPRN_GPS+1];
|
---|
| 80 | int _wlFactorsL2[t_prn::MAXPRN_GPS+1];
|
---|
[4480] | 81 | bncTime _startTime;
|
---|
| 82 | };
|
---|
| 83 |
|
---|
[3716] | 84 | class t_rnxObsFile {
|
---|
| 85 | public:
|
---|
| 86 |
|
---|
[3840] | 87 | static bool earlierStartTime(const t_rnxObsFile* file1, const t_rnxObsFile* file2) {
|
---|
| 88 | return file1->startTime() < file2->startTime();
|
---|
| 89 | }
|
---|
| 90 |
|
---|
[6119] | 91 | class t_rnxObs {
|
---|
| 92 | public:
|
---|
| 93 | double value;
|
---|
| 94 | int lli;
|
---|
| 95 | int snr;
|
---|
| 96 | };
|
---|
| 97 |
|
---|
[3716] | 98 | class t_rnxSat {
|
---|
| 99 | public:
|
---|
[6119] | 100 | t_prn prn;
|
---|
| 101 | QMap<QString, t_rnxObs> obs;
|
---|
[3716] | 102 | };
|
---|
| 103 |
|
---|
| 104 | class t_rnxEpo {
|
---|
| 105 | public:
|
---|
[6126] | 106 | t_rnxEpo() {clear();}
|
---|
[3716] | 107 | void clear() {
|
---|
[6119] | 108 | tt.reset();
|
---|
[3716] | 109 | rnxSat.clear();
|
---|
[6126] | 110 | version = 0.0;
|
---|
[3716] | 111 | }
|
---|
| 112 | bncTime tt;
|
---|
| 113 | std::vector<t_rnxSat> rnxSat;
|
---|
[6126] | 114 | double version;
|
---|
[3716] | 115 | };
|
---|
| 116 |
|
---|
[3843] | 117 | enum e_inpOut {input, output};
|
---|
| 118 |
|
---|
| 119 | t_rnxObsFile(const QString& fileName, e_inpOut inpOut);
|
---|
[3716] | 120 | ~t_rnxObsFile();
|
---|
| 121 |
|
---|
[6119] | 122 | float version() const {return _header._version;}
|
---|
| 123 | double interval() const {return _header._interval;}
|
---|
| 124 | int numSys() const {return _header.numSys();}
|
---|
[6130] | 125 | char system(int iSys) const {return _header.system(iSys);}
|
---|
[6119] | 126 | int nTypes(char sys) const {return _header.nTypes(sys);}
|
---|
| 127 | const QString& fileName() const {return _fileName;}
|
---|
[6126] | 128 | QString obsType(char sys, int index, double version = 0.0) const {
|
---|
| 129 | return _header.obsType(sys, index, version);
|
---|
| 130 | }
|
---|
[6119] | 131 | const QString& antennaName() const {return _header._antennaName;}
|
---|
| 132 | const QString& markerName() const {return _header._markerName;}
|
---|
| 133 | const QString& receiverType() const {return _header._receiverType;}
|
---|
[3984] | 134 |
|
---|
[4112] | 135 | void setInterval(double interval) {_header._interval = interval;}
|
---|
[3984] | 136 | void setAntennaName(const QString& antennaName) {_header._antennaName = antennaName;}
|
---|
| 137 | void setMarkerName(const QString& markerName) {_header._markerName = markerName;}
|
---|
| 138 | void setReceiverType(const QString& receiverType) {_header._receiverType = receiverType;}
|
---|
| 139 |
|
---|
[3716] | 140 | const ColumnVector& xyz() const {return _header._xyz;}
|
---|
| 141 | const ColumnVector& antNEU() const {return _header._antNEU;}
|
---|
| 142 | const ColumnVector& antXYZ() const {return _header._antXYZ;}
|
---|
| 143 | const ColumnVector& antBSG() const {return _header._antBSG;}
|
---|
[3991] | 144 |
|
---|
[3838] | 145 | const bncTime& startTime() const {return _header._startTime;}
|
---|
[3991] | 146 | void setStartTime(const bncTime& startTime) {_header._startTime = startTime;}
|
---|
| 147 |
|
---|
[3994] | 148 | t_rnxEpo* nextEpoch();
|
---|
[3716] | 149 | int wlFactorL1(unsigned iPrn) {
|
---|
[5742] | 150 | return iPrn <= t_prn::MAXPRN_GPS ? _header._wlFactorsL1[iPrn] : 1;
|
---|
[3716] | 151 | }
|
---|
| 152 | int wlFactorL2(unsigned iPrn) {
|
---|
[5742] | 153 | return iPrn <= t_prn::MAXPRN_GPS ? _header._wlFactorsL2[iPrn] : 1;
|
---|
[3716] | 154 | }
|
---|
| 155 |
|
---|
[3844] | 156 | const t_rnxObsHeader& header() const {return _header;}
|
---|
[6118] | 157 | void setHeader(const t_rnxObsHeader& header, double version, const QStringList& useObsTypes);
|
---|
[3845] | 158 | void writeEpoch(const t_rnxEpo* epo);
|
---|
[3844] | 159 |
|
---|
[4481] | 160 | QTextStream* stream() {return _stream;}
|
---|
| 161 |
|
---|
[5883] | 162 | static void setObsFromRnx(const t_rnxObsFile* rnxObsFile,
|
---|
| 163 | const t_rnxObsFile::t_rnxEpo* epo,
|
---|
| 164 | const t_rnxObsFile::t_rnxSat& rnxSat,
|
---|
[6137] | 165 | t_satObs& obs);
|
---|
[5883] | 166 |
|
---|
[6149] | 167 | static QString type2to3(const QString& typeV2);
|
---|
[5932] | 168 | static QString type3to2(const QString& typeV3);
|
---|
| 169 |
|
---|
[3844] | 170 | private:
|
---|
[4480] | 171 | t_rnxObsFile() {};
|
---|
| 172 | void openRead(const QString& fileName);
|
---|
| 173 | void openWrite(const QString& fileName);
|
---|
| 174 | void close();
|
---|
[3866] | 175 | void writeEpochV2(const t_rnxEpo* epo);
|
---|
| 176 | void writeEpochV3(const t_rnxEpo* epo);
|
---|
[3994] | 177 | t_rnxEpo* nextEpochV2();
|
---|
| 178 | t_rnxEpo* nextEpochV3();
|
---|
[4540] | 179 | void handleEpochFlag(int flag, const QString& line, bool& headerReRead);
|
---|
[3960] | 180 |
|
---|
[3843] | 181 | e_inpOut _inpOut;
|
---|
[3718] | 182 | QFile* _file;
|
---|
[3717] | 183 | QString _fileName;
|
---|
[3718] | 184 | QTextStream* _stream;
|
---|
[3716] | 185 | t_rnxObsHeader _header;
|
---|
| 186 | t_rnxEpo _currEpo;
|
---|
| 187 | bool _flgPowerFail;
|
---|
| 188 | };
|
---|
| 189 |
|
---|
| 190 | #endif
|
---|