source: ntrip/trunk/BNC/src/rinex/rnxobsfile.h@ 6119

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