Unverified Commit 459daad3 authored by Kristin's avatar Kristin Committed by GitHub
Browse files

Merge pull request #140 from jcwbacker/m05369

Fixed bug for Rosetta OSIRIS ingestion app, rososiris2isis, that did not recognize the Fe2O3 filter. Fixes #5369.
parents 761b52a9 65771df2
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -27,10 +27,11 @@ object_script.*.Debug
*_plugin_import.cpp
*_plugin_import.cpp
*.moc
*.moc
ui_*.h
ui_*.h
*.html
*html


# ignore all files created by squish coco
# ignore all files created by squish coco
*csmes
*csmes
*csexe


print.prt
print.prt


+12 −7
Original line number Original line Diff line number Diff line
@@ -104,10 +104,10 @@ namespace Isis {
  /**
  /**
   * Returns a translated value. The output name is used to find the input
   * Returns a translated value. The output name is used to find the input
   * group, keyword, default and tranlations in the translation table. If the
   * group, keyword, default and tranlations in the translation table. If the
   * keyword does not exist in the input label, the input default if
   * keyword does not exist in the input label and an input default is available,
   * available will be used as the input value. This input value
   * then this default will be used as the input value. This input value is
   * is then used to search all of the translations. If a match is
   * then used to search all of the translations. If a match is found the
   * found the translated value is returned.
   * translated value is returned. 
   *
   *
   * @param nName The output name used to identify the input keyword to be
   * @param nName The output name used to identify the input keyword to be
   *              translated.
   *              translated.
@@ -136,7 +136,12 @@ namespace Isis {


  /**
  /**
   * Translate the requested output name to output values using the input name
   * Translate the requested output name to output values using the input name
   * and values or default value
   * and values or default value.
   *  
   * Note: This is a protected method used when automatically 
   * translating
   *  
   * @see Auto().
   *
   *
   * @param nName The output name used to identify the input keyword to be
   * @param nName The output name used to identify the input keyword to be
   *              translated.
   *              translated.
+21 −26
Original line number Original line Diff line number Diff line
@@ -44,42 +44,37 @@ namespace Isis {
   * @author 2003-05-29 Stuart Sides
   * @author 2003-05-29 Stuart Sides
   *
   *
   * @internal
   * @internal
   *  @history 2003-09-03 Stuart Sides - Modified to work with new isis label
   *  @history 2003-09-03 Stuart Sides - Modified to work with new isis label format.
   *                                     format
   *  @history 2003-09-25 Stuart Sides - Added the Translate member.
   *  @history 2003-09-25 Stuart Sides - Added the Translate member
   *  @history 2005-02-15 Elizabeth Ribelin - Modified file to support Doxygen documentation.
   *  @history 2005-02-15 Elizabeth Ribelin - Modified file to support Doxygen
   *  @history 2006-08-09 Brendan George - Modified to support Optional keyword translation.
   *                                          documentation
   *  @history 2006-08-09 Brendan George - Modified to support Optional keyword
   *                                       translation
   *  @history 2006-10-01 Stuart Sides - Fixed bug with Optional keyword.
   *  @history 2006-10-01 Stuart Sides - Fixed bug with Optional keyword.
   *                                     Non-optional keywords were being reported
   *                          Non-optional keywords were being reported instantly.
   *                                     instantly.
   *  @history 2006-11-16 Brendan George - Changed instances of "Foreign" to "Input"
   *  @history 2006-11-16 Brendan George - Changed instances of "Foreign" to "Input"
   *                                       and "Native" to "Output"
   *                          and "Native" to "Output".
   *  @history 2007-06-22 Stuart Sides - Added ability to have more than one input location
   *  @history 2007-06-22 Stuart Sides - Added ability to have more than one input location
   *                                     keyword for a translation. The first one found
   *                          keyword for a translation. The first one found which contains
   *                                     which contains the input keyword is used.
   *                          the input keyword is used.
   *  @history 2008-05-09 Steven Lambright - Added ability to change input label without
   *  @history 2008-05-09 Steven Lambright - Added ability to change input label without
   *                          re-reading the translation file.
   *                          re-reading the translation file.
   *  @history 2008-07-10 Noah Hilt - Changed while loops to continue searching
   *  @history 2008-07-10 Noah Hilt - Changed while loops to continue searching other groups
   *           other groups if a group has been found, but the keyword does not
   *                          if a group has been found, but the keyword does not exist in
   *           exist in that group.
   *                          that group.
   *  @history 2008-07-10 Steven Lambright - Changed to use new accessors
   *  @history 2008-07-10 Steven Lambright - Changed to use new accessors.
   *  @history 2010-01-04 Steven Lambright - Added InputKeyword method and removed
   *  @history 2010-01-04 Steven Lambright - Added InputKeyword method and removed
   *                                         InputSize, InputUnits, InputValue.
   *                          InputSize, InputUnits, InputValue. Renamed private Translate() method
   *                                         Renamed private Translate method to
   *                          to DoTranslation() to remove ambiguity with a parent method,
   *                                         DoTranslation to remove ambiguity
   *                          instead of using a dummy parameter.
   *                                         with a parent method, instead of
   *  @history 2017-01-11 Jeannie Backer - Moved several methods to a generic parent class,
   *                                         using a dummy parameter.
   *                          LabelTranslationManager. Fixes #4584.
   *  @history 2017-01-11 Jeannie Backer - Moved several methods to a generic
   *                          parent class, LabelTranslationManager. Fixes #4584.
   *  @history 2017-06-13 Adam Paquette - Changed PvlTranslationManager file name to
   *  @history 2017-06-13 Adam Paquette - Changed PvlTranslationManager file name to
   *                          PvlToPvlTranslationManager. Fixes #4901.
   *                          PvlToPvlTranslationManager. Fixes #4901.
   *  @history 2018-01-10 Christopher Combs - Changed ProcessDataFilePointer call to reflect 
   *  @history 2018-01-10 Christopher Combs - Changed ProcessDataFilePointer call to reflect 
   *                          changes made to voy2isis. Fixes #4345, #4421.
   *                          changes made to voy2isis. Fixes #4345, #4421.
   *  @history 2018-04-16 Jeannie Backer - Fixed indentation of history comments.
   *  @todo 2005-02-15 Stuart Sides - add coded example and implementation example
   *  @todo 2005-02-15 Stuart Sides - add coded example and implementation example
   *                          to class documentation, and finish
   *                          to class documentation, and finish
   *                                  documentation
   *                          documentation.
   */
   */
  class PvlToPvlTranslationManager : public LabelTranslationManager {
  class PvlToPvlTranslationManager : public LabelTranslationManager {
    public:
    public:
+214 −151
Original line number Original line Diff line number Diff line
@@ -23,6 +23,8 @@
#include <fstream>
#include <fstream>
#include <sstream>
#include <sstream>


#include <QDebug>

#include "IException.h"
#include "IException.h"
#include "IString.h"
#include "IString.h"
#include "Message.h"
#include "Message.h"
@@ -33,11 +35,9 @@ using namespace std;
namespace Isis {
namespace Isis {


  /**
  /**
   * Constructs and initializes a PvlTranslationTable object
   * Constructs and initializes a PvlTranslationTable object.
   *
   * @param transFile The translation file to be used
   *
   *
   * @throws iException::Io
   * @param transFile The translation file to be used.
   */
   */
  PvlTranslationTable::PvlTranslationTable(FileName transFile) {
  PvlTranslationTable::PvlTranslationTable(FileName transFile) {
    AddTable(transFile.expanded());
    AddTable(transFile.expanded());
@@ -54,34 +54,48 @@ namespace Isis {
  }
  }




  //! Construct an empty PvlTranslationTable
  /**
   * Construct an empty PvlTranslationTable
   */
  PvlTranslationTable::PvlTranslationTable() {
  PvlTranslationTable::PvlTranslationTable() {
  }
  }




  //! Destroys the PvlTranslationTable object.
  /**
   * Destroys the PvlTranslationTable object.
   */
  PvlTranslationTable::~PvlTranslationTable() {
  PvlTranslationTable::~PvlTranslationTable() {
  }
  }




  //! Protected accessor for pvl translation table passed into class.
  /**
   * Protected accessor for pvl translation table passed into 
   * class. This method returns a reference to the translation 
   * table member. 
   *  
   * @return @b Pvl The translation table as a PVL object. 
   */
  Pvl &PvlTranslationTable::TranslationTable() {
  Pvl &PvlTranslationTable::TranslationTable() {
    return p_trnsTbl;
    return p_trnsTbl;
  }
  }




  //! Protected accessor for const pvl translation table passed into class.
  /**
  *  Protected accessor for const pvl translation table passed
  *  into class. This method returns a @b const reference to the
  *  translation table member.
   *  
  * @return @b Pvl The translation table as a PVL object. 
   */
  const Pvl &PvlTranslationTable::TranslationTable() const {
  const Pvl &PvlTranslationTable::TranslationTable() const {
    return p_trnsTbl;
    return p_trnsTbl;
  }
  }




  /**
  /**
   * Adds the contents of a translation table to the searchable groups/keys
   * Adds the contents of a translation table to the searchable groups/keys.
   *
   *
   * @param transFile The name of the translation file to be added.
   * @param transFile The name of the translation file to be added.
   *
   * @throws IException::Io
   */
   */
  void PvlTranslationTable::AddTable(const QString &transFile) {
  void PvlTranslationTable::AddTable(const QString &transFile) {
    p_trnsTbl.read(FileName(transFile).expanded());
    p_trnsTbl.read(FileName(transFile).expanded());
@@ -91,9 +105,15 @@ namespace Isis {
  /**
  /**
   * Adds the contents of a translation table to the searchable groups/keys
   * Adds the contents of a translation table to the searchable groups/keys
   * Also performs a verification, to ensure that the translation table
   * Also performs a verification, to ensure that the translation table
   * is valid
   * is valid.
   *
   *
   * @param transStm The stream to be added.
   * @param transStm The stream to be added.
   * 
   * @throws IException::User - "Unable to find InputKey for group 
                               in translation file."
   * @throws IException::User - "Keyword is not valid. Error in file."
   * @throws IException::User - "Keyword does not have correct number of elements.
                                 Error in file."
   */
   */
  void PvlTranslationTable::AddTable(std::istream &transStm) {
  void PvlTranslationTable::AddTable(std::istream &transStm) {
    transStm >> p_trnsTbl;
    transStm >> p_trnsTbl;
@@ -103,20 +123,20 @@ namespace Isis {
    vector< pair<QString, int> > validKeywordSizes = validKeywords();
    vector< pair<QString, int> > validKeywordSizes = validKeywords();


    for (int i = 0; i < p_trnsTbl.groups(); i++) {
    for (int i = 0; i < p_trnsTbl.groups(); i++) {
      PvlGroup currGrp = p_trnsTbl.group(i);
      PvlGroup currGroup = p_trnsTbl.group(i);


      if(!currGrp.hasKeyword("InputKey")) {
      if (!currGroup.hasKeyword("InputKey")) {
        QString message = "Unable to find InputKey for group ["
        QString message = "Unable to find InputKey for group ["
                         + currGrp.name() + "] in file [" +
                         + currGroup.name() + "] in file [" +
                         p_trnsTbl.fileName() + "]";
                         p_trnsTbl.fileName() + "]";
        throw IException(IException::User, message, _FILEINFO_);
        throw IException(IException::User, message, _FILEINFO_);
      }
      }


      for(int j = 0; j < currGrp.keywords(); j++) {
      for (int j = 0; j < currGroup.keywords(); j++) {
        bool validKeyword = false;
        bool validKeyword = false;
        bool keywordSizeMismatch = false;
        bool keywordSizeMismatch = false;


        const PvlKeyword &currKey = currGrp[j];
        const PvlKeyword &currKey = currGroup[j];


        // Test this keyword for validity
        // Test this keyword for validity
        for (int key = 0;
        for (int key = 0;
@@ -184,53 +204,55 @@ namespace Isis {
    validKeywords.push_back(pair<QString, int>("Optional",              0));
    validKeywords.push_back(pair<QString, int>("Optional",              0));
    validKeywords.push_back(pair<QString, int>("InputKey",              1));
    validKeywords.push_back(pair<QString, int>("InputKey",              1));
    validKeywords.push_back(pair<QString, int>("InputDefault",         -1));
    validKeywords.push_back(pair<QString, int>("InputDefault",         -1));
    validKeywords.push_back(pair<QString, int>("InputKeyDependencies", -1));


    return validKeywords;
    return validKeywords;
  }
  }




  /**
  /**
   * Translates the output name and input value.
   * Translates a single output value from the given translation 
   * group name and input value. 
   *
   *
   * @param nName The output name to be used to search the translation table.
   * @param translationGroupName The name of the pvl translation 
   * @param fValue The input value to be translated
   *                             group. Often, this is the same
   *                             as the output keyword name.
   * @param inputKeyValue The value to be translated, from the 
   *                      input keyword.
   *
   *
   * @return QString The translated QString
   * @return QString The translated value, for the 
   *         output keyword.
   *
   *
   * @throws iException::Programmer
   * @throws IException::Programmer - "No value or default value to translate 
                                      for translation group."
   * @throws IException::Programmer - "Unable to find translation value in file."
   */
   */
  QString PvlTranslationTable::Translate(const QString nName,
  QString PvlTranslationTable::Translate(const QString translationGroupName,
                                         const QString fValue) const {
                                         const QString inputKeyValue) const {
    if(!p_trnsTbl.hasGroup(nName)) {
      QString msg = "Unable to find translation group [" +
                   nName + "] in file [" + p_trnsTbl.fileName() + "]";


      throw IException(IException::Programmer, msg, _FILEINFO_);
    const PvlGroup &translationGroup = findTranslationGroup(translationGroupName);
    }

    const PvlGroup &tgrp = p_trnsTbl.findGroup(nName);


    // If no input value was passed in search using the input default
    // If no input value was passed in search using the input default
    QString tmpFValue = fValue;
    QString tmpFValue = inputKeyValue;
    if (tmpFValue.isEmpty()) {
    if (tmpFValue.isEmpty()) {
      if(tgrp.hasKeyword("InputDefault")) {
      if (translationGroup.hasKeyword("InputDefault")) {
        tmpFValue = (QString) tgrp["InputDefault"];
        tmpFValue = (QString) translationGroup["InputDefault"];
      }
      }
      else {
      else {
        QString msg = "No value or default value to translate for ";
        QString msg = "No value or default value to translate for ";
        msg += "translation group [";
        msg += "translation group [";
        msg += nName;
        msg += translationGroupName;
        msg += "] in file [" + p_trnsTbl.fileName() + "]";
        msg += "] in file [" + p_trnsTbl.fileName() + "]";
        throw IException(IException::Programmer, msg, _FILEINFO_);
        throw IException(IException::Programmer, msg, _FILEINFO_);
      }
      }
    }
    }


    // Search the Translation keywords for a match to the input value
    // Search the Translation keywords for a match to the input value
    Pvl::ConstPvlKeywordIterator it = tgrp.findKeyword("Translation",
    Pvl::ConstPvlKeywordIterator it = translationGroup.findKeyword("Translation",
                                      tgrp.begin(),
                                      translationGroup.begin(),
                                      tgrp.end());
                                      translationGroup.end());


    while(it != tgrp.end()) {
    while (it != translationGroup.end()) {
      const PvlKeyword &key = *it;
      const PvlKeyword &key = *it;
      // compare the value from the input file to the second value of each Translation in the trans file.
      // compare the value from the input file to the second value of each Translation in the trans file.
      // ignore cases for input values  
      // ignore cases for input values  
@@ -246,11 +268,11 @@ namespace Isis {
        }
        }
      }
      }


      it = tgrp.findKeyword("Translation", it + 1, tgrp.end());
      it = translationGroup.findKeyword("Translation", it + 1, translationGroup.end());
    }
    }


    QString msg = "Unable to find a translation value for [" +
    QString msg = "Unable to find a translation value for [" +
                 nName +  ", " + fValue + "] in file [" +
                 translationGroupName +  ", " + inputKeyValue + "] in file [" +
                 p_trnsTbl.fileName() + "]";
                 p_trnsTbl.fileName() + "]";


    throw IException(IException::Programmer, msg, _FILEINFO_);
    throw IException(IException::Programmer, msg, _FILEINFO_);
@@ -261,41 +283,36 @@ namespace Isis {
   * Returns the input group name from the translation table corresponding to
   * Returns the input group name from the translation table corresponding to
   * the output name argument.
   * the output name argument.
   *
   *
   * @param nName The output name to be used to search the translation table.
   * @param translationGroupName The output name to be used to search the translation table.
   * @param inst The occurence number of the "InputGroup" keyword
   * @param inst The occurence number of the "InputGroup" keyword
   *             (first one is zero)
   *             (first one is zero)
   *
   *
   * @return QString The input group name
   * @return QString The input group name
   *
   *
   * @throws iException::Programmer
   * @throws IException::Programmer - "Keyword [InputPosition] cannot have a comma [,] 
                                       in the value."
   */
   */
  PvlKeyword PvlTranslationTable::InputGroup(const QString nName,
  PvlKeyword PvlTranslationTable::InputGroup(const QString translationGroupName,
                                             const int inst) const {
                                             const int inst) const {


    if(!p_trnsTbl.hasGroup(nName)) {
    const PvlGroup &translationGroup = findTranslationGroup(translationGroupName);
      QString msg = "Unable to find translation group [" +
                   nName + "] in file [" + p_trnsTbl.fileName() + "]";
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }

    const PvlGroup &transGrp = p_trnsTbl.findGroup(nName);


    //bool foundLegalInputGroup = false;
    //bool foundLegalInputGroup = false;


    Pvl::ConstPvlKeywordIterator it = transGrp.findKeyword("InputPosition",
    Pvl::ConstPvlKeywordIterator it = translationGroup.findKeyword("InputPosition",
                                      transGrp.begin(),
                                      translationGroup.begin(),
                                      transGrp.end());
                                      translationGroup.end());


    int currentInstance = 0;
    int currentInstance = 0;


    // If no InputPosition keyword exists, the answer is root
    // If no InputPosition keyword exists, the answer is root
    if(inst == 0 && it == transGrp.end()) {
    if (inst == 0 && it == translationGroup.end()) {
      PvlKeyword root("InputPosition");
      PvlKeyword root("InputPosition");
      root += "ROOT";
      root += "ROOT";
      return root;
      return root;
    }
    }


    while(it != transGrp.end()) {
    while (it != translationGroup.end()) {
      const PvlKeyword &result = *it;
      const PvlKeyword &result = *it;


      // This check is to prevent backtracking to the old "value,value" way of
      // This check is to prevent backtracking to the old "value,value" way of
@@ -318,17 +335,17 @@ namespace Isis {
        currentInstance ++;
        currentInstance ++;
      }
      }


      it = transGrp.findKeyword("InputPosition", it + 1, transGrp.end());
      it = translationGroup.findKeyword("InputPosition", it + 1, translationGroup.end());
    }
    }


    /* Error if no containers were listed
    /* Error if no containers were listed
    if (!foundLegalInputGroup) {
    if (!foundLegalInputGroup) {
      QString msg = "No input position found for translation [";
      QString msg = "No input position found for translation [";
      msg += nName;
      msg += translationGroupName;
      msg += "] in translation file [";
      msg += "] in translation file [";
      msg += p_trnsTbl.FileName();
      msg += p_trnsTbl.FileName();
      msg += "]";
      msg += "]";
      throw iException::Message(iException::Programmer, msg, _FILEINFO_);
      throw IException::Message(IException::Programmer, msg, _FILEINFO_);
    }*/
    }*/


    PvlKeyword empty;
    PvlKeyword empty;
@@ -340,22 +357,15 @@ namespace Isis {
   * Returns the input keyword name from the translation table corresponding to
   * Returns the input keyword name from the translation table corresponding to
   * the output name argument.
   * the output name argument.
   *
   *
   * @param nName The output name to be used to search the translation table.
   * @param translationGroupName The output name to be used to search the translation table.
   *
   * @return QString The input keyword name
   *
   *
   * @throws iException::Programmer
   * @return QString The input keyword name.
   */
   */
  QString PvlTranslationTable::InputKeywordName(const QString nName) const {
  QString PvlTranslationTable::InputKeywordName(const QString translationGroupName) const {


    if(!p_trnsTbl.hasGroup(nName)) {
    const PvlGroup &translationGroup = findTranslationGroup(translationGroupName);
      QString msg = "Unable to find translation group [" +
                   nName + "] in file [" + p_trnsTbl.fileName() + "]";
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }


    PvlGroup tgrp = p_trnsTbl.findGroup(nName);
    if (translationGroup.hasKeyword("InputKey")) return translationGroup["InputKey"];
    if(tgrp.hasKeyword("InputKey")) return tgrp["InputKey"];


    return "";
    return "";
  }
  }
@@ -365,97 +375,150 @@ namespace Isis {
   * Returns the input default value from the translation table corresponding
   * Returns the input default value from the translation table corresponding
   * to the output name argument.
   * to the output name argument.
   *
   *
   * @param nName The output name to be used to search the translation table.
   * @param translationGroupName The output name to be used to search the translation table.
   *
   * @return QString The input default value
   *
   *
   * @throws iException::Programmer
   * @return QString The input default value.
   */
   */
  QString PvlTranslationTable::InputDefault(const QString nName) const {
  QString PvlTranslationTable::InputDefault(const QString translationGroupName) const {


    if(!p_trnsTbl.hasGroup(nName)) {
    const PvlGroup &translationGroup = findTranslationGroup(translationGroupName);
      QString msg = "Unable to find translation group [" +
                   nName + "] in file [" + p_trnsTbl.fileName() + "]";
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }


    PvlGroup tgrp = p_trnsTbl.findGroup(nName);
    if (translationGroup.hasKeyword("InputDefault")) return translationGroup["InputDefault"];
    if(tgrp.hasKeyword("InputDefault")) return tgrp["InputDefault"];


    return "";
    return "";
  }
  }


  bool PvlTranslationTable::hasInputDefault(const QString nName) {
    if(!p_trnsTbl.hasGroup(nName)) {
      QString msg = "Unable to find translation group [" + nName +
                   "] in file [" + p_trnsTbl.fileName() + "]";
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }


    PvlGroup &tgrp = p_trnsTbl.findGroup(nName);
  /**
    if(tgrp.hasKeyword("InputDefault")) return true;
   * Determines whether the given group has a default input value.
   * This method returns true if the translation group contains a 
   * PvlKeyword with the name "InputDefault". Note: no value needs
   * to be assigned to this keyword. 
   *  
   * @param translationGroupName The name of the PVL translation group.
   * 
   * @return bool Indicates whether the given group has an 
   *         InputDefault keyword.
   */
  bool PvlTranslationTable::hasInputDefault(const QString translationGroupName) {

    const PvlGroup &translationGroup = findTranslationGroup(translationGroupName);

    if (translationGroup.hasKeyword("InputDefault")) return true;


    return false;
    return false;
  }
  }


  bool PvlTranslationTable::IsAuto(const QString nName) {
    if(!p_trnsTbl.hasGroup(nName)) {
      QString msg = "Unable to find translation group [" + nName +
                   "] in file [" + p_trnsTbl.fileName() + "]";
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }


    PvlGroup &tgrp = p_trnsTbl.findGroup(nName);
  /**
    if(tgrp.hasKeyword("Auto")) return true;
   * Determines whether the given group should be automatically 
   * translated. This method returns true if the translation 
   * group contains a PvlKeyword with the name "Auto". Note: 
   * no value is assigned to this keyword. 
   *  
   * @param translationGroupName The name of the PVL translation group.
   * 
   * @return bool Indicates whether the given group has an Auto 
   *         keyword.
   */
  bool PvlTranslationTable::IsAuto(const QString translationGroupName) {

    const PvlGroup &translationGroup = findTranslationGroup(translationGroupName);

    if (translationGroup.hasKeyword("Auto")) return true;


    return false;
    return false;
  }
  }


  bool PvlTranslationTable::IsOptional(const QString nName) {
    if(!p_trnsTbl.hasGroup(nName)) {
      QString msg = "Unable to find translation group [" + nName +
                   "] in file [" + p_trnsTbl.fileName() + "]";
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }


    PvlGroup &tgrp = p_trnsTbl.findGroup(nName);
  /**
    if(tgrp.hasKeyword("Optional")) return true;
   * Determines whether the translation group is optional. This 
   * method returns true if the translation group contains a 
   * PvlKeyword with the name "Optional". Note: no value is 
   * assigned to this keyword. 
   *  
   * @param translationGroupName The name of the PVL translation group.
   * 
   * @return bool Indicates whether the given group has an 
   *         Optional keyword.
   */
  bool PvlTranslationTable::IsOptional(const QString translationGroupName) {

    const PvlGroup &translationGroup = findTranslationGroup(translationGroupName);

    if (translationGroup.hasKeyword("Optional")) return true;


    return false;
    return false;
  }
  }


  PvlKeyword &PvlTranslationTable::OutputPosition(const QString nName) {
    if(!p_trnsTbl.hasGroup(nName)) {
      QString msg = "Unable to find translation group [" +
                   nName + "] in file [" + p_trnsTbl.fileName() + "]";
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }


    PvlGroup &tgrp = p_trnsTbl.findGroup(nName);
  /**
    if(!tgrp.hasKeyword("OutputPosition")) {
   * Retrieves the OutputPosition PvlKeyword for the translation 
   * group with the given name. 
   *  
   * @param translationGroupName The name of the PVL translation group.
   * 
   * @return PvlKeyword The OutputPosition keyword from the given 
   *         translation group.
   *
   * @throws IException::Programmer - "Unable to find translation keyword [OutputPostion]
                                       in translation group in file."
   */
  PvlKeyword PvlTranslationTable::OutputPosition(const QString translationGroupName) {

    const PvlGroup &translationGroup = findTranslationGroup(translationGroupName);

    if (!translationGroup.hasKeyword("OutputPosition")) {
      QString msg = "Unable to find translation keyword [OutputPostion] in [" +
      QString msg = "Unable to find translation keyword [OutputPostion] in [" +
                   nName + "] in file [" + p_trnsTbl.fileName() + "]";
                   translationGroupName + "] in file [" + p_trnsTbl.fileName() + "]";
      throw IException(IException::Programmer, msg, _FILEINFO_);
      throw IException(IException::Programmer, msg, _FILEINFO_);


    }
    }


    return tgrp["OutputPosition"];
    return translationGroup["OutputPosition"];
  }
  }




  QString PvlTranslationTable::OutputName(const QString nName) {
  /**
    if(!p_trnsTbl.hasGroup(nName)) {
   * Retrieves a string containing the value of the OutputName 
      QString msg = "Unable to find translation group [" + nName +
   * keyword for the translation group with the given name. 
                   "] in file [" + p_trnsTbl.fileName() + "]";
   *  
      throw IException(IException::Programmer, msg, _FILEINFO_);
   * @param translationGroupName The name of the PVL translation group.
    }
   * 
   * @return @b QString The value of the OutputName keyword from 
   *         the given translation group.
   */
  QString PvlTranslationTable::OutputName(const QString translationGroupName) {

    const PvlGroup &translationGroup = findTranslationGroup(translationGroupName);


    PvlGroup tgrp = p_trnsTbl.findGroup(nName);
    if (translationGroup.hasKeyword("OutputName")) {
    if(tgrp.hasKeyword("OutputName")) {
      return translationGroup["OutputName"];
      return tgrp["OutputName"];
    }
    }


    return "";
    return "";
  }
  }

  /**
   * Searches for translation group with the given name.
   *  
   * @see PvlObject::findGroup() 
   *  
   * @param translationGroupName Name of the PVL group to search for.
   * 
   * @return const PvlGroup& The first PVL group with the given name.
   *  
   * @throws IException::Programmer - "Unable to find translation 
   *                   group in file."
   */
  const PvlGroup &PvlTranslationTable::findTranslationGroup(const QString translationGroupName) const {
    if (!p_trnsTbl.hasGroup(translationGroupName)) {
      QString msg = "Unable to find translation group [" + translationGroupName +
                   "] in file [" + p_trnsTbl.fileName() + "]";
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }

    return p_trnsTbl.findGroup(translationGroupName);
  }
} // end namespace isis
} // end namespace isis
+12 −9

File changed.

Preview size limit exceeded, changes collapsed.

Loading