source: ntrip/trunk/BNC/src/RTCM3/crs.h@ 10534

Last change on this file since 10534 was 10534, checked in by stuerze, 2 days ago

Service and RTCM CRS encoding and decoding as well as Helmert parameter decoding added + some re-organisation

File size: 6.3 KB
Line 
1/*
2 * crs.h
3 *
4 * Created on: Jun 18, 2024
5 * Author: stuerze
6 */
7
8#ifndef SRC_RTCM3_CRS_H_
9#define SRC_RTCM3_CRS_H_
10
11#include <cstring>
12#include <iostream>
13#include <iomanip>
14using namespace std;
15
16 class t_serviceCrs {
17 public:
18 t_serviceCrs() {
19 _coordinateEpoch = 0;
20 _CE = 0;
21 }
22 ~t_serviceCrs() {
23 clear();
24 }
25 void clear(void) {
26 memset(_name, '\0', 31 * sizeof(char));
27 _coordinateEpoch = 0;
28 _CE = 0;
29 }
30 void print() {
31 cout << "=============" << endl;
32 cout << "service Crs" << endl;
33 cout << "=============" << endl;
34 cout << QString("%1").arg(_name).toStdString().c_str() << endl;
35 cout << "_coordinateEpoch: " << _coordinateEpoch << endl;
36 cout << "_CE: " << _CE << endl;
37 }
38 void setCoordinateEpochFromCE() {(!_CE) ? _coordinateEpoch = 0.0 : _coordinateEpoch = 1900 + _CE; }
39 void setCEFromCoordinateEpoch() {(!_coordinateEpoch) ? _CE = 0 : _CE = _coordinateEpoch -1900; }
40 char _name[31];
41 double _coordinateEpoch;
42 double _CE;
43 };
44
45
46 class t_rtcmCrs {
47 public:
48 t_rtcmCrs() {
49 _anchor = 0;
50 _plateNumber = 0;
51 }
52
53 ~t_rtcmCrs() {
54 clear();
55 }
56 void clear() {
57 memset(_name, '\0', 31 * sizeof(char));
58 _anchor = 0;
59 _plateNumber = 0;
60 _databaseLinks.clear();
61 }
62 void print() {
63 cout << "=============" << endl;
64 cout << "rtcm Crs" << endl;
65 cout << "=============" << endl;
66 cout << QString("%1").arg(_name).toStdString().c_str() << endl;
67 cout << "_anchor: " << _anchor << endl;
68 cout << "_plateNumber: " << _plateNumber << endl;
69 for (int i = 0; i<_databaseLinks.size(); i++){
70 cout << _databaseLinks[i].toStdString() << endl;
71 }
72 }
73 char _name[31];
74 int _anchor; // 0.. global CRS (=> Plate number 0), 1.. plate-fixed CRS
75 int _plateNumber; // 0.. unknown, 7.. Eurasia
76 QStringList _databaseLinks;
77 };
78
79 class t_helmertPar {
80 public:
81 t_helmertPar() {
82 _sysIdentNum = 0;
83 _utilTrafoMessageIndicator = 0;
84 _t0 = 0;
85 _dx = 0.0;
86 _dy = 0.0;
87 _dz = 0.0;
88 _dxr = 0.0;
89 _dyr = 0.0;
90 _dzr = 0.0;
91 _ox = 0.0;
92 _oy = 0.0;
93 _oz = 0.0;
94 _oxr = 0.0;
95 _oyr = 0.0;
96 _ozr = 0.0;
97 _sc = 0.0;
98 _scr = 0.0;
99 }
100
101 QString IndtoString() {
102 int ind = _utilTrafoMessageIndicator;
103 QString str = "";
104 if (!ind) {
105 str += " not utillized";
106 return str;
107 }
108 // Bit 0
109 if (ind & (1<<0)) {
110 str += "MT1023 ";
111 }
112 // Bit 1
113 if (ind & (1<<1)) {
114 str += "MT1024 ";
115 }
116 // Bit 2
117 if (ind & (1<<2)) {
118 str += "MT1025 ";
119 }
120 // Bit 3
121 if (ind & (1<<3)) {
122 str += "MT1026 ";
123 }
124 // Bit 4
125 if (ind & (1<<4)) {
126 str += "MT1027 ";
127 }
128 // 5 -9
129 if (!(ind & (1<<5)) &&
130 !(ind & (1<<6)) &&
131 !(ind & (1<<7)) &&
132 !(ind & (1<<8)) &&
133 !(ind & (1<<9))) {
134 str += "(and Bit 5-9 is reserved => zero)";
135 }
136 return str;
137 }
138 bool operator==(const t_helmertPar& helmertPar1) const {
139 if (strncmp(_sourceName, helmertPar1._sourceName, strlen(_sourceName)) == 0 &&
140 strncmp(_targetName, helmertPar1._targetName, strlen(_targetName)) == 0 &&
141 _sysIdentNum == helmertPar1._sysIdentNum &&
142 _t0 == helmertPar1._t0) {
143 return true;
144 }
145 else {
146 return false;
147 }
148 }
149 void print() {
150 cout << "MT 1301: " << endl;
151 cout << "_sourceName: " << _sourceName << endl;
152 cout << "_targetName: " << _targetName << endl;
153 cout << "_sysIdentNum: " << _sysIdentNum << endl;
154 cout << "_utilTrafoMessageIndicator: " << IndtoString().toStdString().c_str() << endl;
155 bncTime t; t.setmjd(0, _t0);
156 cout << "_t0 : " << "MJD " << _t0 << " (" << t.datestr() << ")" << endl;
157 cout <<setw(10) << setprecision(5) << "_dx : " << _dx << endl;
158 cout <<setw(10) << setprecision(5) << "_dy : " << _dy << endl;
159 cout <<setw(10) << setprecision(5) << "_dz : " << _dz << endl;
160 cout <<setw(10) << setprecision(7) << "_dxr : " << _dxr << endl;
161 cout <<setw(10) << setprecision(7) << "_dyr : " << _dyr << endl;
162 cout <<setw(10) << setprecision(7) << "_dzr : " << _dzr << endl;
163 cout <<setw(10) << setprecision(5) << "_ox : " << _ox << endl;
164 cout <<setw(10) << setprecision(5) << "_oy : " << _oy << endl;
165 cout <<setw(10) << setprecision(5) << "_oz : " << _oz << endl;
166 cout <<setw(10) << setprecision(7) << "_oxr : " << _oxr << endl;
167 cout <<setw(10) << setprecision(7) << "_oyr : " << _oyr << endl;
168 cout <<setw(10) << setprecision(7) << "_ozr : " << _ozr << endl;
169 cout <<setw(10) << setprecision(5) << "_sc : " << _sc << endl;
170 cout <<setw(10) << setprecision(7) << "_scr : " << _scr << endl;
171 cout << endl;
172 }
173 char _sourceName[31];
174 char _targetName[31];
175 int _sysIdentNum;
176 int _utilTrafoMessageIndicator;
177 int _t0; // reference epoch
178 double _dx; // translation in x
179 double _dy; // translation in y
180 double _dz; // translation in z
181 double _dxr; // translation rate in x
182 double _dyr; // translation rate in y
183 double _dzr; // translation rate in z
184 double _ox; // rotation in x
185 double _oy; // rotation in y
186 double _oz; // rotation in z
187 double _oxr; // rotation rate in x
188 double _oyr; // rotation rate in y
189 double _ozr; // rotation rate in zssss
190 double _sc; // scale
191 double _scr; // scale rate
192 };
193
194
195#endif /* SRC_RTCM3_CRS_H_ */
Note: See TracBrowser for help on using the repository browser.