Commit 61886d82 authored by Jesse Mapel's avatar Jesse Mapel
Browse files

Initial label support in csv2table

parent 689132f7
Loading
Loading
Loading
Loading
+20 −0
Original line number Original line Diff line number Diff line
@@ -29,6 +29,8 @@
#include "FileName.h"
#include "FileName.h"
#include "IException.h"
#include "IException.h"
#include "IString.h"
#include "IString.h"
#include "Pvl.h"
#include "PvlObject.h"
#include "Table.h"
#include "Table.h"
#include "TableField.h"
#include "TableField.h"
#include "TableRecord.h"
#include "TableRecord.h"
@@ -76,6 +78,24 @@ void IsisMain() {
    table += tableRow;
    table += tableRow;
  }
  }


  // If a set of label keywords was passed add them to the table
  if (ui.WasEntered("label")) {
    QString labelPvlFilename = ui.GetFileName("label");
    Pvl labelPvl;
    try {
      labelPvl.read(labelPvlFilename);
    }
    catch(IException &e) {
      QString msg = "Failed to read PVL label file [" + labelPvlFilename + "].";
      throw IException(e, IException::Io, msg, _FILEINFO_);
    }

    PvlObject &tableLabel = table.Label();
    for (int keyIndex = 0; keyIndex < labelPvl.keywords(); keyIndex++) {
      tableLabel.addKeyword(labelPvl[keyIndex]);
    }
  }

  // Write the table to the cube
  // Write the table to the cube
  QString outCubeFileName(ui.GetFileName("to"));
  QString outCubeFileName(ui.GetFileName("to"));
  Cube outCube;
  Cube outCube;
+14 −0
Original line number Original line Diff line number Diff line
@@ -41,6 +41,20 @@
        </filter>
        </filter>
      </parameter>
      </parameter>


        <parameter name = "label">
          <type>filename</type>
          <fileMode>input</fileMode>
          <brief>Input table label PVL filename</brief>
          <description>
            Input table label PVL filename. This is expected to be a flat PVL
            file where all of the keywords and their values will be added to
            the tabel label.
          </description>
          <filter>
            *.pvl
          </filter>
        </parameter>

      <parameter name = "to">
      <parameter name = "to">
        <type>cube</type>
        <type>cube</type>
        <fileMode>output</fileMode>
        <fileMode>output</fileMode>