diff --git a/isis/src/base/apps/copylabel/copylabel.xml b/isis/src/base/apps/copylabel/copylabel.xml index 8eedf7861da07196bbc4d79fa483101f23717ee8..1f0ac43c201ff813ee5e002c6db252f566d52087 100644 --- a/isis/src/base/apps/copylabel/copylabel.xml +++ b/isis/src/base/apps/copylabel/copylabel.xml @@ -66,6 +66,11 @@ <change name="Mackenzie Boyd" date="2011-04-27"> Original version. </change> + <change name="Adam Paquette" date="2022-08-02"> + Added the ability to directly request objects from a cubes + label to be copied to the new cube. Similarly to how the + GROUPS argument functions. + </change> </history> <category> @@ -202,12 +207,24 @@ Copy the given groups, in CSV format </brief> <description> - Copy and given groups over to the FROM cube, groups must exist in the + Copy any given groups over to the FROM cube, groups must exist in the IsisCube Object to be copied, and must be specified with exact spelling, comma separated. </description> </parameter> + <parameter name="OBJECTS"> + <type>string</type> + <internalDefault>none</internalDefault> + <brief> + Copy the given objects, in CSV format + </brief> + <description> + Copy any given objects over to the FROM cube, groups must be specified + with exact spelling, and be comma separated. + </description> + </parameter> + <parameter name="BLOBS"> <type>string</type> <internalDefault>none</internalDefault> diff --git a/isis/src/base/apps/copylabel/main.cpp b/isis/src/base/apps/copylabel/main.cpp index a5250d6a78e8f9d8bc4fa18a7790491ab62549f8..edaf5437f1e717c12cb61a0f3943cd0057b35e05 100644 --- a/isis/src/base/apps/copylabel/main.cpp +++ b/isis/src/base/apps/copylabel/main.cpp @@ -17,7 +17,8 @@ using namespace std; using namespace Isis; bool copyGroup(Pvl * source, Pvl * mergeTo, QString name); -bool copyBlob(Cube * from, Cube * to, QString type, QString name, QString fname); +bool copyObject(Pvl *source, Pvl *mergeTo, QString name); +bool copyBlob(Cube *from, Cube *to, QString type, QString name, QString fname); void IsisMain() { UserInterface &ui = Application::GetUserInterface(); @@ -194,6 +195,19 @@ void IsisMain() { } } + // Any other requested objects + if (ui.WasEntered("Objects")) { + QString objs = QString(ui.GetString("Objects")).remove(" "); + QStringList list = objs.split(","); + QString obj; + foreach (obj, list) { + if (obj.size() != 0) { + bool success = copyObject(source, mergeTo, obj); + results += PvlKeyword(obj, success ? "true" : "false"); + } + } + } + // Any other requested blobs // Expected format is: <Object name>:<Name keyword> if (ui.WasEntered("Blobs")) { @@ -255,6 +269,26 @@ bool copyGroup(Pvl * source, Pvl * mergeTo, QString name) { } } +// Copy an Object from the IsisCube pvl in one cube to the other +// If it exists in the source, we'll copy it, if it exists in the +// mergeTo Pvl, we'll overwrite it. +bool copyObject(Pvl *source, Pvl *mergeTo, QString name) +{ + try + { + // The call we're looking to get an exception on is the one just below. + PvlObject &toCopy = source->findObject(name, Pvl::Traverse); + if (mergeTo->hasObject(name)) + mergeTo->deleteGroup(name); + mergeTo->addObject(toCopy); + return true; + } + catch (IException &) + { + return false; + } +} + bool copyBlob(Cube * from, Cube * to, QString name, QString type, QString fname) { try { Blob blob(name, type, fname); diff --git a/isis/src/base/objs/PvlObject/PvlObject.cpp b/isis/src/base/objs/PvlObject/PvlObject.cpp index 9d17fd475d57719f964974e3636be7f883d0123e..da98a77bb576bcd6daf3436f43eac8968c4e6c20 100644 --- a/isis/src/base/objs/PvlObject/PvlObject.cpp +++ b/isis/src/base/objs/PvlObject/PvlObject.cpp @@ -66,7 +66,7 @@ namespace Isis { if (it.value().is_array()) { keyword.setName(QString::fromStdString(it.key())); for(auto ar = it.value().begin(); ar!=it.value().end();ar++) { - keyword += QString::number(ar->get<double>()); + keyword += QString::number(ar->get<double>(), 'g', 16); } } else if(it.value().is_number()) { diff --git a/isis/src/base/objs/Spice/Spice.cpp b/isis/src/base/objs/Spice/Spice.cpp index d1b8d33d6020cff1e20afa96f09db0abe70bd396..5a3c3460611ca198f2f2dfb6d13218e7a48a5468 100644 --- a/isis/src/base/objs/Spice/Spice.cpp +++ b/isis/src/base/objs/Spice/Spice.cpp @@ -350,7 +350,7 @@ namespace Isis { else { // JAA - Modified to store and look for the frame body code in the cube labels SpiceInt frameCode; - if ((m_usingNaif) || (!m_naifKeywords->hasKeyword("BODY_FRAME_CODE"))) { + if ((m_usingNaif) && (!m_naifKeywords->hasKeyword("BODY_FRAME_CODE"))) { char frameName[32]; SpiceBoolean found; cidfrm_c(*m_spkBodyCode, sizeof(frameName), &frameCode, frameName, &found); @@ -463,9 +463,6 @@ namespace Isis { if (m_usingAle) { m_instrumentPosition->LoadCache(isd["instrument_position"]); - if (m_instrumentPosition->cacheSize() > 3) { - m_instrumentPosition->Memcache2HermiteCache(0.01); - } } else if (kernels["InstrumentPosition"][0].toUpper() == "TABLE") { Table t("InstrumentPosition", lab.fileName(), lab); @@ -704,6 +701,13 @@ namespace Isis { cacheSize); if (cacheSize > 3) m_instrumentPosition->Memcache2HermiteCache(tol); } + else if (m_instrumentPosition->GetSource() == SpicePosition::Memcache) { + int aleCacheSize = m_instrumentPosition->cacheSize(); + if (aleCacheSize > 3) { + m_instrumentPosition->Memcache2HermiteCache(tol); + } + } + if (!m_sunPosition->IsCached()) { int sunPositionCacheSize = cacheSize;