• 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

95.16
/dynadjust/include/measurement_types/dnaheight.cpp
1
//============================================================================
2
// Name         : dnaheight.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  : CDnaHeight implementation file
21
//============================================================================
22

23
#include <include/measurement_types/dnaheight.hpp>
24

25
namespace dynadjust {
26
namespace measurements {
27

28
CDnaHeight::CDnaHeight(void)
3,947✔
29
        : m_dValue(0.)
3,947✔
30
        , m_dStdDev(0.)
3,947✔
31
{
32
        m_strType = "H";                // default is orthometric distance, but could also be 'R'
3,947✔
33
        m_MSmeasurementStations = ONE_STATION;
3,947✔
34
}
3,947✔
35

36

37
CDnaHeight::~CDnaHeight(void)
3,507✔
38
{
39

40
}
3,507✔
41
        
42

43
bool CDnaHeight::operator== (const CDnaHeight& rhs) const
17✔
44
{
45
        return (
17✔
46
                m_strFirst == rhs.m_strFirst &&
22✔
47
                m_strType == rhs.m_strType &&
5✔
48
                m_bIgnore == rhs.m_bIgnore &&
5✔
49
                m_dValue == rhs.m_dValue &&
5✔
50
                m_dStdDev == rhs.m_dStdDev &&
22✔
51
                m_epoch == rhs.m_epoch
4✔
52
                );
17✔
53
}
54

55
bool CDnaHeight::operator< (const CDnaHeight& rhs) const
82✔
56
{
57
        if (m_strFirst == rhs.m_strFirst) {
82✔
58
                if (m_strType == rhs.m_strType) {        // don't think this is needed
7✔
59
                        if (m_bIgnore == rhs.m_bIgnore) {
7✔
60
                                if (m_epoch == rhs.m_epoch) {
7✔
61
                                        if (m_dValue == rhs.m_dValue)
7✔
62
                                                return m_dStdDev < rhs.m_dStdDev; 
7✔
63
                                        else
64
                                                return m_dValue < rhs.m_dValue; }
×
65
                                else
66
                                        return m_epoch < rhs.m_epoch; }
×
67
                        else
68
                                return m_bIgnore < rhs.m_bIgnore; }
×
69
                else
70
                        return m_strType < rhs.m_strType; }
×
71
        else
72
                return m_strFirst < rhs.m_strFirst;
75✔
73
}
74
        
75

76
void CDnaHeight::WriteDynaMLMsr(std::ofstream* dynaml_stream, const std::string& comment, bool) const
55✔
77
{
78
        if (comment.empty())
55✔
79
                *dynaml_stream << "  <!-- Type " << measurement_name<char, std::string>(GetTypeC()) << " -->" << std::endl;
165✔
80
        else
NEW
81
                *dynaml_stream << "  <!-- " << comment << " -->" << std::endl;
×
82

83
        *dynaml_stream << "  <DnaMeasurement>" << std::endl;
55✔
84
        *dynaml_stream << "    <Type>" << m_strType << "</Type>" << std::endl;
55✔
85
        // Source file from which the measurement came
86
        *dynaml_stream << "    <Source>" << m_sourceFile << "</Source>" << std::endl;
55✔
87
        if (m_bIgnore)
55✔
88
                *dynaml_stream << "    <Ignore>*</Ignore>" << std::endl;
6✔
89
        else
90
                *dynaml_stream << "    <Ignore/>" << std::endl;
49✔
91
        
92
        if (m_epoch.empty())
55✔
93
                *dynaml_stream << "    <Epoch/>" << std::endl;
53✔
94
        else
95
                *dynaml_stream << "    <Epoch>" << m_epoch << "</Epoch>" << std::endl;
2✔
96

97
        *dynaml_stream << "    <First>" << m_strFirst << "</First>" << std::endl;
55✔
98
        *dynaml_stream << "    <Value>" << std::fixed << std::setprecision(4) << m_dValue << "</Value>" << std::endl;
55✔
99
        *dynaml_stream << "    <StdDev>" << std::scientific << std::setprecision(6) << m_dStdDev << "</StdDev>" << std::endl;
55✔
100
                
101
        if (m_msr_db_map.is_msr_id_set)
55✔
102
                *dynaml_stream << "    <MeasurementID>" << m_msr_db_map.msr_id << "</MeasurementID>" << std::endl;
52✔
103
        
104
        *dynaml_stream << "  </DnaMeasurement>" << std::endl;
55✔
105
}
55✔
106
        
107

108
void CDnaHeight::WriteDNAMsr(std::ofstream* dna_stream, const dna_msr_fields& dmw, const dna_msr_fields& dml, bool) const
15✔
109
{
110
        *dna_stream << std::setw(dmw.msr_type) << m_strType;
15✔
111
        if (m_bIgnore)
15✔
NEW
112
                *dna_stream << std::setw(dmw.msr_ignore) << "*";
×
113
        else
114
                *dna_stream << std::setw(dmw.msr_ignore) << " ";
15✔
115

116
        *dna_stream << std::left << std::setw(dmw.msr_inst) << m_strFirst;
15✔
117
        *dna_stream << std::setw(dmw.msr_targ1) << " ";
15✔
118
        *dna_stream << std::setw(dmw.msr_targ2) << " ";
15✔
119
        *dna_stream << std::right << std::setw(dmw.msr_linear) << std::fixed << std::setprecision(4) << m_dValue;        // linear measurement value
15✔
120
        *dna_stream << std::setw(dmw.msr_ang_d + dmw.msr_ang_m + dmw.msr_ang_s) << " ";
15✔
121
        
122
        UINT32 m_stdDevPrec(3);        // note change from 6 decimal places to 3
15✔
123
        *dna_stream << std::setw(dmw.msr_stddev) << StringFromTW(m_dStdDev, dmw.msr_stddev, m_stdDevPrec);
30✔
124
        //*dna_stream << std::setw(dmw.msr_stddev) << std::fixed << std::setprecision(6) << m_dStdDev;
125

126
        *dna_stream << std::setw(dml.msr_gps_epoch - dml.msr_inst_ht) << " ";
15✔
127
        *dna_stream << std::setw(dmw.msr_gps_epoch) << m_epoch;
15✔
128

129
        if (m_msr_db_map.is_msr_id_set)
15✔
130
                *dna_stream << std::setw(dmw.msr_id_msr) << m_msr_db_map.msr_id;
12✔
131

132
        *dna_stream << std::endl;
15✔
133
}
15✔
134
        
135

136
void CDnaHeight::SimulateMsr(vdnaStnPtr* vStations, const CDnaEllipsoid* ellipsoid)
2✔
137
{
138
        // Zn is the z coordinate element of the point on the z-axis 
139
        // which intersects with the the normal at the given Latitude
140
        double nu1, Zn1;
2✔
141

142
        // calculated height
143
        m_dValue = EllipsoidHeight<double>(
2✔
144
                vStations->at(m_lstn1Index).get()->GetXAxis(), 
2✔
145
                vStations->at(m_lstn1Index).get()->GetYAxis(),
2✔
146
                vStations->at(m_lstn1Index).get()->GetZAxis(),
2✔
147
                vStations->at(m_lstn1Index).get()->GetcurrentLatitude(),
2✔
148
                &nu1, &Zn1, ellipsoid);        
149

150
        m_dStdDev = 0.024;
2✔
151

152
        switch (GetTypeC())
2✔
153
        {
154
        case 'H':
1✔
155
                // N value available?
156
                if (fabs(vStations->at(m_lstn1Index).get()->GetgeoidSep()) > PRECISION_1E4)
1✔
157
                {
158
                        // reduce to orthometric height
159
                        m_preAdjCorr = vStations->at(m_lstn1Index).get()->GetgeoidSep();
1✔
160
                        m_dValue -= m_preAdjCorr;
1✔
161
                }
162
                break;
163
        }
164

165
        m_epoch = "01.10.1985";
2✔
166
}
2✔
167
        
168

169
UINT32 CDnaHeight::SetMeasurementRec(const vstn_t& binaryStn, it_vmsr_t& it_msr, it_vdbid_t& dbidmap)
19✔
170
{
171
        m_strType = it_msr->measType;
19✔
172
        m_bIgnore = it_msr->ignore;
19✔
173
        m_MSmeasurementStations = (MEASUREMENT_STATIONS)it_msr->measurementStations;
19✔
174
        
175
        m_lstn1Index = it_msr->station1;
19✔
176
        m_strFirst = binaryStn.at(it_msr->station1).stationName;
19✔
177
        
178
        m_measAdj = it_msr->measAdj;
19✔
179
        m_measCorr = it_msr->measCorr;
19✔
180
        m_measAdjPrec = it_msr->measAdjPrec;
19✔
181
        m_residualPrec = it_msr->residualPrec;
19✔
182
        m_preAdjCorr = it_msr->preAdjCorr;
19✔
183
        m_dValue = it_msr->term1;
19✔
184
        m_dStdDev = sqrt(it_msr->term2);
19✔
185

186
        m_epoch = it_msr->epoch;
19✔
187

188
        CDnaMeasurement::SetDatabaseMap(*dbidmap);
19✔
189

190
        return 0;
19✔
191
}
192
        
193

194
void CDnaHeight::WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 msrIndex) const
227✔
195
{
196
        measurement_t measRecord;
227✔
197
        measRecord.measType = GetTypeC();
227✔
198
        measRecord.measStart = xMeas;
227✔
199
        measRecord.ignore = m_bIgnore;
227✔
200
        measRecord.station1 = m_lstn1Index;
227✔
201
        measRecord.measAdj = m_measAdj;
227✔
202
        measRecord.measCorr = m_measCorr;
227✔
203
        measRecord.measAdjPrec = m_measAdjPrec;
227✔
204
        measRecord.residualPrec = m_residualPrec;
227✔
205
        measRecord.preAdjCorr = m_preAdjCorr;
227✔
206
        measRecord.term1 = m_dValue;
227✔
207
        measRecord.term2 = m_dStdDev * m_dStdDev;        // convert to variance
227✔
208
        measRecord.term3 = 0.;
227✔
209
        measRecord.term4 = 0.;
227✔
210
        measRecord.measurementStations = m_MSmeasurementStations;
227✔
211
        measRecord.fileOrder = ((*msrIndex)++);
227✔
212

213
        sprintf(measRecord.epoch, "%s", m_epoch.substr(0, STN_EPOCH_WIDTH).c_str());
227✔
214

215
        binary_stream->write(reinterpret_cast<char *>(&measRecord), sizeof(measurement_t));
227✔
216
}
227✔
217

218

219
void CDnaHeight::SetValue(const std::string& str)
241✔
220
{
221
        DoubleFromString(m_dValue, trimstr(str));
241✔
222
}
241✔
223

224
void CDnaHeight::SetStdDev(const std::string& str)
241✔
225
{
226
        DoubleFromString(m_dStdDev, trimstr(str));
241✔
227
}
241✔
228

229

230
}        // namespace measurements
231
}        // 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