Loading isis/src/base/apps/phocube/phocube.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ using namespace std; namespace Isis { // Function to create a keyword with same values of a specified count template <typename T> PvlKeyword makeKey(const QString &name, const int &nvals, Loading @@ -30,22 +31,21 @@ namespace Isis { double m_albedo; }; // Computes the special MORPHOLOGYRANK and ALBEDORANK planes static MosData *getMosaicIndicies(Camera &camera, MosData &md); // Updates BandBin keyword static void UpdateBandKey(const QString &keyname, PvlGroup &bb, const int &nvals, const QString &default_value = "Null"); void phocube(UserInterface &ui) { Cube icube; CubeAttributeInput inAtt = ui.GetInputAttribute("FROM"); if (inAtt.bands().size() != 0) { icube.setVirtualBands(inAtt.bands()); } icube.open(ui.GetFileName("FROM")); icube.open(ui.GetCubeName("FROM")); phocube(&icube, ui); } void phocube(Cube *icube, UserInterface &ui) { // Get the camera information if this is not a mosaic. Otherwise, get the Loading isis/src/base/objs/Cube/Cube.cpp +10 −2 Original line number Diff line number Diff line Loading @@ -617,7 +617,9 @@ namespace Isis { /** * This method will open an isis cube for reading or reading/writing. * This method will open an existing isis cube for reading or * reading/writing. Any input cube attributes following the file * name will be applied. * * @param[in] cubeFileName Name of the cube file to open. Environment * variables in the filename will be automatically expanded. Loading @@ -625,8 +627,8 @@ namespace Isis { * accessed. Either read-only "r" or read-write "rw". */ void Cube::open(const QString &cubeFileName, QString access) { // Already opened? // Already opened? if (isOpen()) { string msg = "You already have a cube opened"; throw IException(IException::Programmer, msg, _FILEINFO_); Loading @@ -634,6 +636,12 @@ namespace Isis { initLabelFromFile(cubeFileName, (access == "rw")); Isis::CubeAttributeInput att(cubeFileName); if(att.bands().size() != 0) { vector<QString> bands = att.bands(); setVirtualBands(bands); } // Figure out the name of the data file try { PvlObject &core = m_label->findObject("IsisCube").findObject("Core"); Loading isis/src/base/objs/IsisAml/IsisAml.cpp +59 −0 Original line number Diff line number Diff line Loading @@ -678,6 +678,65 @@ void IsisAml::GetFileName(const QString ¶mName, } /** * Retrieves of a value for a parameter of type "cubename". * * @param paramName The partial or full name of the parameter to be retrieved. * @param extension A default extension to add if it does not already exist on * the file name. For example, "txt" will make /mydir/myfile into * /mydir/myfile.txt * * @return The value of the parameter. */ QString IsisAml::GetCubeName(const QString ¶mName, QString extension) const { const IsisParameterData *param = ReturnParam(paramName); if (param->type != "cube") { QString message = "Parameter [" + paramName + "] is not a cubename."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); } QString value; if (param->values.size() == 0) { if (param->defaultValues.size() == 0) { QString message = "Parameter [" + paramName + "] has no value."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } else { value = param->defaultValues[0]; } } else { value = param->values[0]; } Isis::FileName name(value); if (extension != "") name = name.addExtension(extension); value = name.expanded(); if (name.attributes().length() > 0) { value += "+" + name.attributes(); } return value; } // Public: Returns the first element of the value member of a parameter whos // name starts with paramName as a QString /** Loading isis/src/base/objs/IsisAml/IsisAml.h +2 −0 Original line number Diff line number Diff line Loading @@ -172,6 +172,8 @@ class IsisAml : protected IsisAmlData { QString GetFileName(const QString ¶mName, QString extension = "") const; void GetFileName(const QString ¶mName, std::vector<QString> &values) const; QString GetCubeName(const QString ¶mName, QString extension = "") const; QString GetString(const QString ¶mName) const; void GetString(const QString ¶mName, std::vector<QString> &values) const; Loading Loading
isis/src/base/apps/phocube/phocube.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ using namespace std; namespace Isis { // Function to create a keyword with same values of a specified count template <typename T> PvlKeyword makeKey(const QString &name, const int &nvals, Loading @@ -30,22 +31,21 @@ namespace Isis { double m_albedo; }; // Computes the special MORPHOLOGYRANK and ALBEDORANK planes static MosData *getMosaicIndicies(Camera &camera, MosData &md); // Updates BandBin keyword static void UpdateBandKey(const QString &keyname, PvlGroup &bb, const int &nvals, const QString &default_value = "Null"); void phocube(UserInterface &ui) { Cube icube; CubeAttributeInput inAtt = ui.GetInputAttribute("FROM"); if (inAtt.bands().size() != 0) { icube.setVirtualBands(inAtt.bands()); } icube.open(ui.GetFileName("FROM")); icube.open(ui.GetCubeName("FROM")); phocube(&icube, ui); } void phocube(Cube *icube, UserInterface &ui) { // Get the camera information if this is not a mosaic. Otherwise, get the Loading
isis/src/base/objs/Cube/Cube.cpp +10 −2 Original line number Diff line number Diff line Loading @@ -617,7 +617,9 @@ namespace Isis { /** * This method will open an isis cube for reading or reading/writing. * This method will open an existing isis cube for reading or * reading/writing. Any input cube attributes following the file * name will be applied. * * @param[in] cubeFileName Name of the cube file to open. Environment * variables in the filename will be automatically expanded. Loading @@ -625,8 +627,8 @@ namespace Isis { * accessed. Either read-only "r" or read-write "rw". */ void Cube::open(const QString &cubeFileName, QString access) { // Already opened? // Already opened? if (isOpen()) { string msg = "You already have a cube opened"; throw IException(IException::Programmer, msg, _FILEINFO_); Loading @@ -634,6 +636,12 @@ namespace Isis { initLabelFromFile(cubeFileName, (access == "rw")); Isis::CubeAttributeInput att(cubeFileName); if(att.bands().size() != 0) { vector<QString> bands = att.bands(); setVirtualBands(bands); } // Figure out the name of the data file try { PvlObject &core = m_label->findObject("IsisCube").findObject("Core"); Loading
isis/src/base/objs/IsisAml/IsisAml.cpp +59 −0 Original line number Diff line number Diff line Loading @@ -678,6 +678,65 @@ void IsisAml::GetFileName(const QString ¶mName, } /** * Retrieves of a value for a parameter of type "cubename". * * @param paramName The partial or full name of the parameter to be retrieved. * @param extension A default extension to add if it does not already exist on * the file name. For example, "txt" will make /mydir/myfile into * /mydir/myfile.txt * * @return The value of the parameter. */ QString IsisAml::GetCubeName(const QString ¶mName, QString extension) const { const IsisParameterData *param = ReturnParam(paramName); if (param->type != "cube") { QString message = "Parameter [" + paramName + "] is not a cubename."; throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_); } QString value; if (param->values.size() == 0) { if (param->defaultValues.size() == 0) { QString message = "Parameter [" + paramName + "] has no value."; throw Isis::IException(Isis::IException::User, message, _FILEINFO_); } else { value = param->defaultValues[0]; } } else { value = param->values[0]; } Isis::FileName name(value); if (extension != "") name = name.addExtension(extension); value = name.expanded(); if (name.attributes().length() > 0) { value += "+" + name.attributes(); } return value; } // Public: Returns the first element of the value member of a parameter whos // name starts with paramName as a QString /** Loading
isis/src/base/objs/IsisAml/IsisAml.h +2 −0 Original line number Diff line number Diff line Loading @@ -172,6 +172,8 @@ class IsisAml : protected IsisAmlData { QString GetFileName(const QString ¶mName, QString extension = "") const; void GetFileName(const QString ¶mName, std::vector<QString> &values) const; QString GetCubeName(const QString ¶mName, QString extension = "") const; QString GetString(const QString ¶mName) const; void GetString(const QString ¶mName, std::vector<QString> &values) const; Loading