Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tgocassisrdrgen exported label re-order. #3135

Merged
merged 7 commits into from
Mar 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 63 additions & 5 deletions isis/src/base/objs/ProcessExportPds4/ProcessExportPds4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ namespace Isis {
QString timeValue = stopTime.text();
PvlToXmlTranslationManager::resetElementValue(stopTime, timeValue + "Z");
}

}

QDomElement obsSysNode = obsAreaNode.firstChildElement("Observing_System");
Expand Down Expand Up @@ -277,26 +276,85 @@ namespace Isis {
// move target to just below Observing_System.
QDomElement targetIdNode = obsAreaNode.firstChildElement("Target_Identification");
obsAreaNode.insertAfter(targetIdNode, obsAreaNode.firstChildElement("Observing_System"));

}
else if (inputLabel->findObject("IsisCube").hasGroup("Mapping")) {

translationFileName = "$base/translations/pds4ExportTargetFromMapping.trn";
PvlToXmlTranslationManager targXlator(*inputLabel, translationFileName.expanded());
targXlator.Auto(*m_domDoc);

}
else {
throw IException(IException::Unknown, "Unable to find a target in input cube.", _FILEINFO_);
}
}


/**
* This method reorders the existing m_domDoc to follow PDS4 standards and fixes time formatting
* if needed.
*/
void ProcessExportPds4::reorder() {
QDomElement obsAreaNode = m_domDoc->documentElement().firstChildElement("Observation_Area");
if ( !obsAreaNode.isNull() ) {

// fix start/stop times, if needed
QDomElement timeNode = obsAreaNode.firstChildElement("Time_Coordinates");
if (!timeNode.isNull()) {
QDomElement startTime = timeNode.firstChildElement("start_date_time");
if (startTime.text() == "") {
startTime.setAttribute("xsi:nil", "true");
}
else {
QString timeValue = startTime.text();
PvlToXmlTranslationManager::resetElementValue(startTime, timeValue + "Z");
}
QDomElement stopTime = timeNode.firstChildElement("stop_date_time");
if (stopTime.text() == "") {
stopTime.setAttribute("xsi:nil", "true");
}
else {
QString timeValue = stopTime.text();
PvlToXmlTranslationManager::resetElementValue(stopTime, timeValue + "Z");
}
}
QDomElement investigationAreaNode = obsAreaNode.firstChildElement("Investigation_Area");
obsAreaNode.insertAfter(investigationAreaNode, obsAreaNode.firstChildElement("Time_Coordinates"));

QDomElement obsSystemNode = obsAreaNode.firstChildElement("Observing_System");
obsAreaNode.insertAfter(obsSystemNode, obsAreaNode.firstChildElement("Investigation_Area"));

QDomElement targetIdNode = obsAreaNode.firstChildElement("Target_Identification");
obsAreaNode.insertAfter(targetIdNode, obsAreaNode.firstChildElement("Observing_System"));

QDomElement missionAreaNode = obsAreaNode.firstChildElement("Mission_Area");
obsAreaNode.insertAfter(missionAreaNode, obsAreaNode.firstChildElement("Target_Identification"));

QDomElement disciplineAreaNode = obsAreaNode.firstChildElement("Discipline_Area");
obsAreaNode.insertAfter(disciplineAreaNode, obsAreaNode.firstChildElement("Mission_Area"));
}

QDomElement identificationAreaNode = m_domDoc->documentElement().firstChildElement("Identification_Area");
if ( !identificationAreaNode.isNull() ) {
QDomElement aliasListNode = identificationAreaNode.firstChildElement("Alias_List");
identificationAreaNode.insertAfter(aliasListNode, identificationAreaNode.firstChildElement("product_class"));
}

QDomElement fileAreaObservationalNode = m_domDoc->documentElement().firstChildElement("File_Area_Observational");
QDomElement array2DImageNode = fileAreaObservationalNode.firstChildElement("Array_2D_Image");
if ( !array2DImageNode.isNull() ) {
QDomElement descriptionNode = array2DImageNode.firstChildElement("description");
array2DImageNode.insertAfter(descriptionNode, array2DImageNode.firstChildElement("axis_index_order"));
}
}

/**
* Allows mission specific programs to set logical_identifier
* required for PDS4 labels. This value is added to the xml file
* by the identificationArea() method.
*
* The input value will be converted to all-lowercase if not already
* in line with PDS4 requirements.
*
* The input string should be colon separated string with 6
* identifiers:
*
Expand All @@ -318,7 +376,7 @@ namespace Isis {
* compliant labels.
*/
void ProcessExportPds4::setLogicalId(QString lid) {
m_lid = lid;
m_lid = lid.toLower();
}


Expand Down Expand Up @@ -355,7 +413,7 @@ namespace Isis {
}


/**
/**
* Allows mission specific programs to use specified
* versions of dictionaries.
*
Expand Down
2 changes: 1 addition & 1 deletion isis/src/base/objs/ProcessExportPds4/ProcessExportPds4.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ namespace Isis {

static void translateUnits(QDomDocument &label,
QString transMapFile = "$base/translations/pds4ExportUnits.pvl");

void reorder();
void addSchema(QString sch, QString xsd, QString xmlns, QString xmlnsURI) ;
protected:
void identificationArea();
Expand Down
6 changes: 5 additions & 1 deletion isis/src/tgo/apps/tgocassisrdrgen/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ void IsisMain() {
"xmlns",
"http://psa.esa.int/psa/em16/cas/v1");*/

process.addSchema("CASSIS_1010.sch",
"CASSIS_1010.xsd",
"xmlns:cassis",
"local");
// Add geometry schema for mosaics
if (label->findObject("IsisCube").hasGroup("Mosaic")) {
process.addSchema("PDS4_GEOM_1B00_1610.sch",
Expand All @@ -117,7 +121,6 @@ void IsisMain() {
"https://pds.jpl.nasa.gov/datastandards/schema/released/geom/v1");
}


/*
* Add additional pds label data here
*/
Expand All @@ -135,6 +138,7 @@ void IsisMain() {
cubeLab.Auto(pdsLabel);

ProcessExportPds4::translateUnits(pdsLabel);
process.reorder();

QString outFile = ui.GetFileName("TO");

Expand Down