Unverified Commit b80a533f authored by Jesse Mapel's avatar Jesse Mapel Committed by GitHub
Browse files

Merge pull request #63 from kberryUSGS/pep4xmlfix

Update ProcessExportPds4 to treat input of the form filename.xml as a label name
parents 4cbe60fe b17a8898
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -469,7 +469,7 @@ namespace Isis {
   * This method write out the labels and image data to the specified output file.
   * Creates an IMG and XML file.
   * 
   * @param outFile QString of the name of the output file. Will create an XML 
   * @param outFile QString of the name of the output image file. Will create an XML 
   *        and an IMG file with the output file name.
   *
   */
@@ -477,10 +477,20 @@ namespace Isis {
    
    FileName outputFile(outFile);

    // Name for output label
    QString path(outputFile.originalPath());
    QString name(outputFile.baseName());
    QString labelName = path + "/" + name + ".xml";

    // Name for output image
    QString imageName = outputFile.expanded();

    // If input file ends in .xml, the user entered a label name for the output file, not an
    // image name with a unique file extension. 
    if (QString::compare(outputFile.extension(), "xml", Qt::CaseInsensitive) == 0) {
      imageName = path + "/" + name + ".img";
    }

    QDomElement rootElement = m_domDoc->documentElement();
    QDomElement fileAreaObservationalElement =
                    rootElement.firstChildElement("File_Area_Observational");
@@ -501,7 +511,7 @@ namespace Isis {
    OutputLabel(oLabel);
    oLabel.close();
    
    ofstream oCube(outputFile.expanded().toLatin1().data());
    ofstream oCube(imageName.toLatin1().data());
    StartProcess(oCube);
    oCube.close();

+4 −1
Original line number Diff line number Diff line
@@ -68,6 +68,9 @@ namespace Isis {
   *                           Array_3D_Image values properly.
   *   @history 2017-11-21 Kristin Berry - Updated the constructor to add the xml version and 
   *                           encoding to the beginning of the XML file.
   *   @history 2018-02-05 Kristin Berry - Updated WritePds4 to remove the .xml and add a .img
   *                           if the user inputs something of the form filename.xml as the image
   *                           output name. 
   */

  class ProcessExportPds4: public Isis::ProcessExport {
+4 −0
Original line number Diff line number Diff line
@@ -69,6 +69,10 @@ unittest: Exporting
unittest: Exporting
0% Processed
10% Processed
20% Processed
30% Processed
40% Processed
50% Processed
60% Processed
70% Processed
80% Processed
90% Processed
100% Processed

Testing xml input
unittest: Exporting
0% Processed
10% Processed
20% Processed
30% Processed
40% Processed
50% Processed
60% Processed
70% Processed
80% Processed
90% Processed
100% Processed

Testing export pixel types
<?xml version="1.0" encoding="utf-8"?>
<?xml-model href="http://pds.nasa.gov/pds4/disp/v1/PDS4_DISP_1700.sch" schemetypens="http://purl.oclc.org/dsdl/schematron"?>
+16 −2
Original line number Diff line number Diff line
@@ -11,7 +11,14 @@ using namespace std;
using namespace Isis;

/** 
 * Unit test for ProcessExportPds4 class
 *  
 * @author 2017-05-30 Marjorie Hahn 
 *  
 *  @internal
 *   @history 2017-05-30 Marjorie Hahn - Original Version
 *   @history 2016-12-28 Kristin Berry - Updated to test xml input. 
 *  
 */
void IsisMain() {
  Preference::Preferences(true);
@@ -61,6 +68,13 @@ void IsisMain() {
    remove("temp.img");
    remove("temp.xml");

    std::cout << std::endl << "Testing xml input" << std::endl; 
    Isis::ProcessExportPds4 xmlTest;
    xmlTest.SetInputCube(&cub);
    xmlTest.WritePds4("tempxml.xml");
    remove("tempxml.img");
    remove("tempxml.xml");

    std::cout << std::endl << "Testing export pixel types" << std::endl;

    ProcessExportPds4 stretchProcess;