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

icsm-au / DynAdjust / 13494567994

24 Feb 2025 09:15AM UTC coverage: 81.168% (+2.0%) from 79.161%
13494567994

push

github

web-flow
Merge pull request #234 from icsm-au/1.2.8

Version 1.2.8 (fixes, ehnacements, improved datum management)

6131 of 8137 new or added lines in 90 files covered. (75.35%)

162 existing lines in 33 files now uncovered.

32214 of 39688 relevant lines covered (81.17%)

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

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

63

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

67
}
3,982✔
68

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

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

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

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

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

101
        m_msr_db_map = p.m_msr_db_map;
412✔
102

103
        m_vPointCovariances = std::move(p.m_vPointCovariances);
412✔
104
}
412✔
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
                boost::iequals(m_referenceFrame, rhs.m_referenceFrame)
4✔
159
                );
2✔
160
}
161
        
162

163
bool CDnaGpsPoint::operator< (const CDnaGpsPoint& rhs) const
6✔
164
{
165
        if (m_strFirst == rhs.m_strFirst) {
6✔
166
                if (m_strType == rhs.m_strType) {
6✔
167
                        if (m_lRecordedTotal == rhs.m_lRecordedTotal) {
6✔
168
                                if (m_bIgnore == rhs.m_bIgnore) {
6✔
169
                                        if (m_epoch == rhs.m_epoch) {
6✔
170
                                                if (fabs(m_dX - rhs.m_dX) < PRECISION_1E4) {
6✔
171
                                                        if (fabs(m_dY - rhs.m_dY) < PRECISION_1E4) {
6✔
172
                                                                return m_dZ < rhs.m_dZ; }
6✔
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)
312✔
190
{
191
        m_vPointCovariances.reserve(size);
312✔
192
}
312✔
193

194

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

200

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

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

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

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

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

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

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

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

288
                *dna_stream << std::left << std::setw(dmw.msr_targ2) << m_lRecordedTotal;
23✔
289

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

303
                // print database ids
304
                if (m_msr_db_map.is_msr_id_set)
23✔
305
                        *dna_stream << std::setw(dmw.msr_id_msr) << m_msr_db_map.msr_id;
6✔
306
                if (m_msr_db_map.is_cls_id_set)
23✔
307
                        *dna_stream << std::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✔
NEW
313
                        *dna_stream << std::setw(dml.msr_id_msr - dml.msr_targ1) << " " <<
×
NEW
314
                                std::right << std::setw(dmw.msr_id_msr) << m_msr_db_map.msr_id;
×
315
                if (m_msr_db_map.is_cls_id_set)
426✔
NEW
316
                        *dna_stream << std::setw(dmw.msr_id_cluster) << m_msr_db_map.cluster_id;
×
317
        }
318

319
        *dna_stream << std::endl;
449✔
320

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

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

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

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

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

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

359
        // write GPSPoint covariances (not supported by DNA format)
360
        std::vector<CDnaCovariance>::const_iterator _it_cov = m_vPointCovariances.begin();
449✔
361
        for (_it_cov=m_vPointCovariances.begin(); _it_cov!=m_vPointCovariances.end(); ++_it_cov)
20,436✔
362
                _it_cov->WriteDNAMsr(dna_stream, dmw, dml);
19,987✔
363
}
449✔
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
        std::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);
1,412✔
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
        std::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)
102✔
469
{
470
        // first station
471
        m_lstn1Index = it_msr->station1;
102✔
472
        m_strFirst = binaryStn.at(it_msr->station1).stationName;
102✔
473
        
474
        m_dPscale = it_msr->scale1;
102✔
475
        m_dLscale = it_msr->scale2;
102✔
476
        m_dHscale = it_msr->scale3;
102✔
477
        m_dVscale = it_msr->scale4;
102✔
478

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

599

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

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

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

623

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

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

643
void CDnaGpsPoint::SetY(const std::string& str)
367✔
644
{
645
        if (m_ctType == LLH_type_i || m_ctType == LLh_type_i)
367✔
646
        {
647
                // longitude
648
                FromDmsString(&m_dY, trimstr(str));
166✔
649
                m_dY = Radians(m_dY);
166✔
650
        }
651
        else
652
                DoubleFromString(m_dY, trimstr(str));
402✔
653
}
367✔
654
        
655
void CDnaGpsPoint::SetZ(const std::string& str)
367✔
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));
367✔
660
}
367✔
661
        
662
void CDnaGpsPoint::SetSigmaXX(const std::string& str)
367✔
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)))
734✔
667
                throw XMLInteropException("SetSigmaXX(): Variances cannot be zero.", 0);
