• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

icsm-au / DynAdjust / 4558627370

pending completion
4558627370

Pull #213

github

GitHub
Merge c078a4c77 into 9331be4bf
Pull Request #213: Version 1.2.7 (various fixes and enhancements)

949 of 949 new or added lines in 30 files covered. (100.0%)

30356 of 38394 relevant lines covered (79.06%)

3987.35 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.05
/dynadjust/include/measurement_types/dnagpspoint.cpp
1
//============================================================================
2
// Name         : dnagpspoint.cpp
3
// Author       : Roger Fraser
4
// Contributors :
5
// Version      : 1.00
6
// Copyright    : Copyright 2017 Geoscience Australia
7
//
8
//                Licensed under the Apache License, Version 2.0 (the "License");
9
//                you may not use this file except in compliance with the License.
10
//                You may obtain a copy of the License at
11
//               
12
//                http ://www.apache.org/licenses/LICENSE-2.0
13
//               
14
//                Unless required by applicable law or agreed to in writing, software
15
//                distributed under the License is distributed on an "AS IS" BASIS,
16
//                WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
//                See the License for the specific language governing permissions and
18
//                limitations under the License.
19
//
20
// Description  : CDnaGpsPoint and CDnaGpsPointCluster implementation file
21
//============================================================================
22

23
#include <include/exception/dnaexception.hpp>
24
#include <include/parameters/dnaepsg.hpp>
25
#include <include/measurement_types/dnagpspoint.hpp>
26

27
using namespace dynadjust::exception;
28
using namespace dynadjust::epsg;
29
using namespace dynadjust::math;
30

