Commit 9738facd authored by Janet Barrett's avatar Janet Barrett
Browse files

(PROG) Modified ProcessImportPds to allow applications to intercept the PDS...

(PROG) Modified ProcessImportPds to allow applications to intercept the PDS label and apply fixes to it before it gets loaded by the class. Fixes #2036

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@5742 41f8697f-d340-4b68-9986-7bafba869bb8
parent 4dfb087c
Loading
Loading
Loading
Loading
+43 −0
Original line number Diff line number Diff line
@@ -65,6 +65,30 @@ namespace Isis {
  }


  /**
   * Set the input label PVL and data file and initialize a Pvl with the PDS labels.
   * This method was written to allow the calling application to intercept the PDS
   * labels and make any modifications to them necessary (such as adding missing
   * keywords like TARGET_NAME) before this class loads them. See the kaguyatc2isis
   * program for an example.
   *
   * @param pdsLabelPvl The PVL containing the PDS label. 
   *
   * @param pdsDataFile The name of the PDS data file where the actual image/cube
   *                    data is stored. This parameter cannot be empty.
   *
   * @throws Isis::iException::Message
   */
  void ProcessImportPds::SetPdsFile(const Isis::Pvl &pdsLabelPvl,
                                    const QString &pdsDataFile) {

    // Save the label and file for future use
    p_pdsLabel = pdsLabelPvl;
    p_labelFile = pdsDataFile;
    ProcessLabel(pdsDataFile);
  }


  /**
   * Set the input label file, data file and initialize a Pvl with the PDS labels.
   *
@@ -100,7 +124,26 @@ namespace Isis {
    // Save the label and file for future use
    p_pdsLabel = pdsLabel;
    p_labelFile = pdsLabelFile;
    ProcessLabel(pdsDataFile);
  }


  /**
   * Load the PDS labels after determining what type of data file was provided.
   * This code used to be part of the SetPdsFile method, but had to be moved to
   * a separate method in order to allow calling applications to intercept the PDS
   * labels before this method loaded them. This was necessary to fix problems in
   * PDS labels such as adding missing keywords.
   *
   * @param pdsDataFile The name of the PDS data file where the actual image/cube
   *                    data is stored. This parameter can be an empty QString, in
   *                    which case the label information will be searched to find
   *                    the data file name or the data will be assumed to be
   *                    after the label information.
   *
   * @throws Isis::iException::Message
   */
  void ProcessImportPds::ProcessLabel(const QString &pdsDataFile) {
    // Create a temporary Isis::PvlTranslationManager so we can find out what
    // type of PDS file this is (i.e., Qube or Image or SpectralQube)
    stringstream trnsStrm;
+10 −0
Original line number Diff line number Diff line
@@ -179,6 +179,14 @@ namespace Isis {
   *  @history 2012-11-21 Jeannie Backer - Added methods and member variables to 
   *                          import binary PDS tables found in the PDS file.
   *                          Added a default destructor. References #700.
   *  @history 2014-02-11 Janet Barrett - Created new version of SetPdsFile method
   *                          so that calling applications can intercept the PDS
   *                          label before it gets loaded by this class. This is
   *                          needed so that missing keywords can be added to the
   *                          PDS label by the application before it gets loaded.
   *                          This also required moving some of the code from the
   *                          SetPdsFile method to a new method, ProcessLabel. Fixes
   *                          #2036.
   *  
   *  @todo 2005-02-09 Finish documentation-lots of holes with variable
   *                   definitions in .h file and .cpp methods, and  insert
@@ -191,6 +199,8 @@ namespace Isis {
      ~ProcessImportPds();
      void SetPdsFile(const QString &pdsLabelFile, const QString &pdsDataFile,
                      Pvl &pdsLabel);
      void SetPdsFile(const Pvl &pdsLabelPvl, const QString &pdsDataFile);
      void ProcessLabel(const QString &pdsDataFile);

      void TranslatePdsProjection(Pvl &lab);
      void TranslateIsis2Labels(Pvl &lab);