Skip to content

Commit 39c30fb

Browse files
committed
Fix handling of user-supplied epoch
1 parent 880ce22 commit 39c30fb

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

dynadjust/dynadjust/dnaimportwrapper/dnaimportwrapper.cpp

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,24 +1017,28 @@ int ImportDataFiles(dna_import& parserDynaML, vdnaStnPtr* vStations, vdnaMsrPtr*
10171017
p.r.reference_frame = inputFileDatum;
10181018
}
10191019

1020-
if (inputFileEpoch.empty())
1020+
if (!p.i.user_supplied_epoch)
10211021
{
1022-
// Has an epoch been provided but no frame?
1023-
if (inputFileEpsg.empty())
1024-
// revert to epoch of
1025-
p.i.epoch = referenceepochFromEpsgCode<UINT32>(inputFileEpsgi);
1022+
if (inputFileEpoch.empty())
1023+
{
1024+
// Has an epoch been provided but no frame?
1025+
if (inputFileEpsg.empty())
1026+
// revert to epoch of
1027+
p.i.epoch = referenceepochFromEpsgCode<UINT32>(inputFileEpsgi);
1028+
else
1029+
p.i.epoch = referenceepochFromEpsgString<std::string>(projctEpsgCode);
1030+
p.r.epoch = p.i.epoch;
1031+
}
10261032
else
1027-
p.i.epoch = referenceepochFromEpsgString<std::string>(projctEpsgCode);
1028-
p.r.epoch = p.i.epoch;
1029-
}
1030-
else
1031-
{
1032-
p.i.epoch = inputFileEpoch;
1033-
p.r.epoch = p.i.epoch;
1033+
{
1034+
p.i.epoch = inputFileEpoch;
1035+
p.r.epoch = p.i.epoch;
1036+
}
10341037
}
10351038

10361039
try {
1037-
// Initialise the 'default' datum (frame and epoch) for the project, from the first file.
1040+
// Initialise the 'default' datum (frame and epoch) for the project, from the first file, unless the
1041+
// frame and epoch have been set by the user, in which case InitialiseDatum has already initialised the datum.
10381042
parserDynaML.InitialiseDatum(p.i.reference_frame, p.i.epoch);
10391043
}
10401044
catch (const XMLInteropException& e) {
@@ -1516,7 +1520,10 @@ int main(int argc, char* argv[])
15161520
// if adjust is called without reftran, it reflects the datum
15171521
// supplied on import
15181522
p.r.reference_frame = p.i.reference_frame;
1519-
p.r.epoch = referenceepochFromEpsgCode<UINT32>(epsgCode);
1523+
if (p.i.user_supplied_epoch)
1524+
p.r.epoch = p.i.epoch;
1525+
else
1526+
p.r.epoch = referenceepochFromEpsgCode<UINT32>(epsgCode);
15201527

15211528
///////////////////////////////////////////////////////////////////////////////////////////////////////////
15221529
// start "total" time

0 commit comments

Comments
 (0)