31
namespace dynadjust {
32
namespace measurements {
33

34
CDnaGpsPoint::CDnaGpsPoint(void)
909✔
35
        : m_lRecordedTotal(0)
909✔
36
        , m_dX(0.)
909✔
37
        , m_dY(0.)
909✔
38
        , m_dZ(0.)
909✔
39
        , m_dSigmaXX(0.)
909✔
40
        , m_dSigmaXY(0.)
909✔
41
        , m_dSigmaXZ(0.)
909✔
42
        , m_dSigmaYY(0.)
909✔
43
        , m_dSigmaYZ(0.)
909✔
44
        , m_dSigmaZZ(0.)
909✔
45
        , m_dPscale(1.)
909✔
46
        , m_dLscale(1.)
909✔
47
        , m_dHscale(1.)
909✔
48
        , m_dVscale(1.)
909✔
49
        , m_strCoordType("XYZ")
1,818✔
50
        , m_ctType(XYZ_type_i)
909✔
51
        , m_referenceFrame(DEFAULT_DATUM)
909✔
52
        , m_lclusterID(0)
1,818✔
53
        
54
{
55
        SetEpoch(DEFAULT_EPOCH);
909✔
56
        SetEpsg(epsgStringFromName<string>(m_referenceFrame));
909✔
57

58
        m_vPointCovariances.clear();
909✔
59
        m_vPointCovariances.reserve(0);
909✔
60
        m_MSmeasurementStations = ONE_STATION;
909✔
61
}
909✔
62

63

64
CDnaGpsPoint::~CDnaGpsPoint(void)
1,234✔
65
{
66

67
}
1,234✔
68

69
// move constructor
70
CDnaGpsPoint::CDnaGpsPoint(CDnaGpsPoint&& p)
300✔
71
{
72
        m_strType = p.m_strType;
300✔
73
        m_strFirst = p.m_strFirst;
300✔
74
        m_lRecordedTotal = p.m_lRecordedTotal;
300✔
75
        m_bIgnore = p.m_bIgnore;
300✔
76

77
        m_referenceFrame = p.m_referenceFrame;
300✔
78
        m_epsgCode = p.m_epsgCode;
300✔
79
        m_epoch = p.m_epoch;
300✔
80

81
        m_dX = p.m_dX;
300✔
82
        m_dY = p.m_dY;
300✔
83
        m_dZ = p.m_dZ;
300✔
84
        m_dSigmaXX = p.m_dSigmaXX;
300✔
85
        m_dSigmaXY = p.m_dSigmaXY;
300✔
86
        m_dSigmaXZ = p.m_dSigmaXZ;
300✔
87
        m_dSigmaYY = p.m_dSigmaYY;
300✔
88
        m_dSigmaYZ = p.m_dSigmaYZ;
300✔
89
        m_dSigmaZZ = p.m_dSigmaZZ;
300✔
90

91
        m_dPscale = p.m_dPscale;
300✔
92
        m_dLscale = p.m_dLscale;
300✔
93
        m_dHscale = p.m_dHscale;
300✔
94
        m_dVscale = p.m_dVscale;
300✔
95

96
        SetCoordType(p.m_strCoordType);
300✔
97
        
98
        m_lclusterID = p.m_lclusterID;
300✔
99
        m_MSmeasurementStations = p.m_MSmeasurementStations;
300✔
100

101
        m_msr_db_map = p.m_msr_db_map;
300✔
102

103
        m_vPointCovariances = std::move(p.m_vPointCovariances);
300✔
104
}
300✔
105

106
// move assignment operator
107
CDnaGpsPoint& CDnaGpsPoint::operator= (CDnaGpsPoint&& rhs)
7✔
108
{
109
        // check for assignment to self!
110
        if (this == &rhs)
7✔
111
                return *this;
112

113
        CDnaMeasurement::operator=(std::move(rhs));
7✔
114
        m_lRecordedTotal = rhs.m_lRecordedTotal;
7✔
115

116
        m_referenceFrame = rhs.m_referenceFrame;
7✔
117
        m_epsgCode = rhs.m_epsgCode;
7✔
118
        m_epoch = rhs.m_epoch;
7✔
119

120
        m_dX = rhs.m_dX;
7✔
121
        m_dY = rhs.m_dY;
7✔
122
        m_dZ = rhs.m_dZ;
7✔
123
        m_dSigmaXX = rhs.m_dSigmaXX;
7✔
124
        m_dSigmaXY = rhs.m_dSigmaXY;
7✔
125
        m_dSigmaXZ = rhs.m_dSigmaXZ;
7✔
126
        m_dSigmaYY = rhs.m_dSigmaYY;
7✔
127
        m_dSigmaYZ = rhs.m_dSigmaYZ;
7✔
128
        m_dSigmaZZ = rhs.m_dSigmaZZ;
7✔
129

130
        m_dPscale = rhs.m_dPscale;
7✔
131
        m_dLscale = rhs.m_dLscale;
7✔
132
        m_dHscale = rhs.m_dHscale;
7✔
133
        m_dVscale = rhs.m_dVscale;
7✔
134

135
        SetCoordType(rhs.m_strCoordType);
7✔
136
        
137
        m_lclusterID = rhs.m_lclusterID;
7✔
138
        m_MSmeasurementStations = rhs.m_MSmeasurementStations;
7✔
139

140
        m_msr_db_map = rhs.m_msr_db_map;
7✔
141

142
        m_vPointCovariances = std::move(rhs.m_vPointCovariances);
7✔
143

144
        return *this;
7✔
145
}
146
        
147

148
bool CDnaGpsPoint::operator== (const CDnaGpsPoint& rhs) const
2✔
149
{
150
        return (
2✔
151
                m_strFirst == rhs.m_strFirst &&
4✔
152
                m_strType == rhs.m_strType &&
2✔
153
                m_lRecordedTotal == rhs.m_lRecordedTotal &&
2✔
154
                m_bIgnore == rhs.m_bIgnore &&
2✔
155
                fabs(m_dX - rhs.m_dX) < PRECISION_1E4 &&
2✔
156
                fabs(m_dY - rhs.m_dY) < PRECISION_1E4 &&
2✔
157
                fabs(m_dZ - rhs.m_dZ) < PRECISION_1E4 &&
6✔
158
                iequals(m_referenceFrame, rhs.m_referenceFrame)
4✔
159
                );
2✔
160
}
161
        
162

163
bool CDnaGpsPoint::operator< (const CDnaGpsPoint& rhs) const
4✔
164
{
165
        if (m_strFirst == rhs.m_strFirst) {
4✔
166
                if (m_strType == rhs.m_strType) {
4✔
167
                        if (m_lRecordedTotal == rhs.m_lRecordedTotal) {
4✔
168
                                if (m_bIgnore == rhs.m_bIgnore) {
4✔
169
                                        if (m_epoch == rhs.m_epoch) {
4✔
170
                                                if (fabs(m_dX - rhs.m_dX) < PRECISION_1E4) {
4✔
171
                                                        if (fabs(m_dY - rhs.m_dY) < PRECISION_1E4) {
4✔
172
                                                                return m_dZ < rhs.m_dZ; }
4✔
173
                                                        else
174
                                                                return m_dY < rhs.m_dY; }
×
175
                                                else
176
                                                        return m_dX < rhs.m_dX; }
×
177
                                        else
178
                                                return m_epoch < rhs.m_epoch; }
×
179
                                else
180
                                        return m_bIgnore < rhs.m_bIgnore; }
×
181
                        else
182
                                return m_lRecordedTotal < rhs.m_lRecordedTotal;        }
×
183
                else
184
                        return m_strType < rhs.m_strType; }
×
185
        else
186
                return m_strFirst < rhs.m_strFirst;
×
187
}
188

189
void CDnaGpsPoint::ReserveGpsCovariancesCount(const UINT32& size)
198✔
190
{
191
        m_vPointCovariances.reserve(size);
198✔
192
}
198✔
193

194

195
void CDnaGpsPoint::ResizeGpsCovariancesCount(const UINT32& size)
198✔
196
{
197
        m_vPointCovariances.resize(size);
198✔
198
}
198✔
199

200

201
void CDnaGpsPoint::SetCoordType(const string& sType) {
1,276✔
202
        m_strCoordType = trimstr(sType);
1,276✔
203
        m_ctType = GetMyCoordTypeC();
1,276✔
204
}
1,276✔
205
        
206

207
_COORD_TYPE_ CDnaGpsPoint::GetMyCoordTypeC()
1,276✔
208
{
209
        return CDnaStation::GetCoordTypeC(m_strCoordType);
1,276✔
210
}
211
        
212

213
void CDnaGpsPoint::AddPointCovariance(const CDnaCovariance* pGpsCovariance)
3,549✔
214
{
215
        m_vPointCovariances.push_back(std::move((CDnaCovariance&)*pGpsCovariance));
3,549✔
216
}
3,549✔
217
        
218

219
UINT32 CDnaGpsPoint::CalcBinaryRecordCount() const
258✔
220
{
221
        UINT32 RecordCount = 3;
258✔
222
        vector<CDnaCovariance>::const_iterator _it_cov = m_vPointCovariances.begin();
258✔
223
        for (; _it_cov!=m_vPointCovariances.end(); ++_it_cov)
3,776✔
224
                RecordCount += _it_cov->CalcBinaryRecordCount();
3,518✔
225
        return RecordCount;
258✔
226
}
227
        
228

229
void CDnaGpsPoint::WriteDynaMLMsr(std::ofstream* dynaml_stream, const string&, bool) const
406✔
230
{
231
        UINT32 precision(4);
406✔
232
        
233
        *dynaml_stream << "    <First>" << m_strFirst << "</First>" << endl;
406✔
234
        *dynaml_stream << "    <Clusterpoint>" << endl;
406✔
235
        
236
        if (m_ctType == LLH_type_i || m_ctType == LLh_type_i)
406✔
237
        {
238
                precision = 10;
6✔
239
                *dynaml_stream << "      <X>" << fixed << setprecision(precision) << RadtoDms(m_dX) << "</X>" << endl;
6✔
240
                *dynaml_stream << "      <Y>" << RadtoDmsL(m_dY) << "</Y>" << endl;
6✔
241
        }
242
        else
243
        {
244
                *dynaml_stream << "      <X>" << fixed << setprecision(precision) << m_dX << "</X>" << endl;
400✔
245
                *dynaml_stream << "      <Y>" << m_dY << "</Y>" << endl;
400✔
246
        }
247

248
        *dynaml_stream << "      <Z>" << setprecision(4) << m_dZ << "</Z>" << endl;
406✔
249

250
        if (m_msr_db_map.is_msr_id_set)
406✔
251
                *dynaml_stream << "      <MeasurementID>" << m_msr_db_map.msr_id << "</MeasurementID>" << endl;
13✔
252
        
253
        *dynaml_stream << "      <SigmaXX>" << scientific << setprecision(13) << m_dSigmaXX << "</SigmaXX>" << endl;
406✔
254
        *dynaml_stream << "      <SigmaXY>" << m_dSigmaXY << "</SigmaXY>" << endl;
406✔
255
        *dynaml_stream << "      <SigmaXZ>" << m_dSigmaXZ << "</SigmaXZ>" << endl;
406✔
256
        *dynaml_stream << "      <SigmaYY>" << m_dSigmaYY << "</SigmaYY>" << endl;
406✔
257
        *dynaml_stream << "      <SigmaYZ>" << m_dSigmaYZ << "</SigmaYZ>" << endl;
406✔
258
        *dynaml_stream << "      <SigmaZZ>" << m_dSigmaZZ << "</SigmaZZ>" << endl;
406✔
259
        
260
        // write GPSPoint covariances
261
        vector<CDnaCovariance>::const_iterator _it_cov = m_vPointCovariances.begin();
406✔
262
        for (; _it_cov!=m_vPointCovariances.end(); ++_it_cov)
18,767✔
263
                _it_cov->WriteDynaMLMsr(dynaml_stream);
18,361✔
264
        
265
        *dynaml_stream << "    </Clusterpoint>" << endl;
406✔
266
}
406✔
267
        
268
void CDnaGpsPoint::WriteDNAMsr(std::ofstream* dna_stream, const dna_msr_fields& dmw, const dna_msr_fields& dml, bool) const
448✔
269
{
270
        *dna_stream << setw(dmw.msr_type) << m_strType;
448✔
271
        if (m_bIgnore)
448✔
272
                *dna_stream << setw(dmw.msr_ignore) << "*";
×
273
        else
274
                *dna_stream << setw(dmw.msr_ignore) << " ";
448✔
275

276
        *dna_stream << left << setw(dmw.msr_inst) << m_strFirst;
448✔
277
        
278
        // Print header for first cluster point
279
        if (m_lRecordedTotal == m_vPointCovariances.size() + 1)
448✔
280
        {
281
                if (m_ctType == LLH_type_i)
22✔
282
                        *dna_stream << left << setw(dmw.msr_targ1) << LLH_type;
2✔
283
                else if (m_ctType == LLh_type_i)
20✔
284
                        *dna_stream << left << setw(dmw.msr_targ1) << LLh_type;
1✔
285
                else
286
                        *dna_stream << left << setw(dmw.msr_targ1) << XYZ_type;
19✔
287

288
                *dna_stream << left << setw(dmw.msr_targ2) << m_lRecordedTotal;
22✔
289

290
                // print scaling
291
                *dna_stream << 
22✔
292
                        fixed << setprecision(2) << 
22✔
293
                        right << setw(dmw.msr_gps_vscale) << double_string_width<double, UINT32, string>(m_dVscale, dmw.msr_gps_vscale) <<
44✔
294
                        right << setw(dmw.msr_gps_pscale) << double_string_width<double, UINT32, string>(m_dPscale, dmw.msr_gps_vscale) <<
66✔
295
                        right << setw(dmw.msr_gps_lscale) << double_string_width<double, UINT32, string>(m_dLscale, dmw.msr_gps_vscale) <<
66✔
296
                        right << setw(dmw.msr_gps_hscale) << double_string_width<double, UINT32, string>(m_dHscale, dmw.msr_gps_vscale);
44✔
297
                
298
                // print reference frame and epoch
299
                *dna_stream <<
22✔
300
                        right << setw(dmw.msr_gps_reframe) << m_referenceFrame <<
22✔
301
                        right << setw(dmw.msr_gps_epoch) << m_epoch;
22✔
302

303
                // print database ids
304
                if (m_msr_db_map.is_msr_id_set)
22✔
305
                        *dna_stream << setw(dmw.msr_id_msr) << m_msr_db_map.msr_id;
6✔
306
                if (m_msr_db_map.is_cls_id_set)
22✔
307
                        *dna_stream << setw(dmw.msr_id_cluster) << m_msr_db_map.cluster_id;
6✔
308
        }
309
        else
310
        {
311
                // print database ids
312
                if (m_msr_db_map.is_msr_id_set)
426✔
313
                        *dna_stream << setw(dml.msr_id_msr - dml.msr_targ1) << " " <<
×
314
                                right << setw(dmw.msr_id_msr) << m_msr_db_map.msr_id;
×
315
                if (m_msr_db_map.is_cls_id_set)
426✔
316
                        *dna_stream << setw(dmw.msr_id_cluster) << m_msr_db_map.cluster_id;
×
317
        }
318

319
        *dna_stream << endl;
448✔
320

321
        UINT32 precision = 4;
448✔
322
        UINT32 pad(dmw.msr_type + dmw.msr_ignore + dmw.msr_inst + dmw.msr_targ1 + dmw.msr_targ2);
448✔
323

324
        // X
325
        *dna_stream << setw(pad) << " ";
448✔
326
        if (m_ctType == LLH_type_i || m_ctType == LLh_type_i)
448✔
327
        {
328
                precision = 13;
6✔
329
                *dna_stream << right << setw(dmw.msr_gps) << fixed << setprecision(precision) << RadtoDms(m_dX);
6✔
330
        }
331
        else
332
                *dna_stream << right << setw(dmw.msr_gps) << fixed << setprecision(precision) << m_dX;
442✔
333

334
        *dna_stream << right << setw(dmw.msr_gps_vcv_1) << scientific << setprecision(13) << m_dSigmaXX;
448✔
335
        *dna_stream << endl;
448✔
336

337
        // Y
338
        *dna_stream << setw(pad) << " ";
448✔
339
        if (m_ctType == LLH_type_i || m_ctType == LLh_type_i)
448✔
340
                *dna_stream << right << setw(dmw.msr_gps) << fixed << setprecision(precision) << RadtoDmsL(m_dY);
6✔
341
        else
342
                *dna_stream << right << setw(dmw.msr_gps) << fixed << setprecision(precision) << m_dY;
442✔
343

344
        *dna_stream << 
448✔
345
                right << setw(dmw.msr_gps_vcv_1) << scientific << setprecision(13) << m_dSigmaXY << 
448✔
346
                right << setw(dmw.msr_gps_vcv_2) << m_dSigmaYY;
448✔
347
        *dna_stream << endl;
448✔
348

349
        // Z
350
        precision = 4;        // whether XYZ or LLH, precision only needs to be at 4
448✔
351
        *dna_stream << setw(pad) << " ";
448✔
352
        *dna_stream << right << setw(dmw.msr_gps) << fixed << setprecision(precision) << m_dZ;
448✔
353
        *dna_stream << 
448✔
354
                right << setw(dmw.msr_gps_vcv_1) << scientific << setprecision(13) << m_dSigmaXZ <<
448✔
355
                right << setw(dmw.msr_gps_vcv_2) << m_dSigmaYZ << 
448✔
356
                right << setw(dmw.msr_gps_vcv_3) << m_dSigmaZZ;
448✔
357
        *dna_stream << endl;
448✔
358

359
        // write GPSPoint covariances (not supported by DNA format)
360
        vector<CDnaCovariance>::const_iterator _it_cov = m_vPointCovariances.begin();
448✔
361
        for (_it_cov=m_vPointCovariances.begin(); _it_cov!=m_vPointCovariances.end(); ++_it_cov)
20,435✔
362
                _it_cov->WriteDNAMsr(dna_stream, dmw, dml);
19,987✔
363
}
448✔
364
        
365

366
void CDnaGpsPoint::SimulateMsr(vdnaStnPtr* vStations, const CDnaEllipsoid* ellipsoid)
3✔
367
{
368
        m_dX = vStations->at(m_lstn1Index).get()->GetXAxis();
3✔
369
        m_dY = vStations->at(m_lstn1Index).get()->GetYAxis();
3✔
370
        m_dZ = vStations->at(m_lstn1Index).get()->GetZAxis();
3✔
371

372
        if (m_ctType == LLH_type_i || m_ctType == LLh_type_i)
3✔
373
        {
374
                // propagate to geographic
375
                CartToGeo<double>(m_dX, m_dY, m_dZ, &m_dX, &m_dY, &m_dZ, ellipsoid);
2✔
376

377
                // Reduce to orthometric height
378
                if (fabs(vStations->at(m_lstn1Index).get()->GetgeoidSep()) > PRECISION_1E4)
2✔
379
                        m_dZ -= vStations->at(m_lstn1Index).get()->GetgeoidSep();
2✔
380

381
                m_dSigmaXX = 9.402e-009;
2✔
382
                m_dSigmaXY = 5.876e-010;
2✔
383
                m_dSigmaYY = 9.402e-009;
2✔
384
                m_dSigmaXZ = 5.876e-010;
2✔
385
                m_dSigmaYZ = 5.876e-010;
2✔
386
                m_dSigmaZZ = 2.500e-001;                
2✔
387
        }
388
        else
389
        {
390
                m_dSigmaXX = 4.022E-04;                    
1✔
391
                m_dSigmaXY = -1.369E-04;
1✔
392
                m_dSigmaXZ = 3.975E-04;
1✔
393
                m_dSigmaYY = 1.487E-04;
1✔
394
                m_dSigmaYZ = -2.035E-04;
1✔
395
                m_dSigmaZZ = 6.803E-04;
1✔
396
        }
397

398
        vector<CDnaCovariance>::iterator _it_cov = m_vPointCovariances.begin();
3✔
399
        for (_it_cov=m_vPointCovariances.begin(); _it_cov!=m_vPointCovariances.end(); ++_it_cov)
3✔
400
                _it_cov->SimulateMsr(vStations, ellipsoid);
×
401
}
3✔
402

403
void CDnaGpsPoint::PopulateMsr(pvstn_t bstRecords, uint32_uint32_map* blockStationsMap, vUINT32* blockStations,
706✔
404
                const UINT32& map_idx, const CDnaDatum* datum, matrix_2d* estimates, matrix_2d* variances)
405
{
406
        // populate station coordinate information
407
        m_strType = 'Y';
706✔
408
        m_bIgnore = false;
706✔
409
        SetCoordType(XYZ_type);
706✔
410

411
        m_lstn1Index = blockStations->at(map_idx);
706✔
412
        m_strFirst = bstRecords->at(m_lstn1Index).stationName;
706✔
413
        m_MSmeasurementStations = ONE_STATION;
706✔
414

415
        m_referenceFrame = datum->GetName();
706✔
416
        m_epoch = datum->GetEpoch_s();
706✔
417
        m_epsgCode =  datum->GetEpsgCode_s();
706✔
418

419
        m_dPscale = 1.0;
706✔
420
        m_dLscale = 1.0;
706✔
421
        m_dHscale = 1.0;
706✔
422
        m_dVscale = 1.0;
706✔
423

424
        // populate station coordinate estimates and unertainties
425
        UINT32 mat_idx = (*blockStationsMap)[m_lstn1Index] * 3;
706✔
426
        m_dX = estimates->get(mat_idx, 0);
706✔
427
        m_dY = estimates->get(mat_idx+1, 0);
706✔
428
        m_dZ = estimates->get(mat_idx+2, 0);
706✔
429

430
        m_dSigmaXX = variances->get(mat_idx, mat_idx);
706✔
431
        m_dSigmaXY = variances->get(mat_idx, mat_idx+1);
706✔
432
        m_dSigmaXZ = variances->get(mat_idx, mat_idx+2);
706✔
433
        m_dSigmaYY = variances->get(mat_idx+1, mat_idx+1);
706✔
434
        m_dSigmaYZ = variances->get(mat_idx+1, mat_idx+2);
706✔
435
        m_dSigmaZZ = variances->get(mat_idx+2, mat_idx+2);
706✔
436

437
        // populate station covariances
438
        UINT32 covariance_count = static_cast<UINT32>(blockStations->size()) - map_idx - 1;
706✔
439
        m_vPointCovariances.clear();
706✔
440
        m_vPointCovariances.resize(covariance_count);
706✔
441

442
        vector<CDnaCovariance>::iterator _it_cov = m_vPointCovariances.begin();
706✔
443
        matrix_2d variances_cart(3, 3);
706✔
444
        UINT32 ic, jc;
706✔
445

446
        for (ic=map_idx+1; ic<blockStationsMap->size(); ++ic)
37,260✔
447
        {
448
                jc = (*blockStationsMap)[blockStations->at(ic)] * 3;
36,554✔
449
                
450
                // get cartesian submatrix corresponding to the covariance
451
                variances->submatrix(mat_idx, jc, &variances_cart, 3, 3);
36,554✔
452
        
453
                _it_cov->SetM11(variances_cart.get(0, 0));
36,554✔
454
                _it_cov->SetM12(variances_cart.get(0, 1));
36,554✔
455
                _it_cov->SetM13(variances_cart.get(0, 2));
36,554✔
456
                _it_cov->SetM21(variances_cart.get(1, 0));
36,554✔
457
                _it_cov->SetM22(variances_cart.get(1, 1));
36,554✔
458
                _it_cov->SetM23(variances_cart.get(1, 2));
36,554✔
459
                _it_cov->SetM31(variances_cart.get(2, 0));
36,554✔
460
                _it_cov->SetM32(variances_cart.get(2, 1));
36,554✔
461
                _it_cov->SetM33(variances_cart.get(2, 2));
36,554✔
462
                
463
                ++_it_cov;
36,554✔
464
        }
465
}
706✔
466
        
467

468
UINT32 CDnaGpsPoint::SetMeasurementRec(const vstn_t& binaryStn, it_vmsr_t& it_msr, it_vdbid_t& dbidmap)
94✔
469
{
470
        // first station
471
        m_lstn1Index = it_msr->station1;
94✔
472
        m_strFirst = binaryStn.at(it_msr->station1).stationName;
94✔
473
        
474
        m_dPscale = it_msr->scale1;
94✔
475
        m_dLscale = it_msr->scale2;
94✔
476
        m_dHscale = it_msr->scale3;
94✔
477
        m_dVscale = it_msr->scale4;
94✔
478

479
        m_epoch = it_msr->epoch;
94✔
480
        m_epsgCode = it_msr->epsgCode;
94✔
481
        m_referenceFrame = datumFromEpsgCode<string, UINT32>(LongFromString<UINT32>(it_msr->epsgCode));
94✔
482

483
        m_lclusterID = it_msr->clusterID;
94✔
484
        m_MSmeasurementStations = (MEASUREMENT_STATIONS)it_msr->measurementStations;
94✔
485
        
486
        // X, sigmaXX
487
        m_bIgnore = it_msr->ignore;
94✔
488
        m_strType = it_msr->measType;
94✔
489
        m_dX = it_msr->term1;
94✔
490
        m_dSigmaXX = it_msr->term2;
94✔
491
        m_lRecordedTotal = it_msr->vectorCount1;
94✔
492
        SetCoordType(it_msr->coordType);
94✔
493
        
494
        // get data relating to Y, sigmaYY, sigmaXY
495
        it_msr++;
94✔
496
        
497
        m_dY = it_msr->term1;
94✔
498
        m_dSigmaXY = it_msr->term2;
94✔
499
        m_dSigmaYY = it_msr->term3;
94✔
500

501
        // get data relating to Z, sigmaZZ, sigmaXZ, sigmaYZ
502
        it_msr++;
94✔
503
        
504
        m_dZ = it_msr->term1;
94✔
505
        m_dSigmaXZ = it_msr->term2;
94✔
506
        m_dSigmaYZ = it_msr->term3;
94✔
507
        m_dSigmaZZ = it_msr->term4;
94✔
508

509
        m_vPointCovariances.clear();
94✔
510
        m_vPointCovariances.resize(it_msr->vectorCount2);
94✔
511

512
        CDnaMeasurement::SetDatabaseMap(*dbidmap);
94✔
513
        dbidmap += 2;
94✔
514
        dbidmap += (it_msr->vectorCount2 * 3);
94✔
515

516
        // now covariances
517
        vector<CDnaCovariance>::iterator _it_cov = m_vPointCovariances.begin();
94✔
518
        for (; _it_cov!=m_vPointCovariances.end(); ++_it_cov)
1,813✔
519
                _it_cov->SetMeasurementRec(binaryStn, it_msr);
1,719✔
520

521
        return it_msr->vectorCount1;
94✔
522
}
523
        
524

525
void CDnaGpsPoint::WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 msrIndex) const
258✔
526
{
527
        measurement_t measRecord;
258✔
528
        
529
        // Common
530
        measRecord.measType = GetTypeC();
258✔
531
        measRecord.measStart = xMeas;
258✔
532
        strcpy(measRecord.coordType, m_strCoordType.c_str());
258✔
533
        measRecord.ignore = m_bIgnore;
258✔
534
        measRecord.station1 = m_lstn1Index;
258✔
535
        measRecord.vectorCount1 = m_lRecordedTotal;                                                                        // number of GpsPoints in the cluster
258✔
536
        measRecord.vectorCount2 = static_cast<UINT32>(m_vPointCovariances.size());        // number of Covariances in the GpsPoint
258✔
537

538
        measRecord.clusterID = m_lclusterID;
258✔
539
        measRecord.measurementStations = m_MSmeasurementStations;
258✔
540
        
541
        measRecord.scale1 = m_dPscale;
258✔
542
        measRecord.scale2 = m_dLscale;
258✔
543
        measRecord.scale3 = m_dHscale;
258✔
544
        measRecord.scale4 = m_dVscale;
258✔
545

546
        sprintf(measRecord.epsgCode, "%s", m_epsgCode.substr(0, STN_EPSG_WIDTH).c_str());
258✔
547
        sprintf(measRecord.epoch, "%s", m_epoch.substr(0, STN_EPOCH_WIDTH).c_str());
258✔
548

549
        // X
550
        measRecord.measAdj = m_measAdj;
258✔
551
        measRecord.measCorr = m_measCorr;
258✔
552
        measRecord.measAdjPrec = m_measAdjPrec;
258✔
553
        measRecord.residualPrec = m_residualPrec;
258✔
554
        measRecord.preAdjCorr = m_preAdjCorr;
258✔
555
        measRecord.term1 = m_dX;
258✔
556
        measRecord.term2 = m_dSigmaXX;        // already a variance
258✔
557
        measRecord.term3 = 0.;
258✔
558
        measRecord.term4 = 0.;
258✔
559
        measRecord.fileOrder = ((*msrIndex)++);
258✔
560

561
        binary_stream->write(reinterpret_cast<char *>(&measRecord), sizeof(measurement_t));
258✔
562

563
        // Y
564
        measRecord.measStart = yMeas;
258✔
565
        measRecord.measAdj = m_measAdj;
258✔
566
        measRecord.measCorr = m_measCorr;
258✔
567
        measRecord.measAdjPrec = m_measAdjPrec;
258✔
568
        measRecord.residualPrec = m_residualPrec;
258✔
569
        measRecord.preAdjCorr = m_preAdjCorr;
258✔
570
        measRecord.term1 = m_dY;
258✔
571
        measRecord.term2 = m_dSigmaXY;
258✔
572
        measRecord.term3 = m_dSigmaYY;
258✔
573
        measRecord.term4 = 0.;
258✔
574
        measRecord.fileOrder = ((*msrIndex)++);
258✔
575

576
        binary_stream->write(reinterpret_cast<char *>(&measRecord), sizeof(measurement_t));
258✔
577

578
        // Z
579
        measRecord.measStart = zMeas;
258✔
580
        measRecord.measAdj = m_measAdj;
258✔
581
        measRecord.measCorr = m_measCorr;
258✔
582
        measRecord.measAdjPrec = m_measAdjPrec;
258✔
583
        measRecord.residualPrec = m_residualPrec;
258✔
584
        measRecord.preAdjCorr = m_preAdjCorr;
258✔
585
        measRecord.term1 = m_dZ;
258✔
586
        measRecord.term2 = m_dSigmaXZ;
258✔
587
        measRecord.term3 = m_dSigmaYZ;
258✔
588
        measRecord.term4 = m_dSigmaZZ;
258✔
589
        measRecord.fileOrder = ((*msrIndex)++);
258✔
590

591
        binary_stream->write(reinterpret_cast<char *>(&measRecord), sizeof(measurement_t));
258✔
592

593
        // now write covariance elements
594
        vector<CDnaCovariance>::const_iterator _it_cov;
258✔
595
        for (_it_cov=m_vPointCovariances.begin(); _it_cov!=m_vPointCovariances.end(); ++_it_cov)
3,776✔
596
                _it_cov->WriteBinaryMsr(binary_stream, msrIndex, m_epsgCode, m_epoch);
3,518✔
597
}
258✔
598

599

600
void CDnaGpsPoint::SerialiseDatabaseMap(std::ofstream* os)
258✔
601
{
602
        // X
603
        CDnaMeasurement::SerialiseDatabaseMap(os);
258✔
604
        
605
        // Y
606
        CDnaMeasurement::SerialiseDatabaseMap(os);
258✔
607
        
608
        // Z
609
        CDnaMeasurement::SerialiseDatabaseMap(os);
258✔
610

611
        for_each(m_vPointCovariances.begin(), m_vPointCovariances.end(),
258✔
612
                [this, os](const CDnaCovariance& cov) {
3,518✔
613
                ((CDnaCovariance*)&cov)->SerialiseDatabaseMap(os, m_msr_db_map);
3,518✔
614
        });
615
}
258✔
616
        
617

618
void CDnaGpsPoint::SetEpsg(const string& epsg) 
1,046✔
619
{
620
        m_epsgCode = epsg;
1,046✔
621
}
1,046✔
622

623

624
void CDnaGpsPoint::SetReferenceFrame(const string& refFrame) 
137✔
625
{
626
        m_referenceFrame = refFrame;
137✔
627
        SetEpsg(epsgStringFromName<string>(refFrame));
137✔
628
}
137✔
629
        
630

631
void CDnaGpsPoint::SetX(const string& str)
255✔
632
{
633
        if (m_ctType == LLH_type_i || m_ctType == LLh_type_i)
255✔
634
        {
635
                // latitude
636
                FromDmsString(&m_dX, trimstr(str));
58✔
637
                m_dX = Radians(m_dX);
58✔
638
        }
639
        else
640
                DoubleFromString(m_dX, trimstr(str));
197✔
641
}
255✔
642

643
void CDnaGpsPoint::SetY(const string& str)
255✔
644
{
645
        if (m_ctType == LLH_type_i || m_ctType == LLh_type_i)
255✔
646
        {
647
                // longitude
648
                FromDmsString(&m_dY, trimstr(str));
58✔
649
                m_dY = Radians(m_dY);
58✔
650
        }
651
        else
652
                DoubleFromString(m_dY, trimstr(str));
197✔
653
}
255✔
654
        
655
void CDnaGpsPoint::SetZ(const string& str)
255✔
656
{
657
        // if (m_ctType == LLH_type_i)
658
        // then height should be ellipsoid height (but input files show height to be orthometric!)
659
        DoubleFromString(m_dZ, trimstr(str));
255✔
660
}
255✔
661
        
662
void CDnaGpsPoint::SetSigmaXX(const string& str)
255✔
663
{
664
        // if <Coords>LLH</Coords>, then SigmaXX is in radians^2
665
        // if <Coords>XYZ</Coords>, then SigmaXX is in metres^2
666
        if (DoubleFromString_ZeroCheck(m_dSigmaXX, trimstr(str)))
255✔
667
                throw XMLInteropException("SetSigmaXX(): Variances cannot be zero.", 0);
×
668
}
255✔
669

670
void CDnaGpsPoint::SetSigmaXY(const string& str)
255✔
671
{
672
        DoubleFromString(m_dSigmaXY, trimstr(str));
255✔
673
}
255✔
674

675
void CDnaGpsPoint::SetSigmaXZ(const string& str)
255✔
676
{
677
        DoubleFromString(m_dSigmaXZ, trimstr(str));
255✔
678
}
255✔
679

680
void CDnaGpsPoint::SetSigmaYY(const string& str)
255✔
681
{
682
        // if <Coords>LLH</Coords>, then SigmaYY is in radians^2
683
        // if <Coords>XYZ</Coords>, then SigmaYY is in metres^2
684
        if (DoubleFromString_ZeroCheck(m_dSigmaYY, trimstr(str)))
255✔
685
                throw XMLInteropException("SetSigmaYY(): Variances cannot be zero.", 0);
×
686
}
255✔
687

688
void CDnaGpsPoint::SetSigmaYZ(const string& str)
255✔
689
{
690
        DoubleFromString(m_dSigmaYZ, trimstr(str));
255✔
691
}
255✔
692

693
void CDnaGpsPoint::SetSigmaZZ(const string& str)
255✔
694
{
695
        // if <Coords>LLH</Coords>, then SigmaZZ is in radians^2
696
        // if <Coords>XYZ</Coords>, then SigmaZZ is in metres^2
697
        if (DoubleFromString_ZeroCheck(m_dSigmaZZ, trimstr(str)))
255✔
698
                throw XMLInteropException("SetSigmaZZ(): Variances cannot be zero.", 0);
×
699
}
255✔
700

701

702

703

704

705

706

707

708

709

710

711

712

713
CDnaGpsPointCluster::CDnaGpsPointCluster(void)
13✔
714
        : m_lRecordedTotal(0)
13✔
715
        , m_dPscale(1.)
13✔
716
        , m_dLscale(1.)
13✔
717
        , m_dHscale(1.)
13✔
718
        , m_dVscale(1.)
13✔
719
        , m_strCoordType("XYZ")
26✔
720
        , m_ctType(XYZ_type_i)
13✔
721
        , m_referenceFrame(DEFAULT_DATUM)
13✔
722
        , m_lclusterID(0)
13✔
723
{
724
        SetEpoch(DEFAULT_EPOCH);
13✔
725
        SetEpsg(epsgStringFromName<string>(m_referenceFrame));
13✔
726

727
        m_strType = "Y";
13✔
728
        m_MSmeasurementStations = ONE_STATION;        
13✔
729
}
13✔
730

731

732
CDnaGpsPointCluster::~CDnaGpsPointCluster(void)
120✔
733
{
734

735
}
120✔
736

737
// move constructor
738
CDnaGpsPointCluster::CDnaGpsPointCluster(CDnaGpsPointCluster&& p)
×
739
{
740
        m_strType = p.m_strType;
×
741
        m_bIgnore = p.m_bIgnore;
×
742
        m_lRecordedTotal = p.m_lRecordedTotal;
×
743
        SetCoordType(p.m_strCoordType);
×
744
        m_vGpsPoints = std::move(p.m_vGpsPoints);
×
745

746
        m_dPscale = p.m_dPscale;
×
747
        m_dLscale = p.m_dLscale;
×
748
        m_dHscale = p.m_dHscale;
×
749
        m_dVscale = p.m_dVscale;
×
750

751
        m_lclusterID = p.m_lclusterID;
×
752
        m_MSmeasurementStations = p.m_MSmeasurementStations;
×
753

754
        m_referenceFrame = p.m_referenceFrame;
×
755
        m_epsgCode = p.m_epsgCode;
×
756
        m_epoch = p.m_epoch;
×
757

758
        m_msr_db_map = p.m_msr_db_map;
×
759

760
        m_dbidmap = p.m_dbidmap;
×
761
}
×
762

763
// move assignment operator
764
CDnaGpsPointCluster& CDnaGpsPointCluster::operator= (CDnaGpsPointCluster&& rhs)
×
765
{
766
        // check for assignment to self!
767
        if (this == &rhs)
×
768
                return *this;
769

770
        CDnaMeasurement::operator=(std::move(rhs));
×
771
        m_lRecordedTotal = rhs.m_lRecordedTotal;
×
772
        SetCoordType(rhs.m_strCoordType);
×
773

774
        m_referenceFrame = rhs.m_referenceFrame;
×
775
        m_epsgCode = rhs.m_epsgCode;
×
776
        m_epoch = rhs.m_epoch;
×
777

778
        m_dPscale = rhs.m_dPscale;
×
779
        m_dLscale = rhs.m_dLscale;
×
780
        m_dHscale = rhs.m_dHscale;
×
781
        m_dVscale = rhs.m_dVscale;
×
782

783
        m_lclusterID = rhs.m_lclusterID;
×
784
        m_MSmeasurementStations = rhs.m_MSmeasurementStations;
×
785

786
        m_vGpsPoints = std::move(rhs.m_vGpsPoints);
×
787

788
        m_msr_db_map = rhs.m_msr_db_map;
×
789

790
        m_dbidmap = rhs.m_dbidmap;
×
791

792
        return *this;
×
793
}
794
        
795

796
CDnaGpsPointCluster::CDnaGpsPointCluster(const UINT32 lclusterID, const string& referenceframe, const string& epoch)
74✔
797
        : m_lRecordedTotal(0)
74✔
798
        , m_dPscale(1.)
74✔
799
        , m_dLscale(1.)
74✔
800
        , m_dHscale(1.)
74✔
801
        , m_dVscale(1.)
74✔
802
        , m_strCoordType("XYZ")
148✔
803
        , m_ctType(XYZ_type_i)
74✔
804
        , m_referenceFrame(referenceframe)
74✔
805
        , m_lclusterID(lclusterID)
74✔
806
{
807
        SetEpoch(epoch);
74✔
808
        SetEpsg(epsgStringFromName<string>(referenceframe));
74✔
809

810
        m_strType = "Y";
74✔
811
        m_MSmeasurementStations = ONE_STATION;        
74✔
812
}
74✔
813
        
814

815
bool CDnaGpsPointCluster::operator== (const CDnaGpsPointCluster& rhs) const
2✔
816
{
817
        return (
2✔
818
                m_strType == rhs.m_strType &&
4✔
819
                m_strFirst == rhs.m_strFirst &&
2✔
820
                m_bIgnore == rhs.m_bIgnore &&
2✔
821
                m_lRecordedTotal == rhs.m_lRecordedTotal &&
2✔
822
                m_strCoordType == rhs.m_strCoordType &&
2✔
823
                m_dPscale == rhs.m_dPscale &&
2✔
824
                m_dLscale == rhs.m_dLscale &&
2✔
825
                m_dHscale == rhs.m_dHscale &&
2✔
826
                m_dVscale == rhs.m_dVscale &&
6✔
827
                m_vGpsPoints == rhs.m_vGpsPoints
2✔
828
                );
2✔
829
}
830
        
831
bool CDnaGpsPointCluster::operator< (const CDnaGpsPointCluster& rhs) const
2✔
832
{
833
        if (m_strFirst == rhs.m_strFirst) {
2✔
834
                if (m_strType == rhs.m_strType) {
2✔
835
                        if (m_bIgnore == rhs.m_bIgnore) {
2✔
836
                                if (m_epoch == rhs.m_epoch) {
2✔
837
                                        if (m_strCoordType == rhs.m_strCoordType) {
2✔
838
                                                if (m_lRecordedTotal == rhs.m_lRecordedTotal) 
2✔
839
                                                        return m_vGpsPoints < rhs.m_vGpsPoints;
2✔
840
                                                else
841
                                                        return m_lRecordedTotal < rhs.m_lRecordedTotal; }
×
842
                                        else
843
                                                return m_strCoordType < rhs.m_strCoordType; }
×
844
                                else
845
                                        return m_epoch < rhs.m_epoch; }
×
846
                        else
847
                                return m_bIgnore < rhs.m_bIgnore; }
×
848
                else
849
                        return m_strType < rhs.m_strType; }
×
850
        else
851
                return m_strFirst < rhs.m_strFirst;
×
852
}
853

854
void CDnaGpsPointCluster::SetCoordType(const string& sType) {
168✔
855
        m_strCoordType = trimstr(sType);
168✔
856
        m_ctType = GetMyCoordTypeC();
168✔
857
}
168✔
858
        
859

860
_COORD_TYPE_ CDnaGpsPointCluster::GetMyCoordTypeC()
168✔
861
{
862
        return CDnaStation::GetCoordTypeC(m_strCoordType);
168✔
863
}
864
        
865

866
void CDnaGpsPointCluster::AddGpsPoint(const CDnaMeasurement* pGpsPoint)
279✔
867
{
868
        m_vGpsPoints.push_back(std::move((CDnaGpsPoint&)*pGpsPoint));
279✔
869
}
279✔
870
        
871

872
void CDnaGpsPointCluster::SerialiseDatabaseMap(std::ofstream* os)
53✔
873
{
874
        for_each(m_vGpsPoints.begin(), m_vGpsPoints.end(),
53✔
875
                [this, os](const CDnaGpsPoint& pnt) {
258✔
876
                        ((CDnaGpsPoint*)&pnt)->SerialiseDatabaseMap(os);
258✔
877
        });
878
}
53✔
879
        
880

881
void CDnaGpsPointCluster::SetDatabaseMaps(it_vdbid_t& dbidmap)
×
882
{
883
        m_dbidmap = dbidmap;
×
884

885
        CDnaMeasurement::SetDatabaseMap(*m_dbidmap);
×
886

887
        for_each(m_vGpsPoints.begin(), m_vGpsPoints.end(),
×
888
                [this](const CDnaGpsPoint& bsl) {
×
889
                        ((CDnaGpsPoint*)&bsl)->SetDatabaseMap(*m_dbidmap);
×
890
                        m_dbidmap += ((CDnaGpsPoint*)&bsl)->GetCovariances_ptr()->size();
×
891
                });
×
892
}
×
893

894

895
UINT32 CDnaGpsPointCluster::CalcBinaryRecordCount() const
53✔
896
{
897
        UINT32 recordCount(0);
53✔
898
        for_each(m_vGpsPoints.begin(), m_vGpsPoints.end(),
53✔
899
                [&recordCount](const CDnaGpsPoint& pnt) {
516✔
900
                        recordCount += pnt.CalcBinaryRecordCount();
258✔
901
        });
258✔
902
        return recordCount;
53✔
903
}
904
        
905

906
void CDnaGpsPointCluster::WriteDynaMLMsr(std::ofstream* dynaml_stream, const string& comment, bool) const
29✔
907
{
908
        const size_t pntCount = m_vGpsPoints.size();
29✔
909

910
        if (comment.empty())
29✔
911
        {
912
                *dynaml_stream << "  <!-- Type " << measurement_name<char, string>(GetTypeC());
46✔
913
                if (pntCount > 1)
23✔
914
                        *dynaml_stream << " (set of " << pntCount << ")";
7✔
915
                else
916
                        *dynaml_stream << "  (single)";
16✔
917
                *dynaml_stream << " -->" << endl;
23✔
918
        }
919
        else
920
                *dynaml_stream << "  <!-- " << comment << " -->" << endl;
6✔
921

922
        *dynaml_stream << "  <DnaMeasurement>" << endl;
29✔
923
        *dynaml_stream << "    <Type>" << m_strType << "</Type>" << endl;
29✔
924
        // Source file from which the measurement came
925
        *dynaml_stream << "    <Source>" << m_sourceFile << "</Source>" << endl;
29✔
926
        if (m_bIgnore)
29✔
927
                *dynaml_stream << "    <Ignore>*</Ignore>" << endl;
3✔
928
        else
929
                *dynaml_stream << "    <Ignore/>" << endl;
26✔
930
        
931
        // Reference frame and epoch
932
        *dynaml_stream << "    <ReferenceFrame>" << m_referenceFrame << "</ReferenceFrame>" << endl;
29✔
933
        *dynaml_stream << "    <Epoch>" << m_epoch << "</Epoch>" << endl;
29✔
934

935
        // Scalars
936
        *dynaml_stream << "    <Vscale>" << fixed << setprecision(3) << m_dVscale << "</Vscale>" << endl;
29✔
937
        *dynaml_stream << "    <Pscale>" << m_dPscale << "</Pscale>" << endl;
29✔
938
        *dynaml_stream << "    <Lscale>" << m_dLscale << "</Lscale>" << endl;
29✔
939
        *dynaml_stream << "    <Hscale>" << m_dHscale << "</Hscale>" << endl;
29✔
940
        
941
        if (m_msr_db_map.is_cls_id_set)
29✔
942
                *dynaml_stream << "    <ClusterID>" << m_msr_db_map.cluster_id << "</ClusterID>" << endl;
9✔
943
        
944
        *dynaml_stream << "    <Coords>" << m_strCoordType << "</Coords>" << endl;
29✔
945
        *dynaml_stream << "    <Total>" << pntCount << "</Total>" << endl;
29✔
946
        
947
        // write GpsPoints
948
        vector<CDnaGpsPoint>::const_iterator _it_pnt;
29✔
949
        for (_it_pnt=m_vGpsPoints.begin(); _it_pnt!=m_vGpsPoints.end(); ++_it_pnt)
435✔
950
                _it_pnt->WriteDynaMLMsr(dynaml_stream, comment, true);
406✔
951
        
952
        *dynaml_stream << "  </DnaMeasurement>" << endl;
29✔
953
}
29✔
954

955
void CDnaGpsPointCluster::WriteDNAMsr(std::ofstream* dna_stream, const dna_msr_fields& dmw, 
22✔
956
                const dna_msr_fields& dml, bool) const
957
{
958
        // write GpsPoints
959
        vector<CDnaGpsPoint>::const_iterator _it_pnt;
22✔
960
        for (_it_pnt=m_vGpsPoints.begin(); _it_pnt!=m_vGpsPoints.end(); ++_it_pnt)
470✔
961
                _it_pnt->WriteDNAMsr(dna_stream, dmw, dml, true);
448✔
962
}
22✔
963

964
void CDnaGpsPointCluster::SimulateMsr(vdnaStnPtr* vStations, const CDnaEllipsoid* ellipsoid)
3✔
965
{
966
        vector<CDnaGpsPoint>::iterator _it_pnt = m_vGpsPoints.begin();
3✔
967
        for (_it_pnt=m_vGpsPoints.begin(); _it_pnt!=m_vGpsPoints.end(); ++_it_pnt)
6✔
968
                _it_pnt->SimulateMsr(vStations, ellipsoid);
3✔
969
}
3✔
970

971
void CDnaGpsPointCluster::PopulateMsr(pvstn_t bstRecords, uint32_uint32_map* blockStationsMap, vUINT32* blockStations,
12✔
972
                const UINT32& block, const CDnaDatum* datum, matrix_2d* estimates, matrix_2d* variances)
973
{
974
        m_strType = 'Y';
12✔
975
        m_bIgnore = false;
12✔
976
        SetCoordType(XYZ_type);
12✔
977

978
        m_lclusterID = block;
12✔
979
        m_MSmeasurementStations = ONE_STATION;
12✔
980
        m_lRecordedTotal = static_cast<UINT32>(blockStationsMap->size());
12✔
981
        m_vGpsPoints.clear();
12✔
982
        m_vGpsPoints.resize(m_lRecordedTotal);
12✔
983

984
        m_referenceFrame = datum->GetName();
12✔
985
        m_epoch = datum->GetEpoch_s();
12✔
986
        m_epsgCode =  datum->GetEpsgCode_s();
12✔
987

988
        m_dPscale = 1.0;
12✔
989
        m_dLscale = 1.0;
12✔
990
        m_dHscale = 1.0;
12✔
991
        m_dVscale = 1.0;
12✔
992

993
        vector<CDnaGpsPoint>::iterator _it_pnt = m_vGpsPoints.begin();
12✔
994
        for (UINT32 i(0); i<m_lRecordedTotal; ++i)
718✔
995
        {
996
                _it_pnt->SetClusterID(block);
706✔
997
                _it_pnt->SetTotal(static_cast<UINT32>(blockStations->size()));
706✔
998
                _it_pnt->PopulateMsr(bstRecords, blockStationsMap, blockStations,
706✔
999
                        i, datum, estimates, variances);
1000
                ++_it_pnt;
706✔
1001
        }
1002
}
12✔
1003
                
1004

1005
UINT32 CDnaGpsPointCluster::SetMeasurementRec(const vstn_t& binaryStn, it_vmsr_t& it_msr, it_vdbid_t& dbidmap)
13✔
1006
{
1007
        m_lclusterID = it_msr->clusterID;
13✔
1008
        m_MSmeasurementStations = (MEASUREMENT_STATIONS)it_msr->measurementStations;
13✔
1009
        m_lRecordedTotal = it_msr->vectorCount1;
13✔
1010
        m_vGpsPoints.clear();
13✔
1011
        m_vGpsPoints.resize(m_lRecordedTotal);
13✔
1012

1013
        m_referenceFrame = datumFromEpsgCode<string, UINT32>(LongFromString<UINT32>(it_msr->epsgCode));
13✔
1014
        m_epoch = it_msr->epoch;
13✔
1015
        m_epsgCode = it_msr->epsgCode;
13✔
1016

1017
        m_dPscale = it_msr->scale1;
13✔
1018
        m_dLscale = it_msr->scale2;
13✔
1019
        m_dHscale = it_msr->scale3;
13✔
1020
        m_dVscale = it_msr->scale4;
13✔
1021

1022
        UINT32 measrecordCount(it_msr->vectorCount1);
13✔
1023

1024
        // read remaining GpsPoint data and all Covariances from file
1025
        for (UINT32 i=0; i<m_lRecordedTotal; i++)
107✔
1026
        {
1027
                if (i > 0)
94✔
1028
                {
1029
                        it_msr++;
81✔
1030
                        dbidmap++;
81✔
1031
                }
1032

1033
                m_strType = it_msr->measType;
94✔
1034
                m_bIgnore = it_msr->ignore;
94✔
1035
                SetCoordType(it_msr->coordType);
94✔
1036
                
1037
                m_vGpsPoints.at(i).SetMeasurementRec(binaryStn, it_msr, dbidmap);
94✔
1038
        }
1039

1040
        return measrecordCount - 1;        
13✔
1041
}
1042
        
1043

1044
void CDnaGpsPointCluster::WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 msrIndex) const
53✔
1045
{
1046
        vector< CDnaGpsPoint >::const_iterator _it_pnt;
53✔
1047
        for (_it_pnt=m_vGpsPoints.begin(); _it_pnt!=m_vGpsPoints.end(); ++_it_pnt)
311✔
1048
                _it_pnt->WriteBinaryMsr(binary_stream, msrIndex);
258✔
1049

1050
        //for_each(m_vGpsPoints.begin(), m_vGpsPoints.end(),
1051
        //        [this, &binary_stream, &msrIndex] (CDnaGpsPoint p) {
1052
        //                p.WriteBinaryMsr(binary_stream, msrIndex); 
1053
        //});
1054
}
53✔
1055
        