×
668
}
367✔
669

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

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

680
void CDnaGpsPoint::SetSigmaYY(const std::string& str)
367✔
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)))
734✔
685
                throw XMLInteropException("SetSigmaYY(): Variances cannot be zero.", 0);
×
686
}
367✔
687

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

693
void CDnaGpsPoint::SetSigmaZZ(const std::string& str)
367✔
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)))
734✔
698
                throw XMLInteropException("SetSigmaZZ(): Variances cannot be zero.", 0);
×
699
}
367✔
700

701

702

703

704

705

706

707

708

709

710

711

712

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

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

731

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

735
}
372✔
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 std::string& referenceframe, const std::string& epoch)
100✔
797
        : m_lRecordedTotal(0)
100✔
798
        , m_dPscale(1.)
100✔
799
        , m_dLscale(1.)
100✔
800
        , m_dHscale(1.)
100✔
801
        , m_dVscale(1.)
100✔
802
        , m_strCoordType("XYZ")
200✔
803
        , m_ctType(XYZ_type_i)
100✔
804
        , m_referenceFrame(referenceframe)
100✔
805
        , m_lclusterID(lclusterID)
100✔
806
{
807
        SetEpoch(epoch);
100✔
808
        SetEpsg(epsgStringFromName<std::string>(referenceframe));
100✔
809

810
        m_strType = "Y";
100✔
811
        m_MSmeasurementStations = ONE_STATION;        
100✔
812
}
100✔
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
3✔
832
{
833
        if (m_strFirst == rhs.m_strFirst) {
3✔
834
                if (m_strType == rhs.m_strType) {
3✔
835
                        if (m_bIgnore == rhs.m_bIgnore) {
3✔
836
                                if (m_epoch == rhs.m_epoch) {
3✔
837
                                        if (m_strCoordType == rhs.m_strCoordType) {
3✔
838
                                                if (m_lRecordedTotal == rhs.m_lRecordedTotal) 
3✔
839
                                                        return m_vGpsPoints < rhs.m_vGpsPoints;
3✔
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 std::string& sType) {
202✔
855
        m_strCoordType = trimstr(sType);
202✔
856
        m_ctType = GetMyCoordTypeC();
202✔
857
}
202✔
858
        
859

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

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

872
void CDnaGpsPointCluster::SerialiseDatabaseMap(std::ofstream* os)
87✔
873
{
874
        for_each(m_vGpsPoints.begin(), m_vGpsPoints.end(),
87✔
875
                [this, os](const CDnaGpsPoint& pnt) {
381✔
876
                        ((CDnaGpsPoint*)&pnt)->SerialiseDatabaseMap(os);
381✔
877
        });
878
}
87✔
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
87✔
896
{
897
        UINT32 recordCount(0);
87✔
898
        for_each(m_vGpsPoints.begin(), m_vGpsPoints.end(),
87✔
899
                [&recordCount](const CDnaGpsPoint& pnt) {
381✔
900
                        recordCount += pnt.CalcBinaryRecordCount();
381✔
901
        });
381✔
902
        return recordCount;
87✔
903
}
904
        
905

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

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

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

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

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

964
void CDnaGpsPointCluster::SimulateMsr(vdnaStnPtr* vStations, const CDnaEllipsoid* ellipsoid)
3✔
965
{
966
        std::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);
24✔
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
        std::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)
18✔
1006
{
1007
        m_lclusterID = it_msr->clusterID;
18✔
1008
        m_MSmeasurementStations = (MEASUREMENT_STATIONS)it_msr->measurementStations;
18✔
1009
        m_lRecordedTotal = it_msr->vectorCount1;
18✔
1010
        m_vGpsPoints.clear();
18✔
1011
        m_vGpsPoints.resize(m_lRecordedTotal);
18✔
1012

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

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

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

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

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

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

1044
void CDnaGpsPointCluster::WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 msrIndex) const
87✔
1045
{
1046
        std::vector< CDnaGpsPoint >::const_iterator _it_pnt;
87✔
1047
        for (_it_pnt=m_vGpsPoints.begin(); _it_pnt!=m_vGpsPoints.end(); ++_it_pnt)
468✔
1048
                _it_pnt->WriteBinaryMsr(binary_stream, msrIndex);
381✔
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
}
87✔
1055
        
1056

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

1062

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

1069

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

1076

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

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

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

1092
void CDnaGpsPointCluster::SetVscale(const std::string& str)
81✔
1093
{
1094
        DoubleFromString(m_dVscale, trimstr(str));
81✔
1095
}
81✔
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