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

icsm-au / DynAdjust / 4558854622

pending completion
4558854622

push

github

GitHub
Merge pull request #213 from icsm-au/1.2.7

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

30192 of 38394 relevant lines covered (78.64%)

3682.47 hits per line

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

72.73
/dynadjust/include/config/dnaprojectfile.cpp
1
//============================================================================
2
// Name         : dnaprojectfile.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  : DynAdjust Project class
21
//============================================================================
22

23
#include <include/config/dnatypes-gui.hpp>
24
#include <include/config/dnaprojectfile.hpp>
25
#include <include/functions/dnaiostreamfuncs.hpp>
26
#include <include/functions/dnatemplatefuncs.hpp>
27
#include <include/functions/dnastringfuncs.hpp>
28
#include <include/functions/dnafilepathfuncs.hpp>
29
#include <include/config/dnaoptions-helper.hpp>
30

31
namespace dynadjust {
32

33
CDnaProjectFile::CDnaProjectFile(void)
113✔
34
{
35
        
36
}
113✔
37

38
// Create instance and initialise settings based on context
39
CDnaProjectFile::CDnaProjectFile(const string& projectFile, const UINT16& verifyContext)
73✔
40
{
41
        LoadProjectFile(projectFile);
73✔
42

43
        switch (verifyContext)
73✔
44
        {
45
        case importSetting:
24✔
46
                InitialiseImportSettings();
24✔
47
                break;
48
        case reftranSetting:
24✔
49
                InitialiseReftranSettings();
24✔
50
                break;
51
        case geoidSetting:
23✔
52
                InitialiseGeoidSettings();
23✔
53
                break;
54
        case segmentSetting:
1✔
55
                InitialiseSegmentSettings();
1✔
56
                break;
57
        case adjustSetting:
1✔
58
                InitialiseAdjustSettings();
1✔
59
                break;
60
        default:
×
61
                InitialiseGeneralSettings();
×
62
        }
63
}
73✔
64

65

66
//CDnaProjectFile::CDnaProjectFile(const project_settings& project)
67
//        : settings_(project)
68
//{
69
//}
70

71
//CDnaProjectFile::CDnaProjectFile(const CDnaProjectFile& newProject)
72
//        : settings_(newProject.settings_)
73
//{        
74
//}
75

76
//CDnaProjectFile& CDnaProjectFile::operator=(const CDnaProjectFile& rhs)
77
//{
78
//        if (this == &rhs)        // check for assignment to self!
79
//                return *this;
80
//
81
//        settings_ = rhs.settings_;
82
//
83
//        return *this;
84
//}
85

86
//bool CDnaProjectFile::operator==(const CDnaProjectFile& rhs) const
87
//{
88
//        return (settings_ == rhs.settings_);
89
//}
90
        
91

92
void CDnaProjectFile::LoadProjectFile(const string& projectFile)
156✔
93
{
94
        // load project file
95
        if (exists(projectFile))
156✔
96
        {
97
                settings_.g.project_file = projectFile;
156✔
98
                LoadProjectFile();
156✔
99
        }
100
        else
101
        {
102
                stringstream err_msg;
×
103
                err_msg << "LoadProjectFile(): Project file " << 
×
104
                projectFile << " does not exist." << endl;        
×
105
                throw boost::enable_current_exception(runtime_error(err_msg.str()));
×
106
        }
×
107
}
156✔
108

109

110
void CDnaProjectFile::LoadProjectFile()
156✔
111
{
112
        // load project file using p.g.project_file
113
        std::ifstream dnaproj_file;
156✔
114

115
        stringstream err_msg;
156✔
116
        err_msg << "LoadProjectFile(): An error was encountered when opening " << 
156✔
117
                settings_.g.project_file << "." << endl;
156✔
118

119
        try {
156✔
120
                // create binary aml file.  Throws runtime_error on failure.
121
                file_opener(dnaproj_file, settings_.g.project_file,
156✔
122
                        ios::in, ascii, true);
123
        }
124
        catch (const runtime_error& e) {
×
125
                err_msg << e.what();
×
126
                throw boost::enable_current_exception(runtime_error(err_msg.str()));
×
127
        }
×
128
        catch (...) {
×
129
                throw boost::enable_current_exception(runtime_error(err_msg.str()));
×
130
        }
×
131

132
        err_msg.str("");
312✔
133
        err_msg << "LoadProjectFile(): An error was encountered when loading from " << 
156✔
134
                settings_.g.project_file << "." << endl;
156✔
135

136
        string str, line, var, val;
156✔
137
        stringstream ss;
156✔
138

139
        settingMode mSetting(unknownSetting);
140
        
141
        while (!dnaproj_file.eof())
20,942✔
142
        {
143
                try {
20,942✔
144
                        getline(dnaproj_file, line, '\n');
20,942✔
145
                }
146
                catch (std::ifstream::failure& f)
156✔
147
                {
148
                        if (dnaproj_file.eof())
156✔
149
                                break;
150
                        
151
                        err_msg << f.what() << endl;
×
152
                        throw boost::enable_current_exception(runtime_error(err_msg.str()));
×
153
                }
156✔
154
                catch (...)
×
155
                {
156
                        if (dnaproj_file.eof())
×
157
                                break;
158

159
                        err_msg << "Could not read file." << endl;
×
160
                        throw boost::enable_current_exception(runtime_error(err_msg.str()));
×
161
                }
×
162

163

164
                // Blank line?
165
                if (line.empty())
20,786✔
166
                        continue;
1,404✔
167

168
                // Line too short?
169
                if (line.length() <= PRINT_VAR_PAD)
19,382✔
170
                        continue;
×
171

172
                // #variables
173
                if (line.find(section_variables) != string::npos)
19,382✔
174
                {
175
                        mSetting = switchSetting;
×
176
                        continue;
×
177
                }
178

179
                // #general
180
                if (line.find(section_general) != string::npos)
19,382✔
181
                {
182
                        mSetting = generalSetting;
156✔
183
                        continue;
156✔
184
                }
185

186
                // #import
187
                if (line.find(section_import) != string::npos)
19,226✔
188
                {
189
                        mSetting = importSetting;
156✔
190
                        continue;
156✔
191
                }
192

193
                // #reftran
194
                if (line.find(section_reftran) != string::npos)
19,070✔
195
                {
196
                        mSetting = reftranSetting;
156✔
197
                        continue;
156✔
198
                }
199

200
                // #general
201
                if (line.find(section_geoid) != string::npos)
18,914✔
202
                {
203
                        mSetting = geoidSetting;
156✔
204
                        continue;
156✔
205
                }
206

207
                // #segment
208
                if (line.find(section_segment) != string::npos)
18,758✔
209
                {
210
                        mSetting = segmentSetting;
156✔
211
                        continue;
156✔
212
                }
213

214
                // #adjust
215
                if (line.find(section_adjust) != string::npos)
18,602✔
216
                {
217
                        mSetting = adjustSetting;
156✔
218
                        continue;
156✔
219
                }
220

221
                // #output
222
                if (line.find(section_output) != string::npos)
18,446✔
223
                {
224
                        mSetting = outputSetting;
156✔
225
                        continue;
156✔
226
                }
227

228
                // #plot
229
                if (line.find(section_plot) != string::npos)
18,290✔
230
                {
231
                        mSetting = plotSetting;
156✔
232
                        continue;
156✔
233
                }
234

235
                // #display
236
                if (line.find(section_display) != string::npos)
18,134✔
237
                {
238
                        mSetting = displaySetting;
×
239
                        continue;
×
240
                }
241
                
242
                // Line?
243
                if (line.find("----------") != string::npos)
18,134✔
244
                        continue;
1,248✔
245

246
                // Now get the variables and their value relating to the setting
247
                var = trimstr(line.substr(0, PRINT_VAR_PAD));
16,886✔
248
                if (line.length() > PRINT_VAR_PAD)
16,886✔
249
                        val = trimstr(line.substr(PRINT_VAR_PAD));
16,886✔
250
                else
251
                        val.clear();
×
252

253
                try {
16,886✔
254
                        switch (mSetting)
16,886✔
255
                        {
256
                        case generalSetting:
1,092✔
257
                                LoadSettingGeneral(mSetting, var, val);
1,092✔
258
                                break;
259
                        case importSetting:
5,810✔
260
                                LoadSettingImport(mSetting, var, val);
5,810✔
261
                                break;
262
                        case reftranSetting:
780✔
263
                                LoadSettingReftran(var, val);
780✔
264
                                break;
265
                        case geoidSetting:
780✔
266
                                LoadSettingGeoid(var, val);
780✔
267
                                break;
268
                        case segmentSetting:
936✔
269
                                LoadSettingSegment(var, val);
936✔
270
                                break;
271
                        case adjustSetting:
2,496✔
272
                                LoadSettingAdjust(var, val);
2,496✔
273
                                LoadSettingOutput(var, val);
2,496✔
274
                                break;
275
                        case outputSetting:
4,836✔
276
                                LoadSettingOutput(var, val);
4,836✔
277
                                break;
278
                        case plotSetting:
×
279
                                LoadSettingOutput(var, val);
×
280
                                break;
281
                        case displaySetting:
282
                                break;
283
                        default:
284
                                  break;
285
                        }
286
                }
287
                catch (const runtime_error& e) {
×
288
                        err_msg << e.what();
×
289
                        throw boost::enable_current_exception(runtime_error(err_msg.str()));
×
290
                }
×
291
                catch (...) {
×
292
                        throw boost::enable_current_exception(runtime_error(err_msg.str()));
×
293
                }
×
294
        }
295

296
        dnaproj_file.clear();
156✔
297
        dnaproj_file.close();
156✔
298
}
156✔
299

300
void CDnaProjectFile::InitialiseGeneralSettings()
73✔
301
{
302
        if (settings_.g.network_name.empty())
73✔
303
        {
304
                stringstream ss;
×
305
                ss << "The project file does not provide the network name. " << endl << endl;
×
306
                throw boost::enable_current_exception(runtime_error(ss.str()));
×
307
        }
×
308
}
73✔
309

310
void CDnaProjectFile::InitialiseImportSettings()
24✔
311
{
312
        InitialiseGeneralSettings();
24✔
313

314
        if (settings_.i.input_files.empty() && 
24✔
315
                settings_.i.seg_file.empty())
×
316
        {
317
                stringstream ss;
×
318
                ss << "Nothing to do - the project file does not list any files to import. " << endl << endl;
×
319
                throw boost::enable_current_exception(runtime_error(ss.str()));
×
320
        }
×
321

322
        string firstPart(settings_.g.output_folder + FOLDER_SLASH + settings_.g.network_name + ".");
48✔
323
        
324
        if (!settings_.i.bst_file.empty())
24✔
325
        {
326
                if (!exists(settings_.i.bst_file))
×
327
                        // Does the file exist?  No.  
328
                        // Assume it is a filename contained in the input folder.
329
                        // import will throw an exception if it cannot be found.
330
                        settings_.i.bst_file = formPath<string>(settings_.g.input_folder, 
×
331
                                leafStr<string>(settings_.i.bst_file));
×
332
        }
333
        else
334
                settings_.i.bst_file = firstPart + "bst";        // binary stations file
24✔
335

336
        if (!settings_.i.bms_file.empty())
24✔
337
        {
338
                if (!exists(settings_.i.bms_file))
×
339
                        // Does the file exist?  No.  
340
                        // Assume it is a filename contained in the input folder.
341
                        // import will throw an exception if it cannot be found.
342
                        settings_.i.bms_file = formPath<string>(settings_.g.input_folder, 
×
343
                                leafStr<string>(settings_.i.bms_file));
×
344
        }
345
        else
346
                settings_.i.bms_file = firstPart + "bms";        // binary measurements file
24✔
347

348
        settings_.i.asl_file = firstPart + "asl";        // associated stations list
24✔
349
        settings_.i.aml_file = firstPart + "aml";        // associated measurements list
24✔
350
        settings_.i.map_file = firstPart + "map";        // station names map
24✔
351
        settings_.i.dst_file = firstPart + "dst";        // fuplicate stations
24✔
352
        settings_.i.dms_file = firstPart + "dms";        // duplicate measurements
24✔
353
        settings_.i.imp_file = firstPart + "imp";        // log
24✔
354

355
        if (settings_.o._msr_to_stn == 1)
24✔
356
                settings_.o._m2s_file = firstPart + "m2s";        // measurement to stations table
3✔
357

358
        if (!settings_.i.seg_file.empty())
24✔
359
        {
360
                if (!exists(settings_.i.seg_file))
×
361
                        // Does the file exist?  No.  
362
                        // Assume it is a filename contained in the input folder.
363
                        // import will throw an exception if it cannot be found.
364
                        settings_.i.seg_file = formPath<string>(settings_.g.input_folder, 
×
365
                                leafStr<string>(settings_.i.seg_file));
×
366
        }
367

368
        //////////////////////////////////////////////////////////////////////////////
369
        // GNSS scaling
370
        if (fabs(settings_.i.pscale - 1.0) > PRECISION_1E5 ||
48✔
371
                fabs(settings_.i.lscale - 1.0) > PRECISION_1E5 ||
24✔
372
                fabs(settings_.i.hscale - 1.0) > PRECISION_1E5 ||
24✔
373
                fabs(settings_.i.vscale - 1.0) > PRECISION_1E5 ||
48✔
374
                !settings_.i.scalar_file.empty())
24✔
375
                settings_.i.apply_scaling = 1;
×
376
        
377
        if (!settings_.i.scalar_file.empty())
24✔
378
        {
379
                if (!exists(settings_.i.scalar_file))                        
×
380
                        // Does the file exist?  No.  
381
                        // Assume it is a filename contained in the input folder.
382
                        // import will throw an exception if it cannot be found.
383
                        settings_.i.scalar_file = formPath<string>(settings_.g.input_folder, 
×
384
                                leafStr<string>(settings_.i.scalar_file));        
×
385
        }
386

387
        // Create file name based on the provided block
388
        string fileName(settings_.g.network_name);
24✔
389
        if (settings_.i.import_block)
24✔
390
        {
391
                stringstream blk("");
×
392
                blk << ".block-" << settings_.i.import_block_number;
×
393
                fileName += blk.str();
×
394
        }
×
395

396
        if (settings_.i.export_dynaml)
24✔
397
        {
398
                if (settings_.i.export_single_xml_file)
8✔
399
                        settings_.i.xml_outfile = formPath<string>(settings_.g.output_folder, 
10✔
400
                                fileName, "xml");
5✔
401
                else
402
                {
403
                        settings_.i.xml_stnfile = formPath<string>(settings_.g.output_folder, 
9✔
404
                                fileName + "stn", "xml");
9✔
405
                        settings_.i.xml_msrfile = formPath<string>(settings_.g.output_folder, 
12✔
406
                                fileName + "msr", "xml");
9✔
407
                }
408
        }
409

410
        if (settings_.i.export_dna_files)
24✔
411
        {
412
                settings_.i.dna_stnfile = formPath<string>(settings_.g.output_folder, 
16✔
413
                        fileName, "stn");
8✔
414
                settings_.i.dna_msrfile = formPath<string>(settings_.g.output_folder, 
16✔
415
                        fileName, "msr");                
8✔
416
        }
417

418
        if (settings_.i.simulate_measurements)
24✔
419
                settings_.i.simulate_msrfile = formPath<string>(settings_.g.output_folder, 
×
420
                        settings_.g.network_name, "simulated.msr");
×
421

422
}
24✔
423

424
void CDnaProjectFile::InitialiseReftranSettings()
24✔
425
{
426
        InitialiseGeneralSettings();
24✔
427

428
        if (settings_.r.reference_frame.empty())
24✔
429
        {
430
                stringstream ss;
×
431
                ss << "Nothing to do - the project file does not specify a reference frame." << endl << endl;
×
432
                throw boost::enable_current_exception(runtime_error(ss.str()));
×
433
        }
×
434

435
        string firstPart(settings_.g.output_folder + FOLDER_SLASH + settings_.g.network_name + ".");
48✔
436
        settings_.r.bst_file = firstPart + "bst";        // binary stations file
24✔
437
        settings_.r.bms_file = firstPart + "bms";        // binary measurements file
24✔
438
        settings_.r.rft_file = firstPart + "rft";        // log
24✔
439

440
        if (settings_.i.export_dynaml == 1)
24✔
441
        {
442
                if (settings_.i.export_single_xml_file == 1)
8✔
443
                        settings_.i.xml_outfile = firstPart + "xml";                // single XML file
5✔
444
                else
445
                {
446
                        settings_.i.xml_stnfile = formPath<string>(settings_.g.output_folder,
9✔
447
                                settings_.g.network_name + "stn", "xml");
9✔
448
                        settings_.i.xml_msrfile = formPath<string>(settings_.g.output_folder,
12✔
449
                                settings_.g.network_name + "msr", "xml");;
9✔
450
                }
451
        }
452

453
        if (settings_.i.export_dna_files == 1)
24✔
454
        {
455
                settings_.i.dna_stnfile = firstPart + "stn";        // station file
8✔
456
                settings_.i.dna_msrfile = firstPart + "msr";        // measurement file
8✔
457
        }
458
        
459
        if (settings_.o._export_snx_file == 1)
24✔
460
                settings_.o._snx_file = firstPart + "snx";                // SINEX file
×
461

462
}
24✔
463

464
void CDnaProjectFile::InitialiseGeoidSettings()
23✔
465
{
466
        InitialiseGeneralSettings();
23✔
467

468
        // Expected behaviour: when running geoid using a project file, network name must exist
469
        if (settings_.g.network_name.empty())
23✔
470
        {
471
                stringstream ss;
×
472
                ss << "Nothing to do - the project file does not provide a network name. " << endl << endl;
×
473
                throw boost::enable_current_exception(runtime_error(ss.str()));
×
474
        }
×
475
        
476
        settings_.n.bst_file = formPath<string>(settings_.g.input_folder, settings_.g.network_name, "bst");                // binary stations file
23✔
477
        settings_.n.geo_file = formPath<string>(settings_.g.output_folder, settings_.g.network_name, "geo");        // dna geo file
23✔
478
        settings_.n.file_mode = 1;
23✔
479

480
        if (settings_.n.ntv2_geoid_file.empty())
23✔
481
        {
482
                stringstream ss;
17✔
483
                ss << "Nothing to do - the project file does not provide an NTv2 grid file path. " << endl << endl;
17✔
484
                throw boost::enable_current_exception(runtime_error(ss.str()));
34✔
485
        }
17✔
486
}
6✔
487

488
void CDnaProjectFile::InitialiseSegmentSettings()
1✔
489
{
490
        InitialiseGeneralSettings();
1✔
491

492
        string firstPart(settings_.g.output_folder + FOLDER_SLASH + settings_.g.network_name + ".");
2✔
493
        settings_.s.bst_file = firstPart + "bst";        // binary stations file
1✔
494
        settings_.s.bms_file = firstPart + "bms";        // binary measurements file
1✔
495
        settings_.s.asl_file = firstPart + "asl";        // associated stations list
1✔
496
        settings_.s.aml_file = firstPart + "aml";        // associated measurements list
1✔
497
        settings_.s.map_file = firstPart + "map";        // station names map
1✔
498
        settings_.s.seg_file = firstPart + "seg";        // segmentation file
1✔
499
        settings_.s.sap_file = firstPart + "sap";        // station appearance file
1✔
500
}
1✔
501

502
void CDnaProjectFile::InitialiseAdjustSettings()
1✔
503
{
504
        InitialiseGeneralSettings();
1✔
505

506
        string firstPart(settings_.g.output_folder + FOLDER_SLASH + settings_.g.network_name + ".");
2✔
507
        settings_.a.bst_file = firstPart + "bst";        // binary stations file
1✔
508
        settings_.a.bms_file = firstPart + "bms";        // binary measurements file
1✔
509

510
        if (!exists(settings_.a.bst_file) || !exists(settings_.a.bms_file))
2✔
511
        {
512
                stringstream ss;
×
513
                ss << "- Nothing to do: ";  
×
514
                        
515
                if (settings_.g.network_name.empty())
×
516
                        ss << endl << "network name has not been specified specified, and " << endl << "               ";  
×
517
                ss << settings_.a.bst_file << " and " << settings_.a.bms_file << " do not exist." << endl << endl;  
×
518
                throw boost::enable_current_exception(runtime_error(ss.str()));
×
519
        }
×
520
        
521
        // Station appearance file
522
        settings_.a.seg_file = firstPart + "seg";        // segmentation file
1✔
523
        settings_.s.sap_file = firstPart + "sap";        // station appearance file
1✔
524
        settings_.s.asl_file = firstPart + "asl";        // associated stations list
1✔
525
        settings_.s.aml_file = firstPart + "aml";        // associated measurements list
1✔
526
        settings_.a.map_file = firstPart + "map";        // station names map
1✔
527

528
        // Set up file names dependent on adjustment mode
529
        settings_.o._xyz_file = settings_.o._adj_file = 
1✔
530
                formPath<string>(settings_.g.output_folder, settings_.g.network_name);
2✔
531

532
        if (settings_.o._positional_uncertainty)
1✔
533
                settings_.o._apu_file = settings_.o._adj_file;
×
534

535
        if (settings_.o._init_stn_corrections)
1✔
536
                settings_.o._cor_file = settings_.o._adj_file;
×
537

538
        switch (settings_.a.adjust_mode)
1✔
539
        {
540
        case Phased_Block_1Mode:
×
541
        case PhasedMode:
×
542

543
                settings_.o._adj_file += ".phased";
×
544
                settings_.o._xyz_file += ".phased";
×
545

546
                if (settings_.o._positional_uncertainty)
×
547
                        settings_.o._apu_file += ".phased";
×
548

549
                if (settings_.o._init_stn_corrections)
×
550
                        settings_.o._cor_file += ".phased";
×
551
                
552
                if (settings_.a.adjust_mode == Phased_Block_1Mode)
×
553
                {
554
                        settings_.o._adj_file += "-block1";
×
555
                        settings_.o._xyz_file += "-block1";
×
556
                        
557
                        if (settings_.o._positional_uncertainty)
×
558
                                settings_.o._apu_file += "-block1";
×
559

560
                        if (settings_.o._init_stn_corrections)
×
561
                                settings_.o._cor_file += "-block1";
×
562

563
                }
564
                else if (settings_.a.stage)
×
565
                {
566
                        settings_.o._adj_file += "-stage";
×
567
                        settings_.o._xyz_file += "-stage";
×
568

569
                        if (settings_.o._positional_uncertainty)
×
570
                                settings_.o._apu_file += "-stage";
×
571

572
                        if (settings_.o._init_stn_corrections)
×
573
                                settings_.o._cor_file += "-stage";
×
574

575
                }
576
#ifdef MULTI_THREAD_ADJUST
577
                else if (settings_.a.multi_thread)
×
578
                {
579
                        settings_.o._adj_file += "-mt";
×
580
                        settings_.o._xyz_file += "-mt";
×
581
                        
582
                        if (settings_.o._positional_uncertainty)
×
583
                                settings_.o._apu_file += "-mt";
×
584

585
                        if (settings_.o._init_stn_corrections)
×
586
                                settings_.o._cor_file += "-mt";
×
587
                }
588
#endif
589
                break;
590
        case SimultaneousMode:
1✔
591
                settings_.o._adj_file += ".simult";
1✔
592
                settings_.o._xyz_file += ".simult";
1✔
593
                
594
                if (settings_.o._positional_uncertainty)
1✔
595
                        settings_.o._apu_file += ".simult";
×
596
                if (settings_.o._init_stn_corrections)
1✔
597
                        settings_.o._cor_file += ".simult";
×
598
                break;
599
        }
600

601
        settings_.o._adj_file += ".adj";
1✔
602
        settings_.o._xyz_file += ".xyz";
1✔
603

604
        if (settings_.o._positional_uncertainty)
1✔
605
                settings_.o._apu_file += ".apu";
×
606

607
        if (settings_.o._init_stn_corrections)
1✔
608
                settings_.o._cor_file += ".cor";
×
609

610
        if (settings_.a.fixed_std_dev < 0.)
1✔
611
                settings_.a.fixed_std_dev = PRECISION_1E6;
×
612
        else if (settings_.a.fixed_std_dev < PRECISION_1E10)
1✔
613
                settings_.a.fixed_std_dev = PRECISION_1E6;
×
614

615
        if (settings_.a.free_std_dev < 0.)
1✔
616
                settings_.a.free_std_dev = 10.0;
×
617
        else if (settings_.a.free_std_dev < PRECISION_1E10)
1✔
618
                settings_.a.free_std_dev = 10.0;
×
619

620
}
1✔
621

622
void CDnaProjectFile::LoadSettingGeneral(const settingMode mSetting, const string& var, string& val)
1,092✔
623
{
624
        // general settings
625
        if (iequals(var, QUIET))
1,092✔
626
        {
627
                if (val.empty())
156✔
628
                        return;                        
629
                settings_.g.quiet = yesno_uint<UINT16, string>(val);
156✔
630
        }
631
        else if (iequals(var, VERBOSE))
936✔
632
        {
633
                if (val.empty())
156✔
634
                        return;
635
                settings_.g.verbose = lexical_cast<UINT16, string>(val);
156✔
636
        }
637
        else if (iequals(var, PROJECT_FILE))
780✔
638
        {
639
                if (val.empty())
156✔
640
                        return;                        
641
                settings_.g.project_file = val;
156✔
642
        }
643
        else if (iequals(var, DYNADJUST_LOG_FILE))
624✔
644
        {
645
                if (val.empty())
156✔
646
                        return;                        
647
                settings_.g.log_file = val;
156✔
648
        }
649
        else if (iequals(var, NETWORK_NAME))
468✔
650
        {
651
                if (val.empty())
156✔
652
                        return;
×
653
                string_string_pair t;
156✔
654
                switch (mSetting)
156✔
655
                {
656
                case switchSetting:
×
657
                        t.first = var.c_str();
×
658
                        t.second = val.substr(0,4).c_str();
×
659
                        t.second = trimstr(t.second);
×
660
                        if (t.second.substr(0,2) == "${" && t.second.at(3) == '}')
×
661
                        {
662
                                settings_.g.variables.push_back(t);
×
663
                                sort(settings_.g.variables.begin(), settings_.g.variables.end(), PairCompareFirst<string, string>());
×
664
                        }
665
                        break;
666
                case generalSetting:
156✔
667
                        settings_.g.network_name = val;
312✔
668
                        break;
669
                default:
670
                          break;
671
                }                        
672
        }
156✔
673
        else if (iequals(var, INPUT_FOLDER))
312✔
674
        {
675
                if (val.empty())
156✔
676
                        return;                        
677
                settings_.g.input_folder = val;
156✔
678
        }
679
        else if (iequals(var, OUTPUT_FOLDER))
156✔
680
        {
681
                if (val.empty())
156✔
682
                        return;                        
683
                settings_.g.output_folder = val;
1,248✔
684
        }
685
                
686
}
687
        
688
void CDnaProjectFile::LoadSettingImport(const settingMode mSetting, const string& var, string& val)
5,810✔
689
{
690
        // Import settings
691
        if (iequals(var, IMPORT_FILE))
5,810✔
692
        {
693
                if (val.empty())
350✔
694
                        return;                        
695
                settings_.i.input_files.push_back(formPath<string>(settings_.g.input_folder, val));
700✔
696
        }
697
        else if (iequals(var, REFERENCE_FRAME))
5,460✔
698
        {
699
                if (val.empty())
156✔
700
                        return;
701
                settings_.i.reference_frame = val;
156✔
702
        }
703
        else if (iequals(var, OVERRIDE_INPUT_FRAME))
5,304✔
704
        {
705
                if (val.empty())
156✔
706
                        return;
707
                settings_.i.override_input_rfame = yesno_uint<UINT16, string>(val);;
156✔
708
        }
709
        else if (iequals(var, IMPORT_GEO_FILE))
5,148✔
710
        {
711
                if (val.empty())
156✔
712
                        return;
713
                settings_.i.geo_file = formPath<string>(settings_.g.input_folder, val);
1✔
714
                settings_.i.import_geo_file = 1;
1✔
715
        }
716
        else if (iequals(var, BIN_STN_FILE))
4,992✔
717
        {
718
                string_string_pair t;
×
719
                switch (mSetting)
×
720
                {
721
                case switchSetting:
×
722
                        if (val.empty())
×
723
                                return;
×
724
                        t.first = var.c_str();
×
725
                        t.second = val.substr(0,4).c_str();
×
726
                        t.second = trimstr(t.second);
×
727
                        if (t.second.substr(0,2) == "${" && t.second.at(3) == '}')
×
728
                        {
729
                                settings_.g.variables.push_back(t);
×
730
                                sort(settings_.g.variables.begin(), settings_.g.variables.end(), PairCompareFirst<string, string>());
×
731
                        }
732
                        break;
733
                case importSetting:
×
734
                        if (val.empty())
×
735
                                // default export bst file - create in output folder
736
                                settings_.i.bst_file = formPath<string>(settings_.g.output_folder, settings_.g.network_name, "bst");        // binary stations file
×
737
                        else
738
                                // user specified bst file - look in input folder
739
                                settings_.i.bst_file = formPath<string>(settings_.g.input_folder, val);
×
740
                        break;
741
                default:
742
                          break;
743
                }
744
        }
×
745
        else if (iequals(var, BIN_MSR_FILE))
4,992✔
746
        {
747
                string_string_pair t;
×
748
                switch (mSetting)
×
749
                {
750
                case switchSetting:
×
751
                        if (val.empty())
×
752
                                return;
×
753
                        t.first = var.c_str();
×
754
                        t.second = val.substr(0,4).c_str();
×
755
                        t.second = trimstr(t.second);
×
756
                        if (t.second.substr(0,2) == "${" && t.second.at(3) == '}')
×
757
                        {
758
                                settings_.g.variables.push_back(t);
×
759
                                sort(settings_.g.variables.begin(), settings_.g.variables.end(), PairCompareFirst<string, string>());
×
760
                        }
761
                        break;
762
                case importSetting:
×
763
                        if (val.empty())
×
764
                                settings_.i.bms_file = formPath<string>(settings_.g.output_folder, settings_.g.network_name, "bms");        // binary stations file
×
765
                        else
766
                                settings_.i.bms_file = formPath<string>(settings_.g.input_folder, val);
×
767
                        break;
768
                default:
769
                          break;
770
                }
771
        }
×
772
        else if (iequals(var, MAP_FILE))
4,992✔
773
        {
774
                if (val.empty())
×
775
                        return;
×
776
                string_string_pair t;
×
777
                switch (mSetting)
×
778
                {
779
                case switchSetting:
×
780
                        t.first = var.c_str();
×
781
                        t.second = val.substr(0,4).c_str();
×
782
                        t.second = trimstr(t.second);
×
783
                        if (t.second.substr(0,2) == "${" && t.second.at(3) == '}')
×
784
                        {
785
                                settings_.g.variables.push_back(t);
×
786
                                sort(settings_.g.variables.begin(), settings_.g.variables.end(), PairCompareFirst<string, string>());
×
787
                        }
788
                        break;
789
                case importSetting:
×
790
                        settings_.i.map_file = formPath<string>(settings_.g.output_folder, val);
×
791
                        break;
×
792
                default:
793
                          break;
794
                }                        
795
        }
×
796
        else if (iequals(var, ASL_FILE))
4,992✔
797
        {
798
                if (val.empty())
×
799
                        return;
×
800
                string_string_pair t;
×
801
                switch (mSetting)
×
802
                {
803
                case switchSetting:
×
804
                        t.first = var.c_str();
×
805
                        t.second = val.substr(0,4).c_str();
×
806
                        t.second = trimstr(t.second);
×
807
                        if (t.second.substr(0,2) == "${" && t.second.at(3) == '}')
×
808
                        {
809
                                settings_.g.variables.push_back(t);
×
810
                                sort(settings_.g.variables.begin(), settings_.g.variables.end(), PairCompareFirst<string, string>());
×
811
                        }
812
                        break;
813
                case importSetting:
×
814
                        settings_.i.asl_file = formPath<string>(settings_.g.output_folder, val);
×
815
                        break;
×
816
                default:
817
                          break;
818
                }
819
        }
×
820
        else if (iequals(var, AML_FILE))
4,992✔
821
        {
822
                if (val.empty())
×
823
                        return;
×
824
                string_string_pair t;
×
825
                switch (mSetting)
×
826
                {
827
                case switchSetting:
×
828
                        t.first = var.c_str();
×
829
                        t.second = val.substr(0,4).c_str();
×
830
                        t.second = trimstr(t.second);
×
831
                        if (t.second.substr(0,2) == "${" && t.second.at(3) == '}')
×
832
                        {
833
                                settings_.g.variables.push_back(t);
×
834
                                sort(settings_.g.variables.begin(), settings_.g.variables.end(), PairCompareFirst<string, string>());
×
835
                        }
836
                        break;
837
                case importSetting:
×
838
                        settings_.i.aml_file = formPath<string>(settings_.g.output_folder, val);
×
839
                        break;
×
840
                default:
841
                          break;
842
                }
843
        }
×
844
        else if (iequals(var, DST_FILE))
4,992✔
845
        {
846
                if (val.empty())
×
847
                        return;
848
                settings_.i.dst_file = formPath<string>(settings_.g.output_folder, val);
×
849
        }
850
        else if (iequals(var, DMS_FILE))
4,992✔
851
        {
852
                if (val.empty())
×
853
                        return;
854
                settings_.i.dms_file = formPath<string>(settings_.g.output_folder, val);
×
855
        }
856
        else if (iequals(var, BOUNDING_BOX))
4,992✔
857
        {
858
                if (val.empty())
156✔
859
                        return;
860
                settings_.i.bounding_box = val;
1✔
861
        }
862
        else if (iequals(var, GET_MSRS_TRANSCENDING_BOX))
4,836✔
863
        {
864
                if (val.empty())
156✔
865
                        return;
866
                settings_.i.include_transcending_msrs = yesno_uint<UINT16, string>(val);
156✔
867
        }
868
        else if (iequals(var, INCLUDE_STN_ASSOC_MSRS))
4,680✔
869
        {
870
                if (val.empty())
156✔
871
                        return;
872
                settings_.i.stn_associated_msr_include = valorno_string<string>(val);
156✔
873
        }
874
        else if (iequals(var, EXCLUDE_STN_ASSOC_MSRS))
4,524✔
875
        {
876
                if (val.empty())
156✔
877
                        return;
878
                settings_.i.stn_associated_msr_exclude = valorno_string<string>(val);
156✔
879
        }
880
        else if (iequals(var, SPLIT_CLUSTERS))
4,368✔
881
        {
882
                if (val.empty())
156✔
883
                        return;
884
                settings_.i.split_clusters = yesno_uint<UINT16, string>(val);
156✔
885
        }
886
        else if (iequals(var, IMPORT_SEG_BLOCK))
4,212✔
887
        {
888
                if (val.empty())
156✔
889
                        return;
890
                settings_.i.import_block_number = valorno_uint<UINT16, string>(val, settings_.i.import_block);
156✔
891
        }
892
        else if (iequals(var, SEG_FILE))
4,056✔
893
        {
894
                if (val.empty())
156✔
895
                        return;
896
                settings_.i.seg_file = formPath<string>(settings_.g.input_folder, val);
×
897
        }
898
        else if (iequals(var, PREFER_X_MSR_AS_G))
3,900✔
899
        {
900
                if (val.empty())
156✔
901
                        return;
902
                settings_.i.prefer_single_x_as_g = yesno_uint<UINT16, string>(val);
156✔
903
        }
904
        else if (iequals(var, INCLUDE_MSRS))
3,744✔
905
        {
906
                if (val.empty())
156✔
907
                        return;
908
                settings_.i.include_msrs = val;
1✔
909
        }
910
        else if (iequals(var, EXCLUDE_MSRS))
3,588✔
911
        {
912
                if (val.empty())
156✔
913
                        return;
914
                settings_.i.exclude_msrs = val;
5,811✔
915
        }
916
        else if (iequals(var, STATION_RENAMING_FILE))
3,432✔
917
        {
918
                if (val.empty())
156✔
919
                        return;
920
                settings_.i.stn_renamingfile = formPath<string>(settings_.g.input_folder, val);
1✔
921
        }
922
        else if (iequals(var, STATION_DISCONTINUITY_FILE))
3,276✔
923
        {
924
                if (val.empty())
156✔
925
                        return;
926
                settings_.i.stn_discontinuityfile = formPath<string>(settings_.g.input_folder, val);
6✔
927
                settings_.i.apply_discontinuities = true;
6✔
928
        }
929
        else if (iequals(var, TEST_NEARBY_STNS))
3,120✔
930
        {
931
                if (val.empty())
156✔
932
                        return;
933
                settings_.i.search_nearby_stn = yesno_uint<UINT16, string>(val);
156✔
934
        }
935
        else if (iequals(var, TEST_NEARBY_STN_DIST))
2,964✔
936
        {
937
                if (val.empty())
156✔
938
                        return;
939
                settings_.i.search_stn_radius = DoubleFromString<double>(val);
156✔
940
        }
941
        else if (iequals(var, TEST_SIMILAR_MSRS))
2,808✔
942
        {
943
                if (val.empty())
156✔
944
                        return;
945
                settings_.i.search_similar_msr = yesno_uint<UINT16, string>(val);
156✔
946
        }
947
        else if (iequals(var, TEST_SIMILAR_GNSS_MSRS))
2,652✔
948
        {
949
                if (val.empty())
156✔
950
                        return;
951
                settings_.i.search_similar_msr_gx = yesno_uint<UINT16, string>(val);
156✔
952
        }
953
        else if (iequals(var, IGNORE_SIMILAR_MSRS))
2,496✔
954
        {
955
                if (val.empty())
156✔
956
                        return;
957
                settings_.i.ignore_similar_msr = yesno_uint<UINT16, string>(val);
156✔
958
        }
959
        else if (iequals(var, REMOVE_IGNORED_MSRS))
2,340✔
960
        {
961
                if (val.empty())
156✔
962
                        return;
963
                settings_.i.remove_ignored_msr = yesno_uint<UINT16, string>(val);
156✔
964
        }
965
        else if (iequals(var, FLAG_UNUSED_STNS))
2,184✔
966
        {
967
                if (val.empty())
156✔
968
                        return;
969
                settings_.i.flag_unused_stn = yesno_uint<UINT16, string>(val);
156✔
970
        }
971
        else if (iequals(var, TEST_INTEGRITY))
2,028✔
972
        {
973
                if (val.empty())
156✔
974
                        return;                        
975
                settings_.i.test_integrity = yesno_uint<UINT16, string>(val);
156✔
976
        }
977
        else if (iequals(var, VSCALE))
1,872✔
978
        {
979
                if (val.empty())
156✔
980
                        return;
981
                settings_.i.vscale = DoubleFromString<double>(val);
156✔
982
        }
983
        else if (iequals(var, PSCALE))
1,716✔
984
        {
985
                if (val.empty())
156✔
986
                        return;
987
                settings_.i.pscale = DoubleFromString<double>(val);
156✔
988
        }
989
        else if (iequals(var, LSCALE))
1,560✔
990
        {
991
                if (val.empty())
156✔
992
                        return;
993
                settings_.i.lscale = DoubleFromString<double>(val);
156✔
994
        }
995
        else if (iequals(var, HSCALE))
1,404✔
996
        {
997
                if (val.empty())
156✔
998
                        return;
999
                settings_.i.hscale = DoubleFromString<double>(val);
156✔
1000
        }
1001
        else if (iequals(var, SCALAR_FILE))
1,248✔
1002
        {
1003
                if (val.empty())
156✔
1004
                        return;
1005
                settings_.i.scalar_file = formPath<string>(settings_.g.input_folder, val);
×
1006
        }
1007
        else if (iequals(var, EXPORT_XML_FILES))
1,092✔
1008
        {
1009
                if (val.empty())
156✔
1010
                        return;                        
1011
                settings_.i.export_dynaml = yesno_uint<UINT16, string>(val);
156✔
1012
        }
1013
        else if (iequals(var, EXPORT_SINGLE_XML_FILE))
936✔
1014
        {
1015
                if (val.empty())
156✔
1016
                        return;                        
1017
                settings_.i.export_single_xml_file = yesno_uint<UINT16, string>(val);
156✔
1018
        }
1019
        else if (iequals(var, EXPORT_FROM_BINARY))
780✔
1020
        {
1021
                if (val.empty())
×
1022
                        return;                        
1023
                settings_.i.export_from_bfiles = yesno_uint<UINT16, string>(val);
×
1024
        }
1025
        else if (iequals(var, EXPORT_DNA_FILES))
780✔
1026
        {
1027
                if (val.empty())
156✔
1028
                        return;                        
1029
                settings_.i.export_dna_files = yesno_uint<UINT16, string>(val);
156✔
1030
        }
1031
        else if (iequals(var, EXPORT_ASL_FILE))
624✔
1032
        {
1033
                if (val.empty())
156✔
1034
                        return;                        
1035
                settings_.i.export_asl_file = yesno_uint<UINT16, string>(val);
156✔
1036
        }
1037
        else if (iequals(var, EXPORT_AML_FILE))
468✔
1038
        {
1039
                if (val.empty())
156✔
1040
                        return;                        
1041
                settings_.i.export_aml_file = yesno_uint<UINT16, string>(val);
156✔
1042
        }
1043
        else if (iequals(var, EXPORT_MAP_FILE))
312✔
1044
        {
1045
                if (val.empty())
156✔
1046
                        return;                        
1047
                settings_.i.export_map_file = yesno_uint<UINT16, string>(val);
156✔
1048
        }
1049
        else if (iequals(var, SIMULATE_MSR_FILE))
156✔
1050
        {
1051
                if (val.empty())
156✔
1052
                        return;                        
1053
                settings_.i.simulate_measurements = yesno_uint<UINT16, string>(val);
156✔
1054
        }
1055
        //else if (iequals(var, VERIFY_COORDS))
1056
        //{
1057
        //        if (val.empty())
1058
        //                return;                        
1059
        //        settings_.i.verify_coordinates = lexical_cast<UINT16, string>(val);
1060
        //}
1061
        
1062
}
1063
        
1064
void CDnaProjectFile::LoadSettingReftran(const string& var, string& val)
780✔
1065
{
1066
        if (iequals(var, REFERENCE_FRAME))
780✔
1067
        {
1068
                if (val.empty())
156✔
1069
                        return;
1070
                settings_.r.reference_frame = val;
156✔
1071
        }
1072
        else if (iequals(var, EPOCH))
624✔
1073
        {
1074
                if (val.empty())
156✔
1075
                        return;
1076
                settings_.r.epoch = val;
936✔
1077
        }
1078
        else if (iequals(var, TECTONIC_PLATE_MODEL_OPTION))
468✔
1079
        {
1080
                if (val.empty())
156✔
1081
                        return;
1082
                settings_.r.plate_model_option = lexical_cast<UINT16, string>(val);
156✔
1083
        }
1084
        else if (iequals(var, TECTONIC_PLATE_BDY_FILE))
312✔
1085
        {
1086
                if (val.empty())
156✔
1087
                        return;
1088
                settings_.r.tpb_file = val;
×
1089

1090
                if (!exists(val))
×
1091
                        if (exists(formPath<string>(settings_.g.input_folder, val)))
×
1092
                                settings_.r.tpb_file = formPath<string>(settings_.g.input_folder, val);
×
1093
        }
1094
        else if (iequals(var, TECTONIC_PLATE_POLE_FILE))
156✔
1095
        {
1096
                if (val.empty())
156✔
1097
                        return;
1098
                settings_.r.tpp_file = val;
×
1099

1100
                if (!exists(val))
×
1101
                        if (exists(formPath<string>(settings_.g.input_folder, val)))
×
1102
                                settings_.r.tpp_file = formPath<string>(settings_.g.input_folder, val);
×
1103
        }
1104
}
1105
        
1106
void CDnaProjectFile::LoadSettingGeoid(const string& var, string& val)
780✔
1107
{
1108
        if (iequals(var, DAT_FILEPATH))
780✔
1109
        {
1110
                if (val.empty())
×
1111
                        return;
1112
                settings_.n.rdat_geoid_file = formPath<string>(settings_.g.input_folder, val);
×
1113
        }
1114
        else if (iequals(var, NTV2_FILEPATH))
780✔
1115
        {
1116
                if (val.empty())
156✔
1117
                        return;
1118
                settings_.n.ntv2_geoid_file = val;
48✔
1119

1120
                if (!exists(val))
48✔
1121
                        if (exists(formPath<string>(settings_.g.input_folder, val)))
×
1122
                                settings_.n.ntv2_geoid_file = formPath<string>(settings_.g.input_folder, val);
×
1123
        }
1124
        else if (iequals(var, INPUT_FILE))
624✔
1125
        {
1126
                if (val.empty())
×
1127
                        return;
1128
                settings_.n.input_file = formPath<string>(settings_.g.input_folder, val);
×
1129
        }
1130
        //else if (iequals(var, BIN_STN_FILE))
1131
        //{
1132
        //        if (val.empty())
1133
        //                return;
1134
        //        settings_.n.bst_file = formPath<string>(settings_.g.input_folder, val);
1135
        //}
1136
        else if (iequals(var, METHOD))
624✔
1137
        {
1138
                if (val.empty())
156✔
1139
                        return;
1140
                settings_.n.interpolation_method = lexical_cast<UINT16, string>(val);
156✔
1141
        }
1142
        else if (iequals(var, DDEG_FORMAT))
468✔
1143
        {
1144
                if (val.empty())
156✔
1145
                        return;
1146
                settings_.n.coordinate_format = lexical_cast<UINT16, string>(val);
156✔
1147
        }
1148
        else if (iequals(var, DIRECTION))
312✔
1149
        {
1150
                if (val.empty())
156✔
1151
                        return;
1152
                settings_.n.ellipsoid_to_ortho = lexical_cast<UINT16, string>(val);
156✔
1153
        }
1154
        else if (iequals(var, CONVERT_BST_HT))
156✔
1155
        {
1156
                if (val.empty())
×
1157
                        return;
1158
                settings_.n.convert_heights = yesno_uint<UINT16, string>(val);
×
1159
        }
1160
        else if (iequals(var, EXPORT_GEO_FILE))
156✔
1161
        {
1162
                if (val.empty())
156✔
1163
                        return;
1164
                settings_.n.export_dna_geo_file = yesno_uint<UINT16, string>(val);
156✔
1165
        }
1166
}
1167
        
1168
void CDnaProjectFile::LoadSettingSegment(const string& var, string& val)
936✔
1169
{
1170
        if (iequals(var, NET_FILE))
936✔
1171
        {
1172
                if (val.empty())
156✔
1173
                        return;
1174
                settings_.s.net_file = formPath<string>(settings_.g.input_folder, val);
21✔
1175
        }
1176
        else if (iequals(var, SEG_FILE))
780✔
1177
        {
1178
                if (val.empty())
156✔
1179
                        return;
1180
                settings_.s.seg_file = val;
3✔
1181

1182
                if (!exists(val))
3✔
1183
                        if (exists(formPath<string>(settings_.g.input_folder, val)))
×
1184
                                settings_.s.seg_file = formPath<string>(settings_.g.input_folder, val);
×
1185
        }
1186
        else if (iequals(var, BIN_STN_FILE))
624✔
1187
        {
1188
                if (val.empty())
×
1189
                        return;
1190
                settings_.s.bst_file = val;
×
1191

1192
                if (!exists(val))
×
1193
                        if (exists(formPath<string>(settings_.g.input_folder, val)))
×
1194
                                settings_.s.bst_file = formPath<string>(settings_.g.input_folder, val);
×
1195
        }
1196
        else if (iequals(var, BIN_MSR_FILE))
624✔
1197
        {
1198
                if (val.empty())
×
1199
                        return;
1200
                settings_.s.bms_file = val;
×
1201

1202
                if (!exists(val))
×
1203
                        if (exists(formPath<string>(settings_.g.input_folder, val)))
×
1204
                                settings_.s.bms_file = formPath<string>(settings_.g.input_folder, val);
×
1205
        }
1206
        else if (iequals(var, SEG_MIN_INNER_STNS))
624✔
1207
        {
1208
                if (val.empty())
156✔
1209
                        return;
1210
                settings_.s.min_inner_stations = lexical_cast<UINT16, string>(val);
156✔
1211
        }
1212
        else if (iequals(var, SEG_THRESHOLD_STNS))
468✔
1213
        {
1214
                if (val.empty())
156✔
1215
                        return;
1216
                settings_.s.max_total_stations = lexical_cast<UINT16, string>(val);
156✔
1217
        }
1218
        else if (iequals(var, SEG_FORCE_CONTIGUOUS))
312✔
1219
        {
1220
                if (val.empty())
156✔
1221
                        return;
1222
                settings_.s.force_contiguous_blocks = yesno_uint<UINT16, string>(val);
156✔
1223
        }
1224
        else if (iequals(var, SEG_STARTING_STN))
156✔
1225
        {
1226
                if (val.empty())
156✔
1227
                        return;
1228
                settings_.s.seg_starting_stns = val;
961✔
1229
        }
1230
        else if (iequals(var, SEG_SEARCH_LEVEL))
×
1231
        {
1232
                if (val.empty())
×
1233
                        return;
1234
                settings_.s.seg_search_level = lexical_cast<UINT16, string>(val);
×
1235
        }
1236
}
1237
        
1238
void CDnaProjectFile::LoadSettingAdjust(const string& var, string& val)
2,496✔
1239
{
1240
        if (iequals(var, BIN_STN_FILE))
2,496✔
1241
        {
1242
                if (val.empty())
×
1243
                        return;
1244
                settings_.a.bst_file = val;
×
1245

1246
                if (!exists(val))
×
1247
                        if (exists(formPath<string>(settings_.g.input_folder, val)))
×
1248
                                settings_.a.bst_file = formPath<string>(settings_.g.input_folder, val);
×
1249
        }
1250
        else if (iequals(var, BIN_MSR_FILE))
2,496✔
1251
        {
1252
                if (val.empty())
×
1253
                        return;
1254
                settings_.a.bms_file = val;
×
1255

1256
                if (!exists(val))
×
1257
                        if (exists(formPath<string>(settings_.g.input_folder, val)))
×
1258
                                settings_.a.bms_file = formPath<string>(settings_.g.input_folder, val);
×
1259
        }
1260
        else if (iequals(var, SEG_FILE))
2,496✔
1261
        {
1262
                if (val.empty())
156✔
1263
                        return;
1264
                settings_.a.seg_file = val;
×
1265

1266
                if (!exists(val))
×
1267
                        if (exists(formPath<string>(settings_.g.input_folder, val)))
×
1268
                                settings_.a.seg_file = formPath<string>(settings_.g.input_folder, val);
×
1269
        }
1270
        else if (iequals(var, COMMENTS))
2,340✔
1271
        {
1272
                if (val.empty())
156✔
1273
                        return;
1274
                settings_.a.comments = val;                
6✔
1275
        }
1276
        if (iequals(var, ADJUSTMENT_MODE))
2,190✔
1277
        {
1278
                if (val.empty())
156✔
1279
                        return;
1280
                if (iequals(val, MODE_SIMULTANEOUS))
156✔
1281
                {
1282
                        settings_.a.adjust_mode = SimultaneousMode;
135✔
1283
                        settings_.a.multi_thread = false;
135✔
1284
                        settings_.a.stage = false;
135✔
1285
                }
1286
                else if (iequals(val, MODE_PHASED))
21✔
1287
                {
1288
                        settings_.a.adjust_mode = PhasedMode;
17✔
1289
                }
1290
                else if (iequals(val, MODE_PHASED_BLOCK1))
4✔
1291
                {
1292
                        settings_.a.adjust_mode = Phased_Block_1Mode;
4✔
1293
                        settings_.a.multi_thread = false;
4✔
1294
                }
1295
                else if (iequals(val, MODE_SIMULATION))
×
1296
                {
1297
                        settings_.a.adjust_mode = SimulationMode;
×
1298
                        settings_.a.multi_thread = false;
×
1299
                        settings_.a.stage = false;
×
1300
                }
1301
        }
1302

1303
        else if (iequals(var, MODE_PHASED_MT))
2,034✔
1304
        {
1305
                if (val.empty())
156✔
1306
                        return;
1307
                settings_.a.multi_thread = yesno_uint<UINT16, string>(val);
156✔
1308
        }
1309
        else if (iequals(var, STAGED_ADJUSTMENT))
1,878✔
1310
        {
1311
                if (val.empty())
156✔
1312
                        return;
1313
                settings_.a.stage = yesno_uint<UINT16, string>(val);
156✔
1314
        }
1315
        
1316
        else if (iequals(var, CONF_INTERVAL))
1,722✔
1317
        {
1318
                if (val.empty())
156✔
1319
                        return;
1320
                settings_.a.confidence_interval = FloatFromString<float>(val);
156✔
1321
        }
1322
        else if (iequals(var, ITERATION_THRESHOLD))
1,566✔
1323
        {
1324
                if (val.empty())
156✔
1325
                        return;
1326
                settings_.a.iteration_threshold = FloatFromString<float>(val);
156✔
1327
        }
1328
        else if (iequals(var, MAX_ITERATIONS))
1,410✔
1329
        {
1330
                if (val.empty())
156✔
1331
                        return;
1332
                settings_.a.max_iterations = lexical_cast<UINT16, string>(val);
156✔
1333
        }
1334
        else if (iequals(var, STN_CONSTRAINTS))
1,254✔
1335
        {
1336
                if (val.empty())
156✔
1337
                        return;
1338
                settings_.a.station_constraints = val;
6✔
1339
        }
1340
        else if (iequals(var, FREE_STN_SD))
1,098✔
1341
        {
1342
                if (val.empty())
156✔
1343
                        return;
1344
                settings_.a.free_std_dev = DoubleFromString<double>(val);
156✔
1345
        }
1346
        else if (iequals(var, FIXED_STN_SD))
942✔
1347
        {
1348
                if (val.empty())
156✔
1349
                        return;
1350
                settings_.a.fixed_std_dev = DoubleFromString<double>(val);
156✔
1351
        }
1352
        //else if (iequals(var, LSQ_INVERSE_METHOD))
1353
        //{
1354
        //        if (val.empty())
1355
        //                return;
1356
        //        settings_.a.inverse_method_lsq = lexical_cast<UINT16, string>(val);
1357
        //}
1358
        else if (iequals(var, SCALE_NORMAL_UNITY))
786✔
1359
        {
1360
                if (val.empty())
156✔
1361
                        return;
1362
                settings_.a.scale_normals_to_unity = yesno_uint<UINT16, string>(val);
156✔
1363
        }
1364
        else if (iequals(var, RECREATE_STAGE_FILES))
630✔
1365
        {
1366
                if (val.empty())
156✔
1367
                        return;
1368
                settings_.a.recreate_stage_files = yesno_uint<UINT16, string>(val);
156✔
1369
        }
1370
        else if (iequals(var, PURGE_STAGE_FILES))
474✔
1371
        {
1372
                if (val.empty())
156✔
1373
                        return;
1374
                settings_.a.purge_stage_files = yesno_uint<UINT16, string>(val) == 1;
156✔
1375
        }
1376
        else if (iequals(var, TYPE_B_GLOBAL))
318✔
1377
        {
1378
                if (val.empty())
156✔
1379
                        return;
1380
                settings_.a.type_b_global = val;
2,496✔
1381
        }
1382
        else if (iequals(var, TYPE_B_FILE))
162✔
1383
        {
1384
                if (val.empty())
156✔
1385
                        return;
1386
                settings_.a.type_b_file = val;
×
1387

1388
                if (!exists(val))
×
1389
                        if (exists(formPath<string>(settings_.g.input_folder, val)))
×
1390
                                settings_.a.type_b_file = formPath<string>(settings_.g.input_folder, val);
×
1391
        }
1392
}
1393
        
1394
void CDnaProjectFile::LoadSettingOutput(const string& var, string& val)
7,332✔
1395
{
1396
        if (iequals(var, OUTPUT_MSR_TO_STN))
7,332✔
1397
        {
1398
                if (val.empty())
156✔
1399
                        return;
1400
                settings_.o._msr_to_stn = yesno_uint<UINT16, string>(val);
156✔
1401
        }
1402
        else if (iequals(var, OUTPUT_MSR_TO_STN_SORTBY))
7,176✔
1403
        {
1404
                if (val.empty())
156✔
1405
                        return;
1406
                settings_.o._sort_msr_to_stn = lexical_cast<UINT16, string>(val);
156✔
1407
        }
1408
        else if (iequals(var, OUTPUT_ADJ_STN_ITER))
7,020✔
1409
        {
1410
                if (val.empty())
156✔
1411
                        return;
1412
                settings_.o._adj_stn_iteration = yesno_uint<UINT16, string>(val);
156✔
1413
        }
1414
        else if (iequals(var, OUTPUT_ADJ_STAT_ITER))
6,864✔
1415
        {
1416
                if (val.empty())
156✔
1417
                        return;
1418
                settings_.o._adj_stat_iteration = yesno_uint<UINT16, string>(val);
156✔
1419
        }
1420
        else if (iequals(var, OUTPUT_ADJ_MSR_ITER))
6,708✔
1421
        {
1422
                if (val.empty())
156✔
1423
                        return;
1424
                settings_.o._adj_msr_iteration = yesno_uint<UINT16, string>(val);
156✔
1425
        }
1426
        else if (iequals(var, OUTPUT_CMP_MSR_ITER))
6,552✔
1427
        {
1428
                if (val.empty())
156✔
1429
                        return;
1430
                settings_.o._cmp_msr_iteration = yesno_uint<UINT16, string>(val);
156✔
1431
        }
1432
        else if (iequals(var, OUTPUT_ADJ_MSR))
6,396✔
1433
        {
1434
                if (val.empty())
156✔
1435
                        return;
1436
                settings_.o._adj_msr_final = yesno_uint<UINT16, string>(val);
156✔
1437
        }
1438
        else if (iequals(var, OUTPUT_ADJ_GNSS_UNITS))
6,240✔
1439
        {
1440
                if (val.empty())
156✔
1441
                        return;
1442
                settings_.o._adj_gnss_units = lexical_cast<UINT16, string>(val);
156✔
1443
        }
1444
        else if (iequals(var, OUTPUT_ADJ_MSR_TSTAT))
6,084✔
1445
        {
1446
                if (val.empty())
156✔
1447
                        return;
1448
                settings_.o._adj_msr_tstat = yesno_uint<UINT16, string>(val);
156✔
1449
        }
1450
        else if (iequals(var, OUTPUT_ADJ_MSR_SORTBY))
5,928✔
1451
        {
1452
                if (val.empty())
156✔
1453
                        return;
1454
                settings_.o._sort_adj_msr = lexical_cast<UINT16, string>(val);
156✔
1455
        }
1456
        else if (iequals(var, OUTPUT_ADJ_MSR_DBID))
5,772✔
1457
        {
1458
                if (val.empty())
156✔
1459
                        return;
1460
                settings_.o._database_ids = yesno_uint<UINT16, string>(val);
156✔
1461
        }
1462
        else if (iequals(var, OUTPUT_ADJ_STN_BLOCKS))
5,616✔
1463
        {
1464
                if (val.empty())
×
1465
                        return;
1466
                settings_.o._output_stn_blocks = yesno_uint<UINT16, string>(val);
×
1467
        }
1468
        else if (iequals(var, OUTPUT_ADJ_MSR_BLOCKS))
5,616✔
1469
        {
1470
                if (val.empty())
156✔
1471
                        return;
1472
                settings_.o._output_msr_blocks = yesno_uint<UINT16, string>(val);
156✔
1473
        }
1474
        else if (iequals(var, OUTPUT_ADJ_STN_SORT_ORDER))
5,460✔
1475
        {
1476
                if (val.empty())
156✔
1477
                        return;
1478
                settings_.o._sort_stn_file_order = yesno_uint<UINT16, string>(val);
156✔
1479
        }
1480
        else if (iequals(var, OUTPUT_STN_COORD_TYPES))
5,304✔
1481
        {
1482
                if (val.empty())
156✔
1483
                        return;
1484
                settings_.o._stn_coord_types = val;
7,488✔
1485
        }
1486
        else if (iequals(var, OUTPUT_ANGULAR_TYPE_STN))
5,148✔
1487
        {
1488
                if (val.empty())
156✔
1489
                        return;
1490
                settings_.o._angular_type_stn = lexical_cast<UINT16, string>(val);
156✔
1491
        }
1492
        else if (iequals(var, OUTPUT_STN_CORR))
4,992✔
1493
        {
1494
                if (val.empty())
156✔
1495
                        return;
1496
                settings_.o._stn_corr = yesno_uint<UINT16, string>(val);
156✔
1497
        }
1498
        else if (iequals(var, OUTPUT_PRECISION_METRES_STN))
4,836✔
1499
        {
1500
                if (val.empty())
156✔
1501
                        return;
1502
                settings_.o._precision_metres_stn = lexical_cast<UINT16, string>(val);
156✔
1503
        }
1504
        else if (iequals(var, OUTPUT_PRECISION_SECONDS_STN))
4,680✔
1505
        {
1506
                if (val.empty())
156✔
1507
                        return;
1508
                settings_.o._precision_seconds_stn = lexical_cast<UINT16, string>(val);
156✔
1509
        }
1510
        else if (iequals(var, OUTPUT_PRECISION_METRES_MSR))
4,524✔
1511
        {
1512
                if (val.empty())
156✔
1513
                        return;
1514
                settings_.o._precision_metres_msr = lexical_cast<UINT16, string>(val);
156✔
1515
        }
1516
        else if (iequals(var, OUTPUT_PRECISION_SECONDS_MSR))
4,368✔
1517
        {
1518
                if (val.empty())
156✔
1519
                        return;
1520
                settings_.o._precision_seconds_msr = lexical_cast<UINT16, string>(val);
156✔
1521
        }
1522
        else if (iequals(var, OUTPUT_ANGULAR_TYPE_MSR))
4,212✔
1523
        {
1524
                if (val.empty())
156✔
1525
                        return;
1526
                settings_.o._angular_type_msr = lexical_cast<UINT16, string>(val);
156✔
1527
        }
1528
        else if (iequals(var, OUTPUT_DMS_FORMAT_MSR))
4,056✔
1529
        {
1530
                if (val.empty())
156✔
1531
                        return;
1532
                settings_.o._dms_format_msr = lexical_cast<UINT16, string>(val);
156✔
1533
        }
1534
        else if (iequals(var, OUTPUT_POS_UNCERTAINTY))
3,900✔
1535
        {
1536
                if (val.empty())
156✔
1537
                        return;
1538
                settings_.o._positional_uncertainty = yesno_uint<UINT16, string>(val);
156✔
1539
        }
1540
        else if (iequals(var, OUTPUT_APU_CORRELATIONS))
3,744✔
1541
        {
1542
                if (val.empty())
156✔
1543
                        return;
1544
                settings_.o._output_pu_covariances = yesno_uint<UINT16, string>(val);
156✔
1545
        }
1546
        else if (iequals(var, OUTPUT_APU_UNITS))
3,588✔
1547
        {
1548
                if (val.empty())
156✔
1549
                        return;
1550
                settings_.o._apu_vcv_units = lexical_cast<UINT16, string>(val);
156✔
1551
        }
1552
        else if (iequals(var, OUTPUT_STN_COR_FILE))
3,432✔
1553
        {
1554
                if (val.empty())
156✔
1555
                        return;
1556
                settings_.o._init_stn_corrections = yesno_uint<UINT16, string>(val);
156✔
1557
        }
1558
        else if (iequals(var, HZ_CORR_THRESHOLD))
3,276✔
1559
        {
1560
                if (val.empty())
156✔
1561
                        return;
1562
                settings_.o._hz_corr_threshold = DoubleFromString<double>(val);
156✔
1563
        }
1564
        else if (iequals(var, VT_CORR_THRESHOLD))
3,120✔
1565
        {
1566
                if (val.empty())
156✔
1567
                        return;
1568
                settings_.o._vt_corr_threshold = DoubleFromString<double>(val);
156✔
1569
        }
1570
        //else if (iequals(var, UPDATE_ORIGINAL_STN_FILE))
1571
        //{
1572
        //        if (val.empty())
1573
        //                return;
1574
        //        settings_.o. = yesno_uint<UINT16, string>(val);
1575
        //}
1576
        else if (iequals(var, EXPORT_XML_STN_FILE))
2,964✔
1577
        {
1578
                if (val.empty())
156✔
1579
                        return;
1580
                settings_.o._export_xml_stn_file= yesno_uint<UINT16, string>(val);
156✔
1581
        }
1582
        else if (iequals(var, EXPORT_DNA_STN_FILE))
2,808✔
1583
        {
1584
                if (val.empty())
156✔
1585
                        return;
1586
                settings_.o._export_dna_stn_file = yesno_uint<UINT16, string>(val);
156✔
1587
        }
1588
        else if (iequals(var, EXPORT_SNX_FILE))
2,652✔
1589
        {
1590
                if (val.empty())
156✔
1591
                        return;
1592
                settings_.o._export_snx_file = yesno_uint<UINT16, string>(val);
156✔
1593
        }
1594
        
1595
}
1596
        
1597
//void CDnaProjectFile::LoadSettingPlot(const string& var, string& val)
1598
//{
1599
//}
1600
//        
1601
//void CDnaProjectFile::LoadSettingDisplay(const string& var, string& val)
1602
//{
1603
//}
1604

1605
template <typename T>
1606
void CDnaProjectFile::AddOptionValue(ostream& os, const char* const option, const T& value) {
×
1607
        os << " --" << option << " " << value;
×
1608
}
×
1609

1610
template <typename T>
1611
void CDnaProjectFile::AddDefaultValue(ostream& os, const T& value)
×
1612
{
1613
        os << " " << value;
×
1614
}
×
1615

1616
template <typename T, typename U>
1617
void CDnaProjectFile::PrintRecord(ostream& os, const T& variable, const U& value) {
13,024✔
1618

1619
        PrintVariable(os, variable);
13,024✔
1620
        PrintValue(os, value);
13,024✔
1621
}
13,024✔
1622
        
1623

1624
template <typename T>
1625
void CDnaProjectFile::PrintVariable(ostream& os, const T& variable) {
13,024✔
1626
        // width of 35
1627
        os << setw(PRINT_VAR_PAD) << left << variable;
13,024✔
1628
}
13,024✔
1629
        
1630

1631
template <typename T>
1632
void CDnaProjectFile::PrintValue(ostream& os, const T& value) {
13,024✔
1633
        // width of 45
1634
        os << setw(PRINT_VAL_PAD) << left << value << endl;
13,024✔
1635
}
13,024✔
1636
        
1637

1638
string CDnaProjectFile::FormCommandLineOptionsStringImport()
×
1639
{
1640
        stringstream options;
×
1641
        //////////////////////////////////////////////////////
1642
        // General settings
1643
        AddDefaultValue(options, FormCommandLineOptionsStringGeneral());
×
1644
        
1645
        //////////////////////////////////////////////////////
1646
        // Import settings
1647
        // files
1648
        for (_it_vstr_const _it_tmp(settings_.i.input_files.begin());
×
1649
                _it_tmp!=settings_.i.input_files.end(); ++_it_tmp)
×
1650
                AddDefaultValue<string>(options, 
×
1651
                        leafStr<string>(trimstr<string>(_it_tmp->c_str())));
×
1652
        
1653

1654
        return options.str();
×
1655
}
×
1656
        
1657
string CDnaProjectFile::FormCommandLineOptionsStringGeneral()
×
1658
{
1659
        stringstream options;
×
1660
        //////////////////////////////////////////////////////
1661
        // General settings
1662
        // project file
1663
        AddOptionValue<string>(options, PROJECT_FILE, settings_.g.project_file);
×
1664
        // network name
1665
        AddOptionValue<string>(options, NETWORK_NAME, settings_.g.network_name);
×
1666
        // verbose
1667
        AddOptionValue<UINT16>(options, VERBOSE, settings_.g.verbose);
×
1668
        // verbose
1669
        AddOptionValue<UINT16>(options, QUIET, settings_.g.quiet);
×
1670

1671
        return options.str();
×
1672
}
×
1673
        
1674
void CDnaProjectFile::PrintProjectFile()
113✔
1675
{
1676
        std::ofstream dnaproj_file;
113✔
1677

1678
        stringstream err_msg;
113✔
1679
        err_msg << "PrintProjectFile(): An error was encountered when opening " << 
113✔
1680
                settings_.g.project_file << "." << endl;
113✔
1681

1682
        try {
113✔
1683
                // create binary aml file.  Throws runtime_error on failure.
1684
                file_opener(dnaproj_file, settings_.g.project_file,
113✔
1685
                        ios::out, ascii);
1686
        }
1687
        catch (const runtime_error& e) {
×
1688
                err_msg << e.what();
×
1689
                throw boost::enable_current_exception(runtime_error(err_msg.str()));
×
1690
        }
×
1691
        catch (...) {
×
1692
                throw boost::enable_current_exception(runtime_error(err_msg.str()));
×
1693
        }
×
1694

1695
        err_msg.str("");
226✔
1696
        err_msg << "PrintProjectFile(): An error was encountered when writing to " << 
113✔
1697
                settings_.g.project_file << "." << endl;
113✔
1698

1699
        stringstream ss;
113✔
1700

1701
        // Write header line
1702
        dnaproj_header(dnaproj_file, settings_.g.network_name + " project file.");
113✔
1703
        dnaproj_file << endl << endl;
113✔
1704

1705
        ////////////////////////////////////////////////////////////////////////////////////////////////
1706
        // #general
1707
        ss.str("");
226✔
1708
        ss << section_general << " (" << PRINT_VAR_PAD << ")";
113✔
1709
        PrintRecord(dnaproj_file, ss.str(), "VALUE");
113✔
1710
        dnaproj_file << OUTPUTLINE << endl;
113✔
1711
        
1712
        PrintRecord(dnaproj_file, NETWORK_NAME, settings_.g.network_name);                                                                // network name
113✔
1713
        PrintRecord(dnaproj_file, INPUT_FOLDER, system_complete(settings_.g.input_folder).string());        // Path containing all input files
226✔
1714
        PrintRecord(dnaproj_file, OUTPUT_FOLDER, system_complete(settings_.g.output_folder).string());        // Path for all output files
226✔
1715
        PrintRecord(dnaproj_file, VERBOSE, settings_.g.verbose);                                                                                // Give detailed information about what dnainterop is doing.
113✔
1716
                                                                                                                                                                                                        // 0: No information (default)
1717
                                                                                                                                                                                                        // 1: Helpful information
1718
                                                                                                                                                                                                        // 2: Extended information\n3: Debug level information
1719
        PrintRecord(dnaproj_file, QUIET, yesno_string(settings_.g.quiet));                                                                // Run quietly?
113✔
1720
        PrintRecord(dnaproj_file, PROJECT_FILE, system_complete(settings_.g.project_file).string());        // project file
226✔
1721
        PrintRecord(dnaproj_file, DYNADJUST_LOG_FILE, system_complete(settings_.g.log_file).string());        // dynadjust log file
226✔
1722
        
1723
        dnaproj_file << endl;
113✔
1724

1725
        ////////////////////////////////////////////////////////////////////////////////////////////////
1726
        // #import
1727
        ss.str("");
226✔
1728
        ss << section_import << " (" << PRINT_VAR_PAD << ")";
113✔
1729
        PrintRecord(dnaproj_file, ss.str(), "VALUE");
113✔
1730
        dnaproj_file << OUTPUTLINE << endl;
113✔
1731
        
1732
        // Input files
1733
        for_each (settings_.i.input_files.begin(), settings_.i.input_files.end(),
113✔
1734
                [&dnaproj_file, this] (string file) {
510✔
1735
                        PrintRecord(dnaproj_file, IMPORT_FILE, leafStr<string>(file.c_str()));
510✔
1736
        });
255✔
1737

1738
        // geoid file
1739
        PrintRecord(dnaproj_file, IMPORT_GEO_FILE, 
113✔
1740
                (settings_.i.geo_file.empty() ? " " : leafStr<string>(settings_.i.geo_file)));
113✔
1741

1742
        // reference frame settings
1743
        PrintRecord(dnaproj_file, REFERENCE_FRAME, settings_.i.reference_frame);
113✔
1744
        PrintRecord(dnaproj_file, OVERRIDE_INPUT_FRAME, 
113✔
1745
                yesno_string(settings_.i.override_input_rfame));
113✔
1746

1747
        // data screening
1748
        PrintRecord(dnaproj_file, BOUNDING_BOX, settings_.i.bounding_box);
113✔
1749
        PrintRecord(dnaproj_file, GET_MSRS_TRANSCENDING_BOX, 
113✔
1750
                yesno_string(settings_.i.include_transcending_msrs));
113✔
1751
        
1752
        PrintRecord(dnaproj_file, INCLUDE_STN_ASSOC_MSRS,
113✔
1753
                (settings_.i.stn_associated_msr_include.empty() ? "no" : settings_.i.stn_associated_msr_include));
113✔
1754
        PrintRecord(dnaproj_file, EXCLUDE_STN_ASSOC_MSRS,
113✔
1755
                (settings_.i.stn_associated_msr_exclude.empty() ? "no" : settings_.i.stn_associated_msr_exclude));
113✔
1756
        PrintRecord(dnaproj_file, SPLIT_CLUSTERS,
113✔
1757
                yesno_string(settings_.i.split_clusters));        
113✔
1758
        PrintRecord(dnaproj_file, IMPORT_SEG_BLOCK,
113✔
1759
                (settings_.i.import_block ? val_uint<string, UINT32>(settings_.i.import_block_number) : "no"));
113✔
1760
        PrintRecord(dnaproj_file, SEG_FILE, 
113✔
1761
                (settings_.i.seg_file.empty() ? " " : leafStr<string>(settings_.i.seg_file)));
113✔
1762
        PrintRecord(dnaproj_file, PREFER_X_MSR_AS_G, 
113✔
1763
                yesno_string(settings_.i.prefer_single_x_as_g));        
113✔
1764
        
1765
        PrintRecord(dnaproj_file, INCLUDE_MSRS, settings_.i.include_msrs);
113✔
1766
        PrintRecord(dnaproj_file, EXCLUDE_MSRS, settings_.i.exclude_msrs);                                                        
113✔
1767
        PrintRecord(dnaproj_file, STATION_RENAMING_FILE,
113✔
1768
                leafStr<string>(settings_.i.stn_renamingfile));                                                
113✔
1769
        PrintRecord(dnaproj_file, STATION_DISCONTINUITY_FILE,
113✔
1770
                leafStr<string>(settings_.i.stn_discontinuityfile));                                                
113✔
1771
        PrintRecord(dnaproj_file, TEST_NEARBY_STNS,
113✔
1772
                yesno_string(settings_.i.search_nearby_stn));                                                
113✔
1773
        PrintRecord(dnaproj_file, TEST_NEARBY_STN_DIST, settings_.i.search_stn_radius);                                        
113✔
1774
        PrintRecord(dnaproj_file, TEST_SIMILAR_MSRS,
113✔
1775
                yesno_string(settings_.i.search_similar_msr));                                                
113✔
1776
        PrintRecord(dnaproj_file, TEST_SIMILAR_GNSS_MSRS,
113✔
1777
                yesno_string(settings_.i.search_similar_msr_gx));                                                
113✔
1778
        PrintRecord(dnaproj_file, IGNORE_SIMILAR_MSRS,
113✔
1779
                yesno_string(settings_.i.ignore_similar_msr));                                        
113✔
1780
        PrintRecord(dnaproj_file, REMOVE_IGNORED_MSRS,
113✔
1781
                yesno_string(settings_.i.remove_ignored_msr));                                        
113✔
1782
        PrintRecord(dnaproj_file, FLAG_UNUSED_STNS,
113✔
1783
                yesno_string(settings_.i.flag_unused_stn));                                                
113✔
1784
        PrintRecord(dnaproj_file, TEST_INTEGRITY,
113✔
1785
                yesno_string(settings_.i.test_integrity));                                                
113✔
1786
        
1787
        // GNSS variance matrix scaling
1788
        PrintRecord(dnaproj_file, VSCALE, settings_.i.vscale);                                
113✔
1789
        PrintRecord(dnaproj_file, PSCALE, settings_.i.pscale);                                
113✔
1790
        PrintRecord(dnaproj_file, LSCALE, settings_.i.lscale);                                
113✔
1791
        PrintRecord(dnaproj_file, HSCALE, settings_.i.hscale);                                
113✔
1792
        PrintRecord(dnaproj_file, SCALAR_FILE, leafStr<string>(settings_.i.scalar_file));
113✔
1793

1794
        // export options
1795
        PrintRecord(dnaproj_file, EXPORT_XML_FILES, 
113✔
1796
                yesno_string(settings_.i.export_dynaml));                                                // Create DynaML output file
113✔
1797
        PrintRecord(dnaproj_file, EXPORT_SINGLE_XML_FILE, 
113✔
1798
                yesno_string(settings_.i.export_single_xml_file));                                // Create single station and measurement DynaML output files
113✔
1799
        PrintRecord(dnaproj_file, EXPORT_DNA_FILES, 
113✔
1800
                yesno_string(settings_.i.export_dna_files));
113✔
1801
        PrintRecord(dnaproj_file, EXPORT_ASL_FILE,
113✔
1802
                yesno_string(settings_.i.export_asl_file));
113✔
1803
        PrintRecord(dnaproj_file, EXPORT_AML_FILE, 
113✔
1804
                yesno_string(settings_.i.export_aml_file));
113✔
1805
        PrintRecord(dnaproj_file, EXPORT_MAP_FILE,
113✔
1806
                yesno_string(settings_.i.export_map_file));
113✔
1807
        PrintRecord(dnaproj_file, SIMULATE_MSR_FILE, 
113✔
1808
                yesno_string(settings_.i.simulate_measurements));
113✔
1809

1810
        dnaproj_file << endl;
113✔
1811
        
1812
        ////////////////////////////////////////////////////////////////////////////////////////////////
1813
        // #reftran
1814
        ss.str("");
226✔
1815
        ss << section_reftran << " (" << PRINT_VAR_PAD << ")";
113✔
1816
        PrintRecord(dnaproj_file, ss.str(), "VALUE");
113✔
1817
        dnaproj_file << OUTPUTLINE << endl;
113✔
1818
        
1819
        PrintRecord(dnaproj_file, REFERENCE_FRAME, settings_.r.reference_frame);
113✔
1820
        PrintRecord(dnaproj_file, EPOCH, settings_.r.epoch);
113✔
1821

1822
        PrintRecord(dnaproj_file, TECTONIC_PLATE_MODEL_OPTION, settings_.r.plate_model_option);                                        // Plate motion model option
113✔
1823
        PrintRecord(dnaproj_file, TECTONIC_PLATE_BDY_FILE, leafStr<string>(settings_.r.tpb_file));                                // Tectonic plate boundary file
113✔
1824
        PrintRecord(dnaproj_file, TECTONIC_PLATE_POLE_FILE, leafStr<string>(settings_.r.tpp_file));                                // Tectonic plate pole file
113✔
1825
        
1826
        dnaproj_file << endl;
113✔
1827
        
1828
        ////////////////////////////////////////////////////////////////////////////////////////////////
1829
        // #geoid
1830
        ss.str("");
226✔
1831
        ss << section_geoid << " (" << PRINT_VAR_PAD << ")";
113✔
1832
        PrintRecord(dnaproj_file, ss.str(), "VALUE");
113✔
1833
        dnaproj_file << OUTPUTLINE << endl;
113✔
1834

1835
        // Output configured to populate binary station files
1836
        PrintRecord(dnaproj_file, NTV2_FILEPATH, system_complete(settings_.n.ntv2_geoid_file).string());                                        // Full file path to geoid file
226✔
1837
        
1838
        PrintRecord(dnaproj_file, METHOD, settings_.n.interpolation_method);
113✔
1839
        PrintRecord(dnaproj_file, DDEG_FORMAT, settings_.n.coordinate_format);
113✔
1840
        PrintRecord(dnaproj_file, DIRECTION, settings_.n.ellipsoid_to_ortho);
113✔
1841
        //PrintRecord(dnaproj_file, CONVERT_BST_HT,
1842
        //        yesno_string(settings_.n.convert_heights));
1843
        PrintRecord(dnaproj_file, EXPORT_GEO_FILE,
113✔
1844
                yesno_string(settings_.n.export_dna_geo_file));
113✔
1845
        
1846
        dnaproj_file << endl;
113✔
1847

1848
        ////////////////////////////////////////////////////////////////////////////////////////////////
1849
        // #segment
1850
        ss.str("");
226✔
1851
        ss << section_segment << " (" << PRINT_VAR_PAD << ")";
113✔
1852
        PrintRecord(dnaproj_file, ss.str(), "VALUE");
113✔
1853
        dnaproj_file << OUTPUTLINE << endl;
113✔
1854
        
1855
        PrintRecord(dnaproj_file, NET_FILE, leafStr<string>(settings_.s.net_file));                                // Starting stations file
113✔
1856
        PrintRecord(dnaproj_file, SEG_FILE, leafStr<string>(settings_.s.seg_file));                                // Segmentation output file
113✔
1857
        PrintRecord(dnaproj_file, SEG_MIN_INNER_STNS, settings_.s.min_inner_stations);                        // Minimum number of inner stations per block
113✔
1858
        PrintRecord(dnaproj_file, SEG_THRESHOLD_STNS, settings_.s.max_total_stations);                        // Maximum number of total stations per block
113✔
1859
        PrintRecord(dnaproj_file, SEG_FORCE_CONTIGUOUS,
113✔
1860
                yesno_string(settings_.s.force_contiguous_blocks));
113✔
1861

1862
        // Stations to be incorporated within the first block.
1863
        PrintRecord(dnaproj_file, SEG_STARTING_STN, settings_.s.seg_starting_stns);        
113✔
1864

1865
        dnaproj_file << endl;
113✔
1866

1867
        ////////////////////////////////////////////////////////////////////////////////////////////////
1868
        // #adjust
1869
        ss.str("");
226✔
1870
        ss << section_adjust << " (" << PRINT_VAR_PAD << ")";
113✔
1871
        PrintRecord(dnaproj_file, ss.str(), "VALUE");
113✔
1872
        dnaproj_file << OUTPUTLINE << endl;
113✔
1873

1874
        PrintRecord(dnaproj_file, SEG_FILE, leafStr<string>(settings_.a.seg_file));                                // Starting stations file
113✔
1875
        PrintRecord(dnaproj_file, COMMENTS, settings_.a.comments);                                                                // Starting stations file
113✔
1876
        
1877
        PrintRecord(dnaproj_file, ADJUSTMENT_MODE, adjustmentMode<string, UINT32>(settings_.a.adjust_mode));
113✔
1878

1879
        PrintRecord(dnaproj_file, MODE_PHASED_MT, 
113✔
1880
                yesno_string(settings_.a.multi_thread));
113✔
1881
        PrintRecord(dnaproj_file, STAGED_ADJUSTMENT, 
113✔
1882
                yesno_string(settings_.a.stage));
113✔
1883
        
1884
        PrintRecord(dnaproj_file, CONF_INTERVAL, settings_.a.confidence_interval);                                // Confidence interval
113✔
1885
        PrintRecord(dnaproj_file, ITERATION_THRESHOLD, settings_.a.iteration_threshold);                // Threshold to halt iterations
113✔
1886
        PrintRecord(dnaproj_file, MAX_ITERATIONS, settings_.a.max_iterations);                                        // Number of iteration before a solution is adopted
113✔
1887
        PrintRecord(dnaproj_file, STN_CONSTRAINTS, settings_.a.station_constraints);                        
113✔
1888
        
1889
        ss.str("");
226✔
1890
        ss << fixed << setprecision(3) << settings_.a.free_std_dev;
113✔
1891
        PrintRecord(dnaproj_file, FREE_STN_SD, ss.str());                                                                                // SD for free stations
113✔
1892
        ss.str("");
226✔
1893
        ss << scientific << setprecision(4) << settings_.a.fixed_std_dev;
113✔
1894
        PrintRecord(dnaproj_file, FIXED_STN_SD, ss.str());                                                                                // SD for fixed stations
113✔
1895
        
1896
        //PrintRecord(dnaproj_file, LSQ_INVERSE_METHOD, settings_.a.inverse_method_lsq);                        // Least squares inverse method
1897

1898
        PrintRecord(dnaproj_file, SCALE_NORMAL_UNITY, 
113✔
1899
                yesno_string(settings_.a.scale_normals_to_unity));                                                                        // Scale normals to unity before inversion
113✔
1900
        PrintRecord(dnaproj_file, RECREATE_STAGE_FILES, 
113✔
1901
                yesno_string(settings_.a.recreate_stage_files));                                                                        // Recreate stage files
113✔
1902
        PrintRecord(dnaproj_file, PURGE_STAGE_FILES, 
113✔
1903
                yesno_string(settings_.a.purge_stage_files));                                                                                // Purge stage files
113✔
1904

1905
        PrintRecord(dnaproj_file, TYPE_B_GLOBAL, settings_.a.type_b_global);                                        // Global Type B uncertainties
113✔
1906
        PrintRecord(dnaproj_file, TYPE_B_FILE, leafStr<string>(settings_.a.type_b_file));                // Type B uncertainty file
113✔
1907
        
1908
        dnaproj_file << endl;
113✔
1909

1910
        ////////////////////////////////////////////////////////////////////////////////////////////////
1911
        // #output
1912
        ss.str("");
226✔
1913
        ss << section_output << " (" << PRINT_VAR_PAD << ")";
113✔
1914
        PrintRecord(dnaproj_file, ss.str(), "VALUE");
113✔
1915
        dnaproj_file << OUTPUTLINE << endl;
113✔
1916

1917
        PrintRecord(dnaproj_file, OUTPUT_MSR_TO_STN, 
113✔
1918
                yesno_string(settings_.o._msr_to_stn));
113✔
1919
        PrintRecord(dnaproj_file, OUTPUT_MSR_TO_STN_SORTBY, settings_.o._sort_msr_to_stn);
113✔
1920
        PrintRecord(dnaproj_file, OUTPUT_ADJ_STN_ITER, 
113✔
1921
                yesno_string(settings_.o._adj_stn_iteration));
113✔
1922
        PrintRecord(dnaproj_file, OUTPUT_ADJ_STAT_ITER, 
113✔
1923
                yesno_string(settings_.o._adj_stat_iteration));
113✔
1924
        PrintRecord(dnaproj_file, OUTPUT_ADJ_MSR_ITER, 
113✔
1925
                yesno_string(settings_.o._adj_msr_iteration));
113✔
1926
        PrintRecord(dnaproj_file, OUTPUT_CMP_MSR_ITER, 
113✔
1927
                yesno_string(settings_.o._cmp_msr_iteration));
113✔
1928
        PrintRecord(dnaproj_file, OUTPUT_ADJ_MSR, 
113✔
1929
                yesno_string(settings_.o._adj_msr_final));
113✔
1930
        PrintRecord(dnaproj_file, OUTPUT_ADJ_GNSS_UNITS, 
113✔
1931
                settings_.o._adj_gnss_units);        
113✔
1932
        PrintRecord(dnaproj_file, OUTPUT_ADJ_MSR_TSTAT, 
113✔
1933
                yesno_string(settings_.o._adj_msr_tstat));
113✔
1934

1935
        PrintRecord(dnaproj_file, OUTPUT_ADJ_MSR_SORTBY, settings_.o._sort_adj_msr);
113✔
1936

1937
        PrintRecord(dnaproj_file, OUTPUT_ADJ_MSR_DBID, 
113✔
1938
                yesno_string(settings_.o._database_ids));                        
113✔
1939
        
1940
        PrintRecord(dnaproj_file, OUTPUT_ADJ_MSR_BLOCKS, 
113✔
1941
                yesno_string(settings_.o._output_msr_blocks));                                
113✔
1942
        PrintRecord(dnaproj_file, OUTPUT_ADJ_STN_SORT_ORDER, 
113✔
1943
                yesno_string(settings_.o._sort_stn_file_order));                        
113✔
1944
        PrintRecord(dnaproj_file, OUTPUT_STN_COORD_TYPES, settings_.o._stn_coord_types);
113✔
1945
        PrintRecord(dnaproj_file, OUTPUT_ANGULAR_TYPE_STN, settings_.o._angular_type_stn);
113✔
1946
        PrintRecord(dnaproj_file, OUTPUT_STN_CORR, 
113✔
1947
                yesno_string(settings_.o._stn_corr));
113✔
1948
        PrintRecord(dnaproj_file, OUTPUT_PRECISION_METRES_STN, settings_.o._precision_metres_stn);        
113✔
1949
        PrintRecord(dnaproj_file, OUTPUT_PRECISION_SECONDS_STN, settings_.o._precision_seconds_stn);
113✔
1950
        PrintRecord(dnaproj_file, OUTPUT_PRECISION_METRES_MSR, settings_.o._precision_metres_msr);        
113✔
1951
        PrintRecord(dnaproj_file, OUTPUT_PRECISION_SECONDS_MSR, settings_.o._precision_seconds_msr);
113✔
1952
        PrintRecord(dnaproj_file, OUTPUT_ANGULAR_TYPE_MSR, settings_.o._angular_type_msr);
113✔
1953
        PrintRecord(dnaproj_file, OUTPUT_DMS_FORMAT_MSR, settings_.o._dms_format_msr);                                
113✔
1954
        PrintRecord(dnaproj_file, OUTPUT_POS_UNCERTAINTY, 
113✔
1955
                yesno_string(settings_.o._positional_uncertainty));
113✔
1956
        PrintRecord(dnaproj_file, OUTPUT_APU_CORRELATIONS, 
113✔
1957
                yesno_string(settings_.o._output_pu_covariances));                
113✔
1958
        
1959
        PrintRecord(dnaproj_file, OUTPUT_APU_UNITS, 
113✔
1960
                settings_.o._apu_vcv_units);
113✔
1961

1962
        PrintRecord(dnaproj_file, OUTPUT_STN_COR_FILE, 
113✔
1963
                yesno_string(settings_.o._init_stn_corrections));
113✔
1964
        
1965
        ss.str("");
226✔
1966
        ss << fixed << setprecision(3) << settings_.o._hz_corr_threshold;
113✔
1967
        PrintRecord(dnaproj_file, HZ_CORR_THRESHOLD, ss.str());                                
113✔
1968
        ss.str("");
226✔
1969
        ss << fixed << setprecision(3) << settings_.o._vt_corr_threshold;
113✔
1970
        PrintRecord(dnaproj_file, VT_CORR_THRESHOLD, ss.str());                                
113✔
1971
        
1972
        PrintRecord(dnaproj_file, EXPORT_XML_STN_FILE, 
113✔
1973
                yesno_string(settings_.o._export_xml_stn_file));                                        
113✔
1974
        PrintRecord(dnaproj_file, EXPORT_DNA_STN_FILE, 
113✔
1975
                yesno_string(settings_.o._export_dna_stn_file));                                        
113✔
1976
        PrintRecord(dnaproj_file, EXPORT_SNX_FILE, 
113✔
1977
                yesno_string(settings_.o._export_snx_file));                                        
113✔
1978
        
1979
        dnaproj_file << endl;
113✔
1980

1981
        ////////////////////////////////////////////////////////////////////////////////////////////////
1982
        // #plot
1983
        ss.str("");
226✔
1984
        ss << section_plot << " (" << PRINT_VAR_PAD << ")";
113✔
1985
        PrintRecord(dnaproj_file, ss.str(), "VALUE");
113✔
1986
        dnaproj_file << OUTPUTLINE << endl;
113✔
1987
        
1988
        dnaproj_file << endl;
113✔
1989

1990
        dnaproj_file.close();
113✔
1991
}
113✔
1992

1993

1994

1995
}        // 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

© 2025 Coveralls, Inc