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