9#include "SerialNumber.h"
10#include "ObservationNumber.h"
11#include "SerialNumberList.h"
12#include "IException.h"
16#include "PvlToPvlTranslationManager.h"
50 if(!snTemp.isEmpty()) {
88 return Compose(p, def2filename);
101 if(label.
findObject(
"IsisCube").hasGroup(
"CsmInfo")) {
102 static QString csmTransFile =
"$ISISROOT/appdata/translations/CsmSerialNumber.trn";
104 csmTranslator.Auto(outLabel);
108 static QString missionTransFile =
"$ISISROOT/appdata/translations/MissionName2DataDir.trn";
110 missionXlater.SetLabel(label);
111 QString mission = missionXlater.Translate(
"MissionName");
114 static QString instTransFile =
"$ISISROOT/appdata/translations/Instruments.trn";
116 instrumentXlater.SetLabel(label);
117 QString instrument = instrumentXlater.Translate(
"InstrumentName");
126 static std::map<QString, PvlToPvlTranslationManager> missionTranslators;
129 QString key = mission +
"_" + instrument;
132 std::map<QString, PvlToPvlTranslationManager>::iterator translationIterator = missionTranslators.find(key);
135 if(translationIterator == missionTranslators.end()) {
138 FileName snFile((QString)
"$ISISROOT/appdata/translations/" + mission + instrument +
"SerialNumber.trn");
141 missionTranslators.insert(
145 translationIterator = missionTranslators.find(key);
147 translationIterator->second.SetLabel(label);
148 translationIterator->second.Auto(outLabel);
151 PvlGroup snGroup = outLabel.findGroup(
"SerialNumberKeywords");
165 QString sn = snGroup[
"Keyword1"][0];
166 for(
int i = 2; i <= keys; i++) {
167 QString keyword = QString(
"Keyword%1").arg(i);
168 sn +=
"/" + snGroup[keyword][0];
186 QString filename = list.
fileName(sn);
IO Handler for Isis Cubes.
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
File name manipulation and expansion.
QString name() const
Returns the name of the file excluding the path and the attributes in the file name.
static QString Compose(Pvl &label, bool def2filename=false)
Compose a ObservationNumber from a PVL.
QString fileName() const
Returns the filename used to initialise the Pvl object.
Contains multiple PvlContainers.
Container for cube-like labels.
A single keyword-value pair.
PvlObjectIterator findObject(const QString &name, PvlObjectIterator beg, PvlObjectIterator end)
Find the index of object with a specified name, between two indexes.
Allows applications to translate simple text files.
static PvlGroup FindSerialTranslation(Pvl &label)
Get Groups by translating from correct Translation table.
SerialNumber()
Create an empty SerialNumber object.
static QString Compose(Pvl &label, bool def2filename=false)
Compose a SerialNumber from a PVL.
static QString CreateSerialNumber(PvlGroup &snGroup, int key)
Create the SerialNumber string by concatenating the keywords in the label with '/' in between serialN...
static QString ComposeObservation(const QString &sn, SerialNumberList &list, bool def2filename=false)
Creates the ObservationNumber from a string representing the SerialNumber and a SerialList.
virtual ~SerialNumber()
Destroy a SerialNumber object.
Serial Number list generator.
QString fileName(const QString &sn)
Return a filename given a serial number.
This is free and unencumbered software released into the public domain.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.