Skip to content

Commit

Permalink
Minor changes to prevent output of unused stations to adjusted statio…
Browse files Browse the repository at this point in the history
…ns file(s)
  • Loading branch information
rogerfraser committed Apr 5, 2021
1 parent 15119dd commit 9a057db
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 22 deletions.
53 changes: 36 additions & 17 deletions dynadjust/dynadjust/dnaadjust/dnaadjust.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2857,7 +2857,7 @@ bool dna_adjust::PrintEstimatedStationCoordinatestoSNX(string& sinex_filename)
}

// This should be put into a class separate to dnaadjust
void dna_adjust::PrintEstimatedStationCoordinatestoDNAXML(const string& stnFile, INPUT_FILE_TYPE t)
void dna_adjust::PrintEstimatedStationCoordinatestoDNAXML(const string& stnFile, INPUT_FILE_TYPE t, bool flagUnused)
{
// Stations
std::ofstream stn_file;
Expand Down Expand Up @@ -2926,32 +2926,51 @@ void dna_adjust::PrintEstimatedStationCoordinatestoDNAXML(const string& stnFile,
CompareStnFileOrder<station_t, UINT32> stnorderCompareFunc(&bstBinaryRecords_);
sort(vStationList.begin(), vStationList.end(), stnorderCompareFunc);

// print header
// print station coordinates
switch (t)
{
case dynaml:

// Print stations in DynaML format
for_each(vStationList.begin(), vStationList.end(),
[&stn_file, &stnPtr, this](const UINT32& stn) {
stnPtr->SetStationRec(bstBinaryRecords_.at(stn));
stnPtr->WriteDNAXMLStnCurrentEstimates(&stn_file,
datum_.GetEllipsoidRef(), &projection_, dynaml);
});
if (flagUnused)
// Print stations in DynaML format
for_each(vStationList.begin(), vStationList.end(),
[&stn_file, &stnPtr, this](const UINT32& stn) {
stnPtr->SetStationRec(bstBinaryRecords_.at(stn));
if (stnPtr->IsNotUnused())
stnPtr->WriteDNAXMLStnCurrentEstimates(&stn_file,
datum_.GetEllipsoidRef(), &projection_, dynaml);
});
else
// Print stations in DynaML format
for_each(vStationList.begin(), vStationList.end(),
[&stn_file, &stnPtr, this](const UINT32& stn) {
stnPtr->SetStationRec(bstBinaryRecords_.at(stn));
stnPtr->WriteDNAXMLStnCurrentEstimates(&stn_file,
datum_.GetEllipsoidRef(), &projection_, dynaml);
});

stn_file << "</DnaXmlFormat>" << endl;

break;
case dna:

// Print stations in DNA format
for_each(vStationList.begin(), vStationList.end(),
[&stn_file, &stnPtr, &dsw, this](const UINT32& stn) {
stnPtr->SetStationRec(bstBinaryRecords_.at(stn));
//if (stnPtr->IsNotUnused())
stnPtr->WriteDNAXMLStnCurrentEstimates(&stn_file,
datum_.GetEllipsoidRef(), &projection_, dna, &dsw);
});
if (flagUnused)
// Print stations in DNA format
for_each(vStationList.begin(), vStationList.end(),
[&stn_file, &stnPtr, &dsw, this](const UINT32& stn) {
stnPtr->SetStationRec(bstBinaryRecords_.at(stn));
if (stnPtr->IsNotUnused())
stnPtr->WriteDNAXMLStnCurrentEstimates(&stn_file,
datum_.GetEllipsoidRef(), &projection_, dna, &dsw);
});
else
// Print stations in DNA format
for_each(vStationList.begin(), vStationList.end(),
[&stn_file, &stnPtr, &dsw, this](const UINT32& stn) {
stnPtr->SetStationRec(bstBinaryRecords_.at(stn));
stnPtr->WriteDNAXMLStnCurrentEstimates(&stn_file,
datum_.GetEllipsoidRef(), &projection_, dna, &dsw);
});

break;
default:
Expand Down
2 changes: 1 addition & 1 deletion dynadjust/dynadjust/dnaadjust/dnaadjust.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ class dna_adjust {
void PrintMeasurementsToStation();

bool PrintEstimatedStationCoordinatestoSNX(string& sinex_file);
void PrintEstimatedStationCoordinatestoDNAXML(const string& stnFile, INPUT_FILE_TYPE t);
void PrintEstimatedStationCoordinatestoDNAXML(const string& stnFile, INPUT_FILE_TYPE t, bool flagUnused = false);

void CloseOutputFiles();
void UpdateBinaryFiles();
Expand Down
19 changes: 15 additions & 4 deletions dynadjust/dynadjust/dnaadjustwrapper/dnaadjustwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,8 @@ void ExportDynaML(dna_adjust* netAdjust, project_settings* p)
cout << "+ Serializing estimated coordinates to " << leafStr<string>(p->o._xml_file) << "... ";

// Export Stations file
netAdjust->PrintEstimatedStationCoordinatestoDNAXML(p->o._xml_file, dynaml);
netAdjust->PrintEstimatedStationCoordinatestoDNAXML(p->o._xml_file, dynaml,
(p->i.flag_unused_stn ? true : false));

if (!p->g.quiet)
cout << "Done." << endl;
Expand All @@ -351,7 +352,8 @@ void ExportDNA(dna_adjust* netAdjust, project_settings* p)
cout << "+ Serializing estimated coordinates to " << leafStr<string>(stnfilename) << "... ";

// Export Station file
netAdjust->PrintEstimatedStationCoordinatestoDNAXML(stnfilename, dna);
netAdjust->PrintEstimatedStationCoordinatestoDNAXML(stnfilename, dna,
(p->i.flag_unused_stn ? true : false));

if (!p->g.quiet)
cout << "Done." << endl;
Expand Down Expand Up @@ -424,16 +426,25 @@ int ParseCommandLineOptions(const int& argc, char* argv[], const variables_map&

p.g.project_file = formPath<string>(p.g.output_folder, p.g.network_name, "dnaproj");

// update geoid file name from dnaproj file (blank if geoid was not run)
if (exists(p.g.project_file))
{
// update import settings from dnaproj file
try {
CDnaProjectFile projectFile(p.g.project_file, importSetting);
p.i = projectFile.GetSettings().i;
}
catch (...) {
// do nothing
}

// update geoid file name from dnaproj file (blank if geoid was not run)
try {
CDnaProjectFile projectFile(p.g.project_file, geoidSetting);
p.n = projectFile.GetSettings().n;
}
catch (...) {
// do nothing
}
}
}

// binary station file location (output)
Expand Down

0 comments on commit 9a057db

Please sign in to comment.