Commit 4c43b092 authored by Jesse Mapel's avatar Jesse Mapel
Browse files

Merge branch 'dev' of github.com:USGS-Astrogeology/ISIS3 into rosetta

parents 59fc906a 3b629e57
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -526,5 +526,8 @@ THIRDPARTYLIBS += "$(ISIS3LOCAL)/lib/libtbb*.so*"
# Add the Boost libraries
THIRDPARTYLIBS    += "$(ISIS3LOCAL)/lib/libboost*.so*"

# Add srtp deps (Qt5WebEngine deps) -- see #5365
THIRDPARTYLIBS    += "$(ISIS3SYSLIB)/libsrtp*.so*"

#  Plugins
THIRDPARTYPLUGINS += "$(ISIS3LOCAL)/plugins/"
+4 −1
Original line number Diff line number Diff line
@@ -479,7 +479,6 @@ THIRDPARTYLIBS += "$(ISIS3LOCAL)/lib/libsuperlu*.so"
THIRDPARTYLIBS    += "$(ISIS3LOCAL)/lib/libsuitesparseconfig.so"
THIRDPARTYLIBS    += "$(ISIS3LOCAL)/lib/liblapack.so"
THIRDPARTYLIBS    += "$(ISIS3SYSLIB)/libblas*.so*"
THIRDPARTYLIBS    += "$(ISIS3ALTSYSLIB)/libgfortran.so*"
THIRDPARTYLIBS    += "$(ISIS3LOCAL)/lib/libxerces-c*.so*"
THIRDPARTYLIBS    += "$(ISIS3LOCAL)/lib/libgeotiff*.so*"
THIRDPARTYLIBS    += "$(ISIS3LOCAL)/lib/libtiff*.so*"
@@ -533,5 +532,9 @@ THIRDPARTYLIBS += "$(ISIS3LOCAL)/lib/libtbb*.so*"
# Add the Boost libraries
THIRDPARTYLIBS    += "$(ISIS3LOCAL)/lib/libboost*.so*"

# Add and patch the gfortran's rpath to $ORIGIN (so it can find its quadmath dependency) -- #4610
PATCHLIBS         += "$(ISIS3ALTSYSLIB)/libgfortran.so*"
THIRDPARTYLIBS    += "$(ISIS3SYSLIB)/libquadmath*.so*"

#  Plugins
THIRDPARTYPLUGINS += "$(ISIS3LOCAL)/plugins/"
+3 −7
Original line number Diff line number Diff line
@@ -4,10 +4,6 @@ include $(ISISROOT)/make/isismake.tsts

commands:
	$(APPNAME) from=$(INPUT)/WFPC2u5780205r_c0fx.fits \
	to=$(OUTPUT)/fitsTruth.cub \
	> /dev/null;
	raw2isis from=$(INPUT)/WFPC2u5780205r_c0fx.fits \
	to=$(OUTPUT)/rawTruth.cub \
	SAMPLES=200 LINES=200 BANDS=4 SKIP=23040 \
	BITTYPE=REAL BYTEORDER=MSB \
	> /dev/null;
	  to=$(OUTPUT)/fitsTruth.cub > /dev/null;
	catlab from=$(OUTPUT)/fitsTruth.cub \
		to=$(OUTPUT)/fitsTruth.pvl > /dev/null;
+6 −4
Original line number Diff line number Diff line
@@ -4,8 +4,10 @@ include $(ISISROOT)/make/isismake.tsts

commands:
	$(APPNAME) from=$(INPUT)/lsb_0034933739_0x53c_sci_1.fit \
	to=$(OUTPUT)/bilTruth.cub organization=bil imagenumber=1\
	> /dev/null;
		to=$(OUTPUT)/bilTruth.cub organization=bil imagenumber=1 > /dev/null;
	catlab from=$(OUTPUT)/bilTruth.cub \
		to=$(OUTPUT)/bilTruth.pvl > /dev/null;
	$(APPNAME) from=$(INPUT)/lsb_0034933739_0x53c_sci_1.fit \
	to=$(OUTPUT)/bsqTruth.cub organization=bsq imagenumber=1 \
	> /dev/null;
		to=$(OUTPUT)/bsqTruth.cub organization=bsq imagenumber=1 > /dev/null;
	catlab from=$(OUTPUT)/bsqTruth.cub \
		to=$(OUTPUT)/bsqTruth.pvl > /dev/null;
+330 −39
Original line number Diff line number Diff line
@@ -40,41 +40,99 @@ using namespace std;

namespace Isis {

  /**
   * Constructs an empty FileName object.
   */
  FileName::FileName() {
    m_d = new Data;
  }


  /**
   * Constructs a FileName object using a char pointer as a file name.
   *
   * @param file char pointer representing new filename
   */
  FileName::FileName(const char *file) {
    m_d = new Data;
    m_d->setOriginal(file);
  }


  /**
   * Constructs a FileName object using a QString as a file name.
   *
   * @param file Qstring representing new filename
   */
  FileName::FileName(const QString &file) {
    m_d = new Data;
    m_d->setOriginal(file);
  }


  /**
   * Constructs a copy of a FileName object using another FileName object.
   *
   * @param &other FileName object to copy.
   */
  FileName::FileName(const FileName &other) : m_d(other.m_d) {
  }


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


  /**
   * Returns the path of the original file name. For *nix operating
   * systems this includes everything up to but not including the
   * last slash "/". For filenames created without any slashes
   * the current working directory will be returned.
   *
   * <pre>
   *   for a full file specification of:
   *    "/home/me/img/picture.jpg"
   *   originalPath() gives:
   *    "/home/me/img"
   * </pre>
   *
   * @return QString of the path portion of the original filename.
   */
  QString FileName::originalPath() const {
    return QFileInfo(m_d->original(false)).path();
  }


  /**
   * Returns the path of the file name. For *nix operating
   * systems this includes everything up to but not including the
   * last slash "/". For filenames created without any slashes
   * the current working directory will be returned.
   *
   * <pre>
   *   for a full file specification of:
   *    "/home/me/img/picture.jpg"
   *   path() gives:
   *    "/home/me/img"
   * </pre>
   *
   * @return QString of the path portion of the filename.
   */
  QString FileName::path() const {
    return QFileInfo(expanded()).path();
  }


  /**
   * Returns a QString of the attributes in a filename, attributes are expected to be of type
   * CubeAttributeInput or CubeAttributeOutput. Filenames without any attributes return an
   * empty QString.
   *
   * <pre>
   *   for a full file specification of:
   *    "/tmp/Peaks.cub+Bsq"
   *   attributes() gives:
   *    "Bsq"
   * </pre>
   *
   * @return QString of the attributes specified in the filename.
   */
  QString FileName::attributes() const {
    QString result;
    QString fileNameWithAttribs = QFileInfo(m_d->original(true)).fileName();
@@ -87,32 +145,98 @@ namespace Isis {
    return result;
  }


  /**
   * Returns the name of the file without the path and without extensions.
   *
   * <pre>
   *   for a full file specification of:
   *    "/tmp/Peaks.cub.gz"
   *   baseName() gives:
   *    "Peaks"
   * </pre>
   *
   * @return QString containing every character excluding the path and all extensions.
   */
  QString FileName::baseName() const {
    return QFileInfo(m_d->original(false)).completeBaseName();
  }


  /**
   * Returns the name of the file excluding the path and the attributes in the file name.
   *
   * <pre>
   *   for a full file specification of:
   *    "/tmp/Peaks.cub+Bsq"
   *   name() gives:
   *    "Peaks.cub"
   * </pre>
   *
   * @return QString containing every character in the file name exluding the path and attributes
   * of the file.
   */
  QString FileName::name() const {
    return QFileInfo(m_d->original(false)).fileName();
  }


  /**
   * Returns the last extension of the file name.
   *
   * <pre>
   *   for a full file specification of:
   *    "/tmp/Peaks.cub.gz"
   *   extension() gives:
   *    "gz"
   * </pre>
   *
   * @return QString containing every character in the file name after the last "." character.
   */
  QString FileName::extension() const {
    return QFileInfo(m_d->original(false)).suffix();
  }


  /**
   * Returns a QString of the full file name including the file path, excluding the attributes.
   * Any Isis Preferences or environment variables indicated by $, are changed to what they
   * represent.
   *
   * <pre>
   *   for a full file specification of:
   *    "$ISISROOT/tmp/Peaks.cub+Bsq"
   *   expanded() gives:
   *    "/usgs/pkgs/isis3/isis/tmp/Peaks.cub"
   * </pre>
   *
   * @return QString
   */
  QString FileName::expanded() const {
    return m_d->expanded(false);
  }


  /**
   * Returns the full file name including the file path
   *
   * <pre>
   *   for a full file specification of:
   *    "$ISISROOT/tmp/Peaks.cub+Bsq"
   *   original() gives:
   *    "$ISISROOT/tmp/Peaks.cub+Bsq"
   * </pre>
   *
   * @return QString containing every character in the file name and the path
   */
  QString FileName::original() const {
    return m_d->original(true);
  }


  /**
   * Adds a new extension to the file name. If the current extension is the same as the
   * new extension it will return an unchanged FileName object.
   *
   * @param newExtension The new file extension to be added at the end of the file name after all
   * exisiting extensions.
   *
   * @return FileName object with added extension
   */
  FileName FileName::addExtension(const QString &newExtension) const {
    FileName result = *this;

@@ -129,7 +253,11 @@ namespace Isis {
    return result;
  }


  /**
   * Removes all extensions in the file name
   *
   * @return FileName object with all extensions removed
   */
  FileName FileName::removeExtension() const {
    QString attributesStr = attributes();

@@ -142,7 +270,13 @@ namespace Isis {
    return result;
  }


  /**
   * Sets all current file extensions to a new extension in the file name.
   *
   * @param newExtension The new file extension to replace any current file extensions with
   *
   * @return FileName object with all existing extensions replaced by the new extension
   */
  FileName FileName::setExtension(const QString &newExtension) const {
    FileName result = *this;

@@ -153,24 +287,44 @@ namespace Isis {
    return result;
  }


  /**
   * Checks to see if a file name is versioned by date or numerically. Returns true if file is
   * versioned by date or numerically; returns false otherwise.
   *
   * @return Boolean
   */
  bool FileName::isVersioned() const {
    validateVersioningState();

    return isNumericallyVersioned() || isDateVersioned();
  }


  /**
   * Checks if the file name is versioned numerically. Returns true if the file is versioned
   * numerically; returns false otherwise.
   *
   * @return Boolean
   */
  bool FileName::isNumericallyVersioned() const {
    return FileName(expanded()).name().contains("?");
  }


  /**
   * Checks if the file name is versioned by date. Returns true if the file is versioned
   * by date; returns false otherwise.
   *
   * @return Boolean
   */
  bool FileName::isDateVersioned() const {
    return FileName(expanded()).name().contains(QRegExp("\\{.*\\}"));
  }


  /**
   * Searches the directory specified in the file name for the highest version of the file name.
   * Returns a FileName object with the file name changed to reflect the highest version.
   *
   * @return FileName object
   */
  FileName FileName::highestVersion() const {
    validateVersioningState();

@@ -197,7 +351,15 @@ namespace Isis {
    return result;
  }


  /**
   * Updates the file name to be the latest version. If the file is versioned by date the
   * newest version will be the current date. If the file is versioned numerically, the newest
   * version will be the current version plus one.
   *
   * @return FileName object with the new version file name.
   *
   * @throws Isis::IException::Unknown
   */
  FileName FileName::newVersion() const {
    validateVersioningState();

@@ -238,7 +400,16 @@ namespace Isis {
    return result;
  }


  /**
   * Returns a FileName object of the same file name but versioned numerically by the
   * number passed in as a parameter.
   *
   * @param versionNumber number to version the new FileName object
   *
   * @return FileName object with the new version file name.
   *
   * @throws Isis::IException::Unknown
   */
  FileName FileName::version(long versionNumber) const {
    QString file = FileName(expanded()).name();

@@ -269,24 +440,56 @@ namespace Isis {
    return FileName(originalPath() + "/" + file);
  }


  /**
   * Returns a FileName object of the same file name but versioned by the
   * date passed in as a parameter.
   *
   * @param versionDate QDate to version the new FileName object
   *
   * @return FileName object with the new version file name.
   *
   */
  FileName FileName::version(QDate versionDate) const {
    QString newName = versionDate.toString(fileNameQDatePattern());

    return FileName(originalPath() + "/" + newName);
  }


  /**
   * Returns true if the file exists; false otherwise.
   * If the file is a symlink that points to a nonexistent file, false is returned.
   *
   * @return Boolean
   */
  bool FileName::fileExists() const {
    return QFileInfo(expanded()).exists();
  }


  /**
   * Returns the path of the file's parent directory as a QDir object
   *
   * <pre>
   *   for a full file specification of:
   *    "/tmp/Peaks.cub+Bsq"
   *   dir() gives:
   *    "/tmp/"
   * </pre>
   *
   * @return QDir
   */
  QDir FileName::dir() const {
    return QFileInfo(expanded()).dir();
  }


  /**
   * Creates a temporary file and returns a FileName object created using the temporary file.
   *
   * @param templateFileName the file name used to create the temporary file.
   *
   * @return FileName object created using the temporary file
   *
   * @throws Isis::IException::Io
   */
  FileName FileName::createTempFile(FileName templateFileName) {
    QString preppedFileName = QString("%1/%2XXXXXX.%3").arg(templateFileName.path())
        .arg(templateFileName.baseName()).arg(templateFileName.extension());
@@ -310,18 +513,45 @@ namespace Isis {
    return result;
  }


  /**
   * Returns a QString of the full file name including the file path, excluding the attributes
   * with any Isis Preferences or environment variables indicated by $, changed to what they
   * represent.
   *
   * <pre>
   *   for a full file specification of:
   *    "$ISISROOT/tmp/Peaks.cub+Bsq"
   *   toString() gives:
   *    "/usgs/pkgs/isis3/isis/tmp/Peaks.cub"
   * </pre>
   *
   * @return QString
   */
  QString FileName::toString() const {
    return expanded();
  }


  /**
   * Clears the current contents of the FileName object and reinitializes it with
   * the argument.
   *
   * @param rhs FileName to replace the current contents of the object.
   *
   * @return void
   */
  FileName &FileName::operator=(const FileName &rhs) {
    m_d = rhs.m_d;
    return *this;
  }


  /**
   * Compares equality of two FileName objects. Returns true if the two objects are equal
   * and false otherwise.
   *
   * @param rhs FileName to compare the current FileName object to.
   *
   * @return Boolean
   */
  bool FileName::operator==(const FileName &rhs) {
    QString expandedOfThis = expanded();
    QString canonicalOfThis = QFileInfo(expandedOfThis).canonicalFilePath();
@@ -342,12 +572,24 @@ namespace Isis {
    return equal;
  }


  /**
   * Compares equality of two FileName objects. Returns false if the two objects are equal
   * and true otherwise.
   *
   * @param rhs FileName to compare the current FileName object to.
   *
   * @return Boolean
   */
  bool FileName::operator!=(const FileName &rhs) {
    return !(*this == rhs);
  }


  /**
   * This looks through the directory of the file and checks for the highest version date of
   * the file that is versioned date.
   *
   * @return QDate
   */
  QDate FileName::highestVersionDate() const {
    QString fileQDatePattern = fileNameQDatePattern();

@@ -405,7 +647,12 @@ namespace Isis {
    return result;
  }


  /**
   * This looks through the directory of the file and checks for the highest version number of
   * the file that is versioned numerically.
   *
   * @return long
   */
  long FileName::highestVersionNum() const {
    QString file = FileName(expanded()).name();
    int result = 0;
@@ -441,7 +688,10 @@ namespace Isis {
    return result;
  }


  /**
   * This verifies the class invariant when using versioning - that the FileName is in an acceptable
   * state to find file version numbers.
   */
  void FileName::validateVersioningState() const {
    QString file = QFileInfo(expanded()).fileName();

@@ -484,6 +734,12 @@ namespace Isis {
    }
  }

  /**
   * This changes the files format. Specifically quotes everything not in {} with single quotes
   * and removes the {} from the file name.
   *
   * @return QString
   */
  QString FileName::fileNameQDatePattern() const {
    // We need to quote everything not in {} with single quotes.
    QString file = FileName(expanded()).name();
@@ -508,7 +764,12 @@ namespace Isis {
    return file;
  }


  /**
   * This returns a QPair of the text (before, after) a version number in a file. Before being
   * the text before the version number and after being the text after the version number.
   *
   * @return QPair
   */
  QPair<QString, QString> FileName::splitNameAroundVersionNum() const {
    QString file = FileName(expanded()).name();
    QString before;
@@ -525,7 +786,9 @@ namespace Isis {
    return QPair<QString, QString>(before, after);
  }


   /**
    * Data constructor, creates a new Data object.
    */
  FileName::Data::Data() {
    m_originalFileNameString = NULL;
    m_expandedFileNameString = NULL;
@@ -534,7 +797,11 @@ namespace Isis {
    m_expandedFileNameString = new QString;
  }


  /**
   * Data copy constructor, creates a copy of a Data object.
   *
   * @param &other Data object to copy
   */
  FileName::Data::Data(const Data &other) : QSharedData(other) {
    m_originalFileNameString = NULL;
    m_expandedFileNameString = NULL;
@@ -543,7 +810,9 @@ namespace Isis {
    m_expandedFileNameString = new QString(*other.m_expandedFileNameString);
  }


  /**
   * Destroys the Data object.
   */
  FileName::Data::~Data() {
    delete m_originalFileNameString;
    m_originalFileNameString = NULL;
@@ -552,7 +821,15 @@ namespace Isis {
    m_expandedFileNameString = NULL;
  }


  /**
   * Returns the original file name, stored in m_originalFileNameString. Boolean
   * parameter includeAttributes determines if the returned file name has the variables
   * included.
   *
   * @param includeAttributes boolean to represent whether the attricubtes should be included.
   *
   * @return Qstring
   */
  QString FileName::Data::original(bool includeAttributes) const {
    QString result = *m_originalFileNameString;

@@ -567,7 +844,13 @@ namespace Isis {
    return result;
  }


  /**
   * Sets the original file name, stored in m_originalFileNameString. QString parameter
   * is the new file name to store in m_originalFileNameString. The expanded verison is also
   * set and stored in m_expandedFileNameString when this method is called.
   *
   * @param originalStr the new file name
   */
  void FileName::Data::setOriginal(const QString &originalStr) {
    *m_originalFileNameString = originalStr;

@@ -633,7 +916,15 @@ namespace Isis {
    *m_expandedFileNameString = expandedStr;
  }


  /**
   * Returns the expanded file name, stored in m_expandedFileNameString. Boolean
   *  parameter includeAttributes determines if the returned file name has the variables
   * included.
   *
   * @param includeAttributes boolean to represent whether the attricubtes should be included.
   *
   * @return Qstring
   */
  QString FileName::Data::expanded(bool includeAttributes) const {
    QString result = *m_expandedFileNameString;

Loading