Skip to content

Commit a6e2cca

Browse files
authored
Merge pull request #175 from rogerfraser/master
Version 1.2.4 release candidate 1
2 parents b9ee808 + 1dab954 commit a6e2cca

30 files changed

+1657
-241
lines changed

dynadjust/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 3.0)
22

33
project (dynadjust)
44

5-
set (DYNADJUST_VERSION "1.2.2")
5+
set (DYNADJUST_VERSION "1.2.4")
66

77
if (BUILD_TESTING)
88
enable_testing()

dynadjust/dynadjust/dnaadjust/dnaadjust.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13942,6 +13942,9 @@ void dna_adjust::SetDefaultReferenceFrame()
1394213942
// * If dnareftran has been run, every station and measurement record will
1394313943
// have been transformed to the one frame and epoch. These reference frame
1394413944
// records will be consistent with the bst/bms_meta.
13945+
// * If the user has not specified an epoch with WGS84, then the epoch will
13946+
// be set to "time immemorial" being 01.01.1900. Any occurrence of this will
13947+
// cause output to be set to an empty string ("").
1394513948
try {
1394613949
// Load binary stations data. Throws runtime_error on failure.
1394713950
dna_io_bst bst;

dynadjust/dynadjust/dnaimport/dnainterop.cpp

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ void dna_import::UpdateEpoch(const vifm_t* vinput_file_meta)
193193
// Do nothing
194194
return;
195195

196+
if (dateFromString<date>(epoch) == timeImmemorial<date>())
197+
epoch = "";
198+
196199
m_strProjectDefaultEpoch = epoch;
197200

198201
// Set default epoch
@@ -223,6 +226,9 @@ void dna_import::InitialiseDatum(const string& reference_frame)
223226
m_strProjectDefaultEpsg = datum_.GetEpsgCode_s();
224227
m_strProjectDefaultEpoch = datum_.GetEpoch_s();
225228

229+
if (datum_.GetEpoch() == timeImmemorial<date>())
230+
m_strProjectDefaultEpoch = "";
231+
226232
// Update binary file meta
227233
// Note: the following rule applies each time a new file is loaded:
228234
// * This method (InitialiseDatum) is called (from dnaimportwrapper) before any files are loaded
@@ -1196,7 +1202,7 @@ void dna_import::ParseDNA(const string& fileName, vdnaStnPtr* vStations, PUINT32
11961202
import_file_mutex.unlock();
11971203
}
11981204
catch (const runtime_error& e) {
1199-
SignalExceptionParse(static_cast<string>(e.what()), 0);
1205+
throw XMLInteropException(e.what(), 0);
12001206
}
12011207

12021208
// Station file
@@ -1221,14 +1227,14 @@ void dna_import::ParseDNA(const string& fileName, vdnaStnPtr* vStations, PUINT32
12211227
}
12221228
stringstream ss;
12231229
ss << "ParseDNA(): An ios_base failure was encountered when attempting to read stations file " << fileName << "." << endl << " " << f.what();
1224-
SignalExceptionParse(ss.str(), 0);
1230+
throw XMLInteropException(ss.str(), 0);
12251231
}
12261232
catch (const XMLInteropException& f) {
12271233
stringstream ss;
12281234
ss << " - line " << m_lineNo;
12291235
ss << ", column " << m_columnNo << endl;
12301236
ss << " - " << f.what();
1231-
SignalExceptionParse(ss.str(), 0);
1237+
throw XMLInteropException(ss.str(), 0);
12321238
}
12331239
catch (...) {
12341240
if (ifsInputFILE_->eof())
@@ -1239,7 +1245,7 @@ void dna_import::ParseDNA(const string& fileName, vdnaStnPtr* vStations, PUINT32
12391245
}
12401246
stringstream ss;
12411247
ss << "ParseDNA(): An error was encountered when attempting to read stations file " << fileName << ".";
1242-
SignalExceptionParse(ss.str(), 0);
1248+
throw XMLInteropException(ss.str(), 0);
12431249
}
12441250
}
12451251
else if (idt == msr_data ||
@@ -1263,14 +1269,14 @@ void dna_import::ParseDNA(const string& fileName, vdnaStnPtr* vStations, PUINT32
12631269
}
12641270
stringstream ss;
12651271
ss << "ParseDNA(): An ios_base failure was encountered when attempting to read measurements file " << fileName << "." << endl << " " << f.what();
1266-
SignalExceptionParse(ss.str(), 0);
1272+
throw XMLInteropException(ss.str(), 0);
12671273
}
12681274
catch (const XMLInteropException& f) {
12691275
stringstream ss;
12701276
ss << endl << " - line " << m_lineNo;
12711277
ss << ", column " << m_columnNo << endl;
12721278
ss << " - " << f.what();
1273-
SignalExceptionParse(ss.str(), 0);
1279+
throw XMLInteropException(ss.str(), 0);
12741280
}
12751281
catch (...) {
12761282
if (ifsInputFILE_->eof())
@@ -1283,7 +1289,7 @@ void dna_import::ParseDNA(const string& fileName, vdnaStnPtr* vStations, PUINT32
12831289
ss << "ParseDNA(): An error was encountered when attempting to read measurements file " << fileName << "." << endl;
12841290
ss << " - line " << m_lineNo;
12851291
ss << ", column " << m_columnNo << endl;
1286-
SignalExceptionParse(ss.str(), 0);
1292+
throw XMLInteropException(ss.str(), 0);
12871293
}
12881294
}
12891295
}
@@ -1312,7 +1318,6 @@ void dna_import::ParseDNASTN(vdnaStnPtr* vStations, PUINT32 stnCount, string* su
13121318

13131319
try {
13141320
getline((*ifsInputFILE_), sBuf);
1315-
stn_ptr.reset(new CDnaStation(datum_.GetName(), datum_.GetEpoch_s()));
13161321
}
13171322
catch (...) {
13181323
if (ifsInputFILE_->eof())
@@ -1342,6 +1347,9 @@ void dna_import::ParseDNASTN(vdnaStnPtr* vStations, PUINT32 stnCount, string* su
13421347
if (sBuf.compare(0, 1, "*") == 0)
13431348
continue;
13441349

1350+
// initialise new station
1351+
stn_ptr.reset(new CDnaStation(datum_.GetName(), datum_.GetEpoch_s()));
1352+
13451353
stn_ptr->SetfileOrder(g_fileOrder++);
13461354

13471355
// name
@@ -1953,7 +1961,17 @@ void dna_import::ParseDNAMSRGPSBaselines(string& sBuf, dnaMsrPtr& msr_ptr, bool
19531961
// Get the epoch from the file
19541962
tmp = ParseEpochValue(sBuf, "ParseDNAMSRGPSBaselines");
19551963

1956-
if (!tmp.empty())
1964+
if (tmp.empty())
1965+
{
1966+
if (isEpsgWGS84Ensemble(epsgCodeFromName<UINT32, string>(msr_ptr->GetReferenceFrame())))
1967+
{
1968+
// Set the cluster epoch
1969+
msr_ptr->SetEpoch("");
1970+
// Set the baseline epoch
1971+
bslTmp.SetEpoch("");
1972+
}
1973+
}
1974+
else
19571975
{
19581976
// Set the cluster epoch
19591977
msr_ptr->SetEpoch(tmp);
@@ -2176,7 +2194,17 @@ void dna_import::ParseDNAMSRGPSPoints(string& sBuf, dnaMsrPtr& msr_ptr, bool ign
21762194
// Get the epoch from the file
21772195
tmp = ParseEpochValue(sBuf, "ParseDNAMSRGPSPoints");
21782196

2179-
if (!tmp.empty())
2197+
if (tmp.empty())
2198+
{
2199+
if (isEpsgWGS84Ensemble(epsgCodeFromName<UINT32, string>(msr_ptr->GetReferenceFrame())))
2200+
{
2201+
// Set the cluster epoch
2202+
msr_ptr->SetEpoch("");
2203+
// Set the baseline epoch
2204+
pntTmp.SetEpoch("");
2205+
}
2206+
}
2207+
else
21802208
{
21812209
// Set the cluster epoch
21822210
msr_ptr->SetEpoch(tmp);
@@ -2389,6 +2417,7 @@ string dna_import::ParseAngularValue(const string& sBuf, const string& calling_f
23892417
{
23902418
string parsed_value, tmp;
23912419
double d;
2420+
UINT32 u;
23922421

23932422
// degrees value
23942423
try {
@@ -2402,10 +2431,10 @@ string dna_import::ParseAngularValue(const string& sBuf, const string& calling_f
24022431
// minutes value
24032432
try {
24042433
tmp = trimstr(sBuf.substr(dml_.msr_ang_m, dmw_.msr_ang_m));
2405-
d = DoubleFromString<double>(tmp);
2406-
if (d < 10 && tmp.at(0) != '0')
2434+
u = LongFromString<UINT32>(tmp);
2435+
if (u < 10)
24072436
parsed_value.append("0");
2408-
parsed_value.append(tmp);
2437+
parsed_value.append(StringFromT<UINT32>(u));
24092438
}
24102439
catch (...) {
24112440
SignalExceptionParseDNA(calling_function + "(): Could not extract minutes value from the record: ",

dynadjust/dynadjust/dnaimportwrapper/dnaimportwrapper.cpp

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,9 @@ int ImportDataFiles(dna_import& parserDynaML, vdnaStnPtr* vStations, vdnaMsrPtr*
735735
//
736736
UINT32 stnCount(0), msrCount(0), clusterID(0);
737737

738+
// obtain the project reference frame
739+
string epsgCode(epsgStringFromName<string>(p.i.reference_frame));
740+
738741
size_t pos = string::npos;
739742
size_t strlen_arg = 0;
740743
for_each(p.i.input_files.begin(), p.i.input_files.end(),
@@ -857,7 +860,6 @@ int ImportDataFiles(dna_import& parserDynaML, vdnaStnPtr* vStations, vdnaMsrPtr*
857860

858861
// Produce a warning if the input file's default reference frame
859862
// is different to the project reference frame
860-
string epsgCode(epsgStringFromName<string>(p.i.reference_frame));
861863
string inputFileEpsg;
862864
try {
863865
inputFileEpsg = datumFromEpsgString<string>(input_file_meta.epsgCode);
@@ -870,7 +872,6 @@ int ImportDataFiles(dna_import& parserDynaML, vdnaStnPtr* vStations, vdnaMsrPtr*
870872
{
871873
stringstream ssEpsgWarning;
872874

873-
874875
ssEpsgWarning << "- Warning: Input file reference frame (" << inputFileEpsg <<
875876
") does not match the " << endl << " default reference frame.";
876877
if (!p.g.quiet)
@@ -1288,6 +1289,14 @@ int main(int argc, char* argv[])
12881289
return EXIT_FAILURE;
12891290
}
12901291

1292+
// obtain the project reference frame
1293+
UINT32 epsgCode(epsgCodeFromName<UINT32>(p.i.reference_frame));
1294+
1295+
///////////////////////////////////////////////////////////////////////////////////////////////////////////
1296+
// start "total" time
1297+
cpu_timer time;
1298+
1299+
12911300
// Import discontinuity file and apply discontinuities
12921301
// Due to the structure and format of SINEX files, it is essential that
12931302
// discontinuities be parsed prior to reading any SINEX files.
@@ -1337,10 +1346,6 @@ int main(int argc, char* argv[])
13371346
}
13381347
}
13391348

1340-
///////////////////////////////////////////////////////////////////////////////////////////////////////////
1341-
// start "total" time
1342-
cpu_timer time;
1343-
13441349
// Import network information based on a segmentation block?
13451350
if (p.i.import_block)
13461351
{
@@ -2376,7 +2381,23 @@ int main(int argc, char* argv[])
23762381
{
23772382
cout << "- Warning: some files were not parsed - please read the log file for more details." << endl;
23782383
imp_file << "- Warning: some files were not parsed - please read the log file for more details." << endl;
2379-
}
2384+
}
2385+
2386+
// Produce a warning if an ensemble is set as the default reference frame
2387+
if (isEpsgWGS84Ensemble(epsgCode))
2388+
{
2389+
stringstream ssEnsembleWarning;
2390+
ssEnsembleWarning << endl <<
2391+
"- Warning: The '" << p.i.reference_frame << "' reference frame set for this project refers to the" << endl <<
2392+
" \"World Geodetic System 1984 (WGS 84) ensemble\". The WGS 84 ensemble is" << endl <<
2393+
" only suitable for low accuracy (metre level) positioning and does not" << endl <<
2394+
" provide for precise transformations to other well-known reference frames." << endl <<
2395+
" To achieve reliable adjustment results from data on WGS 84, please refer" << endl <<
2396+
" to \"Configuring import options\" in the DynAdjust User's Guide." << endl;
2397+
if (!p.g.quiet)
2398+
cout << ssEnsembleWarning.str();
2399+
imp_file << ssEnsembleWarning.str();
2400+
}
23802401

23812402
milliseconds elapsed_time(milliseconds(time.elapsed().wall/MILLI_TO_NANO));
23822403
string time_message = formatedElapsedTime<string>(&elapsed_time, "+ Total file handling process took ");

dynadjust/dynadjust/dnaimportwrapper/dnaimportwrapper.vcxproj.user

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
4-
<LocalDebuggerCommandArguments>-n ps2 vic2ex.simult.adj.stn pseudo-driver-file-2.msr --simulate --geo geoidef.geo --export-dna</LocalDebuggerCommandArguments>
5-
<LocalDebuggerWorkingDirectory>$(DIST)_git_issues\print-ignored-msrs</LocalDebuggerWorkingDirectory>
4+
<LocalDebuggerCommandArguments>-n 09139test 09139.stn 09139.msr --export-dna -r "WGS84 (G730)"</LocalDebuggerCommandArguments>
5+
<LocalDebuggerWorkingDirectory>$(DIST)_git_issues\wgs84</LocalDebuggerWorkingDirectory>
66
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
77
</PropertyGroup>
88
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">

dynadjust/dynadjust/dnaplot/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ add_library (${PROJECT_NAME} SHARED
1515
${CMAKE_SOURCE_DIR}/include/parameters/dnaellipsoid.cpp
1616
${CMAKE_SOURCE_DIR}/include/parameters/dnaprojection.cpp
1717
${CMAKE_SOURCE_DIR}/include/functions/dnastringfuncs.cpp
18+
${CMAKE_SOURCE_DIR}/include/functions/dnaprocessfuncs.cpp
1819
${CMAKE_SOURCE_DIR}/include/math/dnamatrix_contiguous.cpp
1920
${CMAKE_SOURCE_DIR}/include/measurement_types/dnamsrtally.cpp
2021
${CMAKE_SOURCE_DIR}/include/measurement_types/dnastation.cpp

0 commit comments

Comments
 (0)