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