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