[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"
|
---|
[3716] | 38 |
|
---|
[4480] | 39 | class t_rnxObsHeader {
|
---|
| 40 | public:
|
---|
[5375] | 41 | static const double defaultRnxObsVersion2 = 2.11;
|
---|
| 42 | static const double defaultRnxObsVersion3 = 3.02;
|
---|
| 43 |
|
---|
[4480] | 44 | t_rnxObsHeader();
|
---|
| 45 | ~t_rnxObsHeader();
|
---|
| 46 |
|
---|
| 47 | t_irc read(QTextStream* stream, int maxLines = 0);
|
---|
| 48 | int nTypes(char sys) const;
|
---|
| 49 | const QString& obsType(char sys, int index) const;
|
---|
[4481] | 50 | QStringList obsTypesStrings() const;
|
---|
| 51 | void write(QTextStream* stream,
|
---|
| 52 | const QMap<QString, QString>* txtMap = 0) const;
|
---|
[4480] | 53 |
|
---|
| 54 | static const QString _emptyStr;
|
---|
| 55 | float _version;
|
---|
| 56 | double _interval;
|
---|
| 57 | QString _antennaNumber;
|
---|
| 58 | QString _antennaName;
|
---|
| 59 | QString _markerName;
|
---|
| 60 | QString _markerNumber;
|
---|
| 61 | QString _observer;
|
---|
| 62 | QString _agency;
|
---|
| 63 | QString _receiverNumber;
|
---|
| 64 | QString _receiverType;
|
---|
| 65 | QString _receiverVersion;
|
---|
[4493] | 66 | QStringList _comments;
|
---|
[4480] | 67 | ColumnVector _antNEU;
|
---|
| 68 | ColumnVector _antXYZ;
|
---|
| 69 | ColumnVector _antBSG;
|
---|
| 70 | ColumnVector _xyz;
|
---|
| 71 | QVector<QString> _obsTypesV2;
|
---|
| 72 | QMap<char, QVector<QString> > _obsTypesV3;
|
---|
[5742] | 73 | int _wlFactorsL1[t_prn::MAXPRN_GPS+1];
|
---|
| 74 | int _wlFactorsL2[t_prn::MAXPRN_GPS+1];
|
---|
[4480] | 75 | bncTime _startTime;
|
---|
| 76 | };
|
---|
| 77 |
|
---|
[3716] | 78 | class t_rnxObsFile {
|
---|
| 79 | public:
|
---|
| 80 |
|
---|
[3840] | 81 | static bool earlierStartTime(const t_rnxObsFile* file1, const t_rnxObsFile* file2) {
|
---|
| 82 | return file1->startTime() < file2->startTime();
|
---|
| 83 | }
|
---|
| 84 |
|
---|
[3716] | 85 | class t_rnxSat {
|
---|
| 86 | public:
|
---|
| 87 | char satSys;
|
---|
| 88 | int satNum;
|
---|
| 89 | std::vector<double> obs;
|
---|
| 90 | std::vector<int> lli;
|
---|
| 91 | std::vector<int> snr;
|
---|
| 92 | };
|
---|
| 93 |
|
---|
| 94 | class t_rnxEpo {
|
---|
| 95 | public:
|
---|
| 96 | void clear() {
|
---|
| 97 | rnxSat.clear();
|
---|
| 98 | }
|
---|
| 99 | bncTime tt;
|
---|
| 100 | std::vector<t_rnxSat> rnxSat;
|
---|
| 101 | };
|
---|
| 102 |
|
---|
[3843] | 103 | enum e_inpOut {input, output};
|
---|
| 104 |
|
---|
| 105 | t_rnxObsFile(const QString& fileName, e_inpOut inpOut);
|
---|
[3716] | 106 | ~t_rnxObsFile();
|
---|
| 107 |
|
---|
| 108 | float version() const {return _header._version;}
|
---|
| 109 | double interval() const {return _header._interval;}
|
---|
| 110 | int nTypes(char sys) const {return _header.nTypes(sys);}
|
---|
[3717] | 111 | const QString& fileName() const {return _fileName;}
|
---|
| 112 | const QString& obsType(char sys, int index) const {return _header.obsType(sys, index);}
|
---|
[3984] | 113 |
|
---|
[3717] | 114 | const QString& antennaName() const {return _header._antennaName;}
|
---|
| 115 | const QString& markerName() const {return _header._markerName;}
|
---|
[3984] | 116 | const QString& receiverType() const {return _header._receiverType;}
|
---|
| 117 |
|
---|
[4112] | 118 | void setInterval(double interval) {_header._interval = interval;}
|
---|
[3984] | 119 | void setAntennaName(const QString& antennaName) {_header._antennaName = antennaName;}
|
---|
| 120 | void setMarkerName(const QString& markerName) {_header._markerName = markerName;}
|
---|
| 121 | void setReceiverType(const QString& receiverType) {_header._receiverType = receiverType;}
|
---|
| 122 |
|
---|
[3716] | 123 | const ColumnVector& xyz() const {return _header._xyz;}
|
---|
| 124 | const ColumnVector& antNEU() const {return _header._antNEU;}
|
---|
| 125 | const ColumnVector& antXYZ() const {return _header._antXYZ;}
|
---|
| 126 | const ColumnVector& antBSG() const {return _header._antBSG;}
|
---|
[3991] | 127 |
|
---|
[3838] | 128 | const bncTime& startTime() const {return _header._startTime;}
|
---|
[3991] | 129 | void setStartTime(const bncTime& startTime) {_header._startTime = startTime;}
|
---|
| 130 |
|
---|
[3994] | 131 | t_rnxEpo* nextEpoch();
|
---|
[3716] | 132 | int wlFactorL1(unsigned iPrn) {
|
---|
[5742] | 133 | return iPrn <= t_prn::MAXPRN_GPS ? _header._wlFactorsL1[iPrn] : 1;
|
---|
[3716] | 134 | }
|
---|
| 135 | int wlFactorL2(unsigned iPrn) {
|
---|
[5742] | 136 | return iPrn <= t_prn::MAXPRN_GPS ? _header._wlFactorsL2[iPrn] : 1;
|
---|
[3716] | 137 | }
|
---|
| 138 |
|
---|
[3844] | 139 | const t_rnxObsHeader& header() const {return _header;}
|
---|
[3956] | 140 | void setHeader(const t_rnxObsHeader& header, double version);
|
---|
[4053] | 141 | void checkNewHeader(const t_rnxObsHeader& header);
|
---|
[3845] | 142 | void writeEpoch(const t_rnxEpo* epo);
|
---|
[3844] | 143 |
|
---|
[4481] | 144 | QTextStream* stream() {return _stream;}
|
---|
| 145 |
|
---|
[3844] | 146 | private:
|
---|
[3956] | 147 | enum e_trafo {trafoNone, trafo2to3, trafo3to2};
|
---|
| 148 |
|
---|
[4480] | 149 | t_rnxObsFile() {};
|
---|
| 150 | void openRead(const QString& fileName);
|
---|
| 151 | void openWrite(const QString& fileName);
|
---|
| 152 | void close();
|
---|
[3866] | 153 | void writeEpochV2(const t_rnxEpo* epo);
|
---|
| 154 | void writeEpochV3(const t_rnxEpo* epo);
|
---|
[3994] | 155 | t_rnxEpo* nextEpochV2();
|
---|
| 156 | t_rnxEpo* nextEpochV3();
|
---|
[4540] | 157 | void handleEpochFlag(int flag, const QString& line, bool& headerReRead);
|
---|
[3960] | 158 |
|
---|
[3956] | 159 | QString type2to3(char sys, const QString& typeV2);
|
---|
[3962] | 160 | QString type3to2(const QString& typeV3);
|
---|
[3716] | 161 |
|
---|
[4053] | 162 | QMap<char, QMap<int, int> > _indexMap2to3;
|
---|
| 163 | QMap<char, QMap<int, int> > _indexMap3to2;
|
---|
[3960] | 164 |
|
---|
[3843] | 165 | e_inpOut _inpOut;
|
---|
[3718] | 166 | QFile* _file;
|
---|
[3717] | 167 | QString _fileName;
|
---|
[3718] | 168 | QTextStream* _stream;
|
---|
[3716] | 169 | t_rnxObsHeader _header;
|
---|
| 170 | t_rnxEpo _currEpo;
|
---|
| 171 | bool _flgPowerFail;
|
---|
[3956] | 172 | e_trafo _trafo;
|
---|
[3716] | 173 | };
|
---|
| 174 |
|
---|
| 175 | #endif
|
---|