1056

1057
void CDnaGpsPointCluster::SetEpsg(const string& epsg) 
176✔
1058
{
1059
        m_epsgCode = epsg;
176✔
1060
}
176✔
1061

1062

1063
void CDnaGpsPointCluster::SetReferenceFrame(const string& refFrame) 
89✔
1064
{
1065
        m_referenceFrame = refFrame;
89✔
1066
        SetEpsg(epsgStringFromName<string>(refFrame));
89✔
1067
}
89✔
1068

1069

1070
void CDnaGpsPointCluster::SetTotal(const string& str)
55✔
1071
{
1072
        m_lRecordedTotal = LongFromString<UINT32>(trimstr(str));
55✔
1073
        m_vGpsPoints.reserve(m_lRecordedTotal);
55✔
1074
}
55✔
1075

1076

1077
void CDnaGpsPointCluster::SetPscale(const string& str)
55✔
1078
{
1079
        DoubleFromString(m_dPscale, trimstr(str));
55✔
1080
}
55✔
1081

1082
void CDnaGpsPointCluster::SetLscale(const string& str)
55✔
1083
{
1084
        DoubleFromString(m_dLscale, trimstr(str));
55✔
1085
}
55✔
1086

1087
void CDnaGpsPointCluster::SetHscale(const string& str)
55✔
1088
{
1089
        DoubleFromString(m_dHscale, trimstr(str));
55✔
1090
}
55✔
1091

1092
void CDnaGpsPointCluster::SetVscale(const string& str)
55✔
1093
{
1094
        DoubleFromString(m_dVscale, trimstr(str));
55✔
1095
}
55✔
1096

1097

1098
}        // namespace measurements
1099
}        // namespace dynadjust
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc