isis/src/system/apps/kerneldbgen/SpiceDbGen.cpp
PvlObject SpiceDbGen::Direct(QString quality, QString location,
                             std::vector<QString> &filter, double startOffset, double endOffset) {
  PvlObject result;

  for (unsigned int i = 0; i < filter.size(); ++i) {
    //Create a list of all of the files matching the current filter
    QStringList files = GetFiles(FileName(location), filter[i]);

    // Throw an error if no files are being added to this database for
    // this filter/regex
    if (files.size() == 0) {
      QString message = "Your filter [" + location + "/" + filter[i] + "]"
                       + "has not detected any " + quality + " kernels";
      throw IException(IException::User, message, _FILEINFO_);
    }

    for (int fileNum = 0 ; fileNum < files.size() ; fileNum++) {
      FileName currFile((QString) location + "/" + files[fileNum]);
      PvlGroup selection = AddSelection(currFile, startOffset, endOffset);
      selection += PvlKeyword("Type", quality);
      result.addGroup(selection);
    }
  }

  // Check each group to make sure it is the same type as others
  PvlObject::PvlGroupIterator grp = result.beginGroup();

  while (grp != result.endGroup()) {
    // The kernel did not have any time coverage, so ignore it
    if (grp->name() == "No coverage" || grp->name() == "Null") {
      result.deleteGroup(grp->name());
    }
    else if (grp->name() == p_type) {
      grp->setName("Selection");
      grp++;
    }
    else {
      QString message = "A kernel of type [" + grp->name() + "] has been found in a directory for type [" + p_type + "]" ;
      throw IException(IException::Programmer, message, _FILEINFO_);
      break;
    }
  }

  if (p_type == "SPK") {
    result.setName("SpacecraftPosition");
  }
  else if (p_type == "CK") {
    result.setName("SpacecraftPointing");
  }

  return result;
}
/**
 * Creates a Pvl object that stores all of the kernels under the condition
 * specified by the filter.
 *
 * @param quality   The quality of the kernels that are being filtered into
 *                  the database. For example, "Reconstructed".
 *
 * @param location  The directory in which the method searches for kernels.
 *
 * @param filter    Vector of QStrings containing regular expression used to
 *                  match kernels of a particular quality. This parameter is
 *                  used to distinguish between kernels of different qualities
 *                  and/or different missions that may be placed in the same
 *                  directory.
 *
 * @return PvlObject
 *
 * @internal
 *   @history 2010-04-27 Stuart Sides Changed to work with vector of filters
 *   instead of a single filter
 *
 *   @history 2015-03-27 Stuart Sides Changed the number of decimal places
 *   written to the Time keyword for kernel.###.db files from three to six
 *
 * @throws Isis::iException::Message
*/
Creates a Pvl object that stores all of the kernels under the condition
specified by the filter.

@param quality   The quality of the kernels that are being filtered into
the database. For example, "Reconstructed".

@param location  The directory in which the method searches for kernels.

@param filter    Vector of QStrings containing regular expression used to
match kernels of a particular quality. This parameter is
used to distinguish between kernels of different qualities
and/or different missions that may be placed in the same
directory.



@internal
@history 2010-04-27 Stuart Sides Changed to work with vector of filters
instead of a single filter

@history 2015-03-27 Stuart Sides Changed the number of decimal places
written to the Time keyword for kernel.###.db files from three to six

@throws Isis::iException::Message
Creates a Pvl object that stores all of the kernels under the condition specified by the filter . @param quality The quality of the kernels that are being filtered into the database . For example " Reconstructed " . @param location The directory in which the method searches for kernels . @param filter Vector of QStrings containing regular expression used to match kernels of a particular quality . This parameter is used to distinguish between kernels of different qualities and / or different missions that may be placed in the same directory . @internal @history 2010 - 04 - 27 Stuart Sides Changed to work with vector of filters instead of a single filter @history 2015 - 03 - 27 Stuart Sides Changed the number of decimal places written to the Time keyword for kernel . ### . db files from three to six @throws Isis :: iException :: Message
PvlObject SpiceDbGen::Direct(QString quality, QString location,
                             std::vector<QString> &filter, double startOffset, double endOffset) {
  PvlObject result;
  for (unsigned int i = 0; i < filter.size(); ++i) {
    QStringList files = GetFiles(FileName(location), filter[i]);
    if (files.size() == 0) {
      QString message = "Your filter [" + location + "/" + filter[i] + "]"
                       + "has not detected any " + quality + " kernels";
      throw IException(IException::User, message, _FILEINFO_);
    }
    for (int fileNum = 0 ; fileNum < files.size() ; fileNum++) {
      FileName currFile((QString) location + "/" + files[fileNum]);
      PvlGroup selection = AddSelection(currFile, startOffset, endOffset);
      selection += PvlKeyword("Type", quality);
      result.addGroup(selection);
    }
  }
  PvlObject::PvlGroupIterator grp = result.beginGroup();
  while (grp != result.endGroup()) {
    if (grp->name() == "No coverage" || grp->name() == "Null") {
      result.deleteGroup(grp->name());
    }
    else if (grp->name() == p_type) {
      grp->setName("Selection");
      grp++;
    }
    else {
      QString message = "A kernel of type [" + grp->name() + "] has been found in a directory for type [" + p_type + "]" ;
      throw IException(IException::Programmer, message, _FILEINFO_);
      break;
    }
  }
  if (p_type == "SPK") {
    result.setName("SpacecraftPosition");
  }
  else if (p_type == "CK") {
    result.setName("SpacecraftPointing");
  }
  return result;
}
PvlObject SpiceDbGen :: Direct ( QString quality , QString location , std :: vector < QString > & filter , double startOffset , double endOffset ) { PvlObject result ; for ( unsigned int i = 0 ; i < filter . size ( ) ; ++ i ) { QStringList files = GetFiles ( FileName ( location ) , filter [ i ] ) ; if ( files . size ( ) == 0 ) { QString message = " " + location + " " + filter [ i ] + " " + " " + quality + " " ; throw IException ( IException :: User , message , _FILEINFO_ ) ; } for ( int fileNum = 0 ; fileNum < files . size ( ) ; fileNum ++ ) { FileName currFile ( ( QString ) location + " " + files [ fileNum ] ) ; PvlGroup selection = AddSelection ( currFile , startOffset , endOffset ) ; selection += PvlKeyword ( " " , quality ) ; result . addGroup ( selection ) ; } } PvlObject :: PvlGroupIterator grp = result . beginGroup ( ) ; while ( grp != result . endGroup ( ) ) { if ( grp -> name ( ) == " " || grp -> name ( ) == " " ) { result . deleteGroup ( grp -> name ( ) ) ; } else if ( grp -> name ( ) == p_type ) { grp -> setName ( " " ) ; grp ++ ; } else { QString message = " " + grp -> name ( ) + " " + p_type + " " ; throw IException ( IException :: Programmer , message , _FILEINFO_ ) ; break ; } } if ( p_type == " " ) { result . setName ( " " ) ; } else if ( p_type == " " ) { result . setName ( " " ) ; } return result ; }
Creates a Pvl object that stores all of the kernels under the condition
 specified by the filter.
Creates a Pvl object that stores all of the kernels under the condition specified by the filter .
//Create a list of all of the files matching the current filter // Throw an error if no files are being added to this database for // this filter/regex // Check each group to make sure it is the same type as others // The kernel did not have any time coverage, so ignore it