Commit 9c14209d authored by Kristin Berry's avatar Kristin Berry
Browse files

PROG: Several fixes for things broken by the isis2pds4-related updates. References #5202

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@8279 41f8697f-d340-4b68-9986-7bafba869bb8
parent c4e9bbcf
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
#include "Isis.h"

#include <QString>

#include "Application.h"
#include "Cube.h"
#include "ExportDescription.h"
#include "FileName.h"
#include "Process.h"
#include "ProcessExportPds.h"
#include "ProcessExportPds4.h"
#include "Pvl.h"
#include "PvlKeyword.h"
#include "PvlToXmlTranslationManager.h"

+4 −2
Original line number Diff line number Diff line
@@ -5,8 +5,10 @@ include $(ISISROOT)/make/isismake.tsts
commands:
	$(APPNAME) from=$(INPUT)/dawnEqui1.cub to=$(OUTPUT)/dawnEqui.img pdsversion=pds4 > /dev/null;

	# Change the output xml file to a txt file for test comparison
	mv $(OUTPUT)/dawnEqui.xml $(OUTPUT)/dawnEqui.txt > /dev/null;
	# Remove parts of output that can occur in any order and convert to txt for comparison
	$(SED) 's+\Product_Observational.*>+\Product_Observational>+' \
	       $(OUTPUT)/dawnEqui.xml > $(OUTPUT)/dawnEqui.txt;

	$(RM) $(OUTPUT)/dawnEqui.xml > /dev/null; 
	$(RM) $(OUTPUT)/dawnEqui.img > /dev/null; 
+1 −1
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ namespace Isis {
        }
        catch(IException &e) {
          if(!IsOptional(g.name())) {
            throw;
            throw e;//??? is this needed???
          }
        }
      }
+80 −70
Original line number Diff line number Diff line
@@ -99,20 +99,53 @@ namespace Isis {
    //TODO Figure out what needs to be in FixedImageRoot and add a try catch around it if needed
    FixedImageRoot();

    // TODO: identification area
    // <Identification_Area>
    //   <!--
    //    A product is one multiband image tile. 54 tiles cover the whole planet. 
    //   -->
    //   <logical_identifier>
    //   urn:nasa:pds:izenberg_pdart14_meap:data_imagecube:virs_cube_64ppd_h07nw
    //   </logical_identifier>
    //   <version_id>1.0</version_id>
    //   <title>VIRS Spectral Cube of Mercury Tile 07NW</title>
    //   <information_model_version>1.7.0.0</information_model_version>
    //   <product_class>Product_Observational</product_class>
    // </Identification_Area>

    

    try {
      StandardImageImage();
      standardInstrument();
    }
    catch (IException &e) {
      QString msg = "Unable to translate and export standard image information.";
      QString msg = "Unable to translate and export instrument information.";
      throw IException(e, IException::Programmer, msg, _FILEINFO_);
    }
    try {
      displaySettings();
    }
    catch (IException &e) {
      QString msg = "Unable to translate and export display settings.";
      throw IException(e, IException::Programmer, msg, _FILEINFO_);
    }
    try {
      // <Discipline_Area>
      // display settings, and cartography handled in this method:
      StandardAllMapping();
    }
    catch (IException &e) {
      QString msg = "Unable to translate and export mapping group.";
      throw IException(e, IException::Programmer, msg, _FILEINFO_);
    }
    try {
      // file observation area
      StandardImageImage();
    }
    catch (IException &e) {
      QString msg = "Unable to translate and export standard image information.";
      throw IException(e, IException::Programmer, msg, _FILEINFO_);
    }
  }


@@ -132,15 +165,31 @@ namespace Isis {
  }


  void ProcessExportPds4::standardInstrument() {
    Pvl *inputLabel = InputCubes[0]->label(); 
    FileName transfile;
    transfile = "$base/translations/pds4ExportInstrument.trn";
    PvlToXmlTranslationManager xlator(*inputLabel, transfile.expanded());
    xlator.Auto(*m_domDoc);
  }
  void ProcessExportPds4::displaySettings() {
    // 1) TODO: display settings local internal reference
    // 2) display direction
    Pvl *inputLabel = InputCubes[0]->label(); 
    FileName transfile;
    transfile = "$base/translations/pds4ExportDisplaySettings.trn";
    PvlToXmlTranslationManager xlator(*inputLabel, transfile.expanded());
    xlator.Auto(*m_domDoc);
  }


  /**
   * Create and internalize a standard image output label from the input image.
   */
  void ProcessExportPds4::StandardImageImage() {

      try {
    Pvl *inputLabel = InputCubes[0]->label(); 
    FileName transfile;
        transfile = "$base/translations/pds4Export.trn";
    transfile = "$base/translations/pds4ExportFileArea.trn";
    PvlToXmlTranslationManager xlator(*inputLabel, transfile.expanded());
    xlator.Auto(*m_domDoc);

@@ -171,46 +220,6 @@ namespace Isis {
        elementArrayElement.appendChild(offsetElement);
      }
    }

        
    //    QDomElement observationAreaElement = rootElement.firstChildElement("Observation_Area");
    //    if (observationAreaElement.isNull()) {
    //        observationAreaElement = m_domDoc->createElement("Observation_Area"); 
    //        rootElement.appendChild(observationAreaElement);
    //    }
    //
    //    QDomElement disciplineAreaElement = observationAreaElement.firstChildElement("Discipline_Area");
    //    if (disciplineAreaElement.isNull()) {
    //        disciplineAreaElement = m_domDoc->createElement("Discipline_Area"); 
    //        observationAreaElement.appendChild(disciplineAreaElement);
    //    }
    //
    //    QDomElement displaySettingsElement = m_domDoc->createElement("disp:Display_Settings");
    //    disciplineAreaElement.appendChild(displaySettingsElement);
    //
    //    QDomElement displayDirectionElement    = m_domDoc->createElement("disp:Display_Direction");
    //    displaySettingsElement.appendChild(displayDirectionElement);
    //
    //    QDomElement horizontalAxisElement = m_domDoc->createElement("disp:horizontal_display_axis");
    //    PvlToXmlTranslationManager::setElementValue(horizontalAxisElement, "Sample");
    //    displayDirectionElement.appendChild(horizontalAxisElement);
    //
    //    QDomElement horizontalDirectionElement = m_domDoc->createElement("disp:horizontal_display_direction");
    //    PvlToXmlTranslationManager::setElementValue(horizontalDirectionElement, "Left To Right");
    //    displayDirectionElement.appendChild(horizontalDirectionElement);
    //
    //    QDomElement verticalAxisElement = m_domDoc->createElement("disp:vertical_display_axis");
    //    PvlToXmlTranslationManager::setElementValue(verticalAxisElement, "Line");
    //    displayDirectionElement.appendChild(verticalAxisElement);
    //
    //    QDomElement verticalDirectionElement = m_domDoc->createElement("disp:vertical_display_direction");
    //    PvlToXmlTranslationManager::setElementValue(verticalDirectionElement, "Top To Bottom");
    //    displayDirectionElement.appendChild(verticalDirectionElement);
    //
      } 
      catch (IException &e) {
          throw IException(e, IException::Programmer, "Unable to translate image and display labels.", _FILEINFO_);
      }
  }


@@ -292,6 +301,7 @@ namespace Isis {
                              "This projection is not supported in ISIS3."
   */
  void ProcessExportPds4::StandardAllMapping() {
    // Cartography
    // Get the input Isis cube label and find the Mapping group if it has one
    Pvl *inputLabel = InputCubes[0]->label();
    if(inputLabel->hasObject("IsisCube") &&
@@ -471,7 +481,7 @@ namespace Isis {
      // return;
    }
    QString parentName = xmlPath[0];
    //if (parentName != baseElement) {
    //if (parentName != baseElement) { TODO???
    //  // throw error - improper use of this method
    //}
    for (int i = 1; i < xmlPath.size(); i++) {
+5 −0
Original line number Diff line number Diff line
@@ -51,6 +51,9 @@ namespace Isis {
   *   @history 2017-10-18 Jeannie Backer & Makayla Shepherd - Added convenience method getElement
   *                           and StandardAllMapping method to translate mapping information.
   *                           See #5202.
   *   @history 2017-10-31 Jeannie Backer - Added standardInstrument() and displaySettings()
   *                           translations.
   *  
   */

  class ProcessExportPds4: public Isis::ProcessExport {
@@ -79,6 +82,8 @@ namespace Isis {

    protected:

      void standardInstrument();
      void displaySettings();
      QDomDocument *m_domDoc;               //!< XML label

  };
Loading