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

Last change on this file since 4480 was 4480, checked in by mervart, 12 years ago
File size: 5.5 KB
Line 
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
28#include <QtCore>
29
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
40class 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;
48
49 static const QString _emptyStr;
50 float _version;
51 double _interval;
52 QString _antennaNumber;
53 QString _antennaName;
54 QString _markerName;
55 QString _markerNumber;
56 QString _observer;
57 QString _agency;
58 QString _receiverNumber;
59 QString _receiverType;
60 QString _receiverVersion;
61 ColumnVector _antNEU;
62 ColumnVector _antXYZ;
63 ColumnVector _antBSG;
64 ColumnVector _xyz;
65 QVector<QString> _obsTypesV2;
66 QMap<char, QVector<QString> > _obsTypesV3;
67 int _wlFactorsL1[MAXPRN_GPS+1];
68 int _wlFactorsL2[MAXPRN_GPS+1];
69 bncTime _startTime;
70};
71
72class t_rnxObsFile {
73 public:
74
75 static bool earlierStartTime(const t_rnxObsFile* file1, const t_rnxObsFile* file2) {
76 return file1->startTime() < file2->startTime();
77 }
78
79 class t_rnxSat {
80 public:
81 char satSys;
82 int satNum;
83 std::vector<double> obs;
84 std::vector<int> lli;
85 std::vector<int> snr;
86 };
87
88 class t_rnxEpo {
89 public:
90 void clear() {
91 rnxSat.clear();
92 }
93 bncTime tt;
94 std::vector<t_rnxSat> rnxSat;
95 };
96
97 enum e_inpOut {input, output};
98
99 t_rnxObsFile(const QString& fileName, e_inpOut inpOut);
100 ~t_rnxObsFile();
101
102 float version() const {return _header._version;}
103 double interval() const {return _header._interval;}
104 int nTypes(char sys) const {return _header.nTypes(sys);}
105 const QString& fileName() const {return _fileName;}
106 const QString& obsType(char sys, int index) const {return _header.obsType(sys, index);}
107
108 const QString& antennaName() const {return _header._antennaName;}
109 const QString& markerName() const {return _header._markerName;}
110 const QString& receiverType() const {return _header._receiverType;}
111
112 void setInterval(double interval) {_header._interval = interval;}
113 void setAntennaName(const QString& antennaName) {_header._antennaName = antennaName;}
114 void setMarkerName(const QString& markerName) {_header._markerName = markerName;}
115 void setReceiverType(const QString& receiverType) {_header._receiverType = receiverType;}
116
117 const ColumnVector& xyz() const {return _header._xyz;}
118 const ColumnVector& antNEU() const {return _header._antNEU;}
119 const ColumnVector& antXYZ() const {return _header._antXYZ;}
120 const ColumnVector& antBSG() const {return _header._antBSG;}
121
122 const bncTime& startTime() const {return _header._startTime;}
123 void setStartTime(const bncTime& startTime) {_header._startTime = startTime;}
124
125 t_rnxEpo* nextEpoch();
126 int wlFactorL1(unsigned iPrn) {
127 return iPrn <= MAXPRN_GPS ? _header._wlFactorsL1[iPrn] : 1;
128 }
129 int wlFactorL2(unsigned iPrn) {
130 return iPrn <= MAXPRN_GPS ? _header._wlFactorsL2[iPrn] : 1;
131 }
132
133 const t_rnxObsHeader& header() const {return _header;}
134 void setHeader(const t_rnxObsHeader& header, double version);
135 void checkNewHeader(const t_rnxObsHeader& header);
136 void writeHeader(const QMap<QString, QString>* txtMap = 0);
137 QStringList obsTypesStrings();
138 void writeEpoch(const t_rnxEpo* epo);
139
140 private:
141 enum e_trafo {trafoNone, trafo2to3, trafo3to2};
142
143 t_rnxObsFile() {};
144 void openRead(const QString& fileName);
145 void openWrite(const QString& fileName);
146 void close();
147 void writeEpochV2(const t_rnxEpo* epo);
148 void writeEpochV3(const t_rnxEpo* epo);
149 t_rnxEpo* nextEpochV2();
150 t_rnxEpo* nextEpochV3();
151 void handleEpochFlag(int flag, const QString& line);
152
153 QString type2to3(char sys, const QString& typeV2);
154 QString type3to2(const QString& typeV3);
155
156 QMap<char, QMap<int, int> > _indexMap2to3;
157 QMap<char, QMap<int, int> > _indexMap3to2;
158
159 e_inpOut _inpOut;
160 QFile* _file;
161 QString _fileName;
162 QTextStream* _stream;
163 t_rnxObsHeader _header;
164 t_rnxEpo _currEpo;
165 bool _flgPowerFail;
166 e_trafo _trafo;
167};
168
169#endif
Note: See TracBrowser for help on using the repository browser.