48 if (progress != NULL) {
49 progress->
SetText(
"Creating Isis 3 serial numbers from list file.");
53 for (
int i = 0; i < flist.size(); i++) {
55 if (progress != NULL) {
61 QString msg =
"Can't open or invalid file list [" + listfile +
"].";
125 if (cubeObj.
hasGroup(
"Instrument")) {
126 targetGroup = cubeObj.
findGroup(
"Instrument");
128 else if (def2filename) {
131 targetGroup = cubeObj.
findGroup(
"Mapping");
134 QString msg =
"Unable to find Instrument or Mapping group in " 135 + filename +
" for comparing target.";
141 QString msg =
"Unable to find Instrument group in " + filename
142 +
" for comparing target.";
146 target = targetGroup[
"TargetName"][0];
147 target = target.toUpper();
152 QString msg =
"Target name of [" + target +
"] from file [" 153 + filename +
"] does not match [" +
m_target +
"].";
161 if (sn ==
"Unknown") {
162 QString msg =
"Invalid serial number [Unknown] from file [" 168 QString msg =
"Duplicate serial number [" + sn +
"] from files [" 175 nextpair.serialNumber = sn;
176 nextpair.observationNumber = on;
180 if (cubeObj.
hasGroup(
"Instrument")) {
183 nextpair.spacecraftName = cubeObj.
findGroup(
"Instrument")[
"SpacecraftName"][0];
184 nextpair.instrumentId = cubeObj.
findGroup(
"Instrument")[
"InstrumentId"][0];
190 m_fileMap.insert(std::pair<QString, int>(nextpair.filename, (
int)(
m_pairs.size() - 1)));
194 "] can not be added to serial number list.";
245 if (cubeObj.
hasGroup(
"Instrument")) {
246 targetGroup = cubeObj.
findGroup(
"Instrument");
248 else if (cubeObj.
hasGroup(
"Mapping")) {
250 targetGroup = cubeObj.
findGroup(
"Mapping");
253 QString msg =
"Unable to find Instrument or Mapping group in " 254 + filename +
" for comparing target.";
258 target = targetGroup[
"TargetName"][0];
259 target = target.toUpper();
264 QString msg =
"Target name of [" + target +
"] from file [" 265 + filename +
"] does not match [" +
m_target +
"].";
272 QString msg =
"Invalid serial number [Unknown] from file [" 278 QString msg =
"Duplicate, serial number [" +
serialNumber +
"] from files [" 280 +
"] and [" +
fileName(index) +
"].";
286 if (!cubeObj.
hasGroup(
"Instrument")) {
287 QString msg =
"Unable to find Instrument group in " + filename
288 +
" needed for performing bundle adjustment.";
293 QString msg =
"Unable to find SpacecraftName or InstrumentId keywords in " + filename
294 +
" needed for performing bundle adjustment.";
305 if (cubeObj.
hasGroup(
"Instrument")) {
308 nextpair.spacecraftName = cubeObj.
findGroup(
"Instrument")[
"SpacecraftName"][0];
309 nextpair.instrumentId = cubeObj.
findGroup(
"Instrument")[
"InstrumentId"][0];
315 m_fileMap.insert(std::pair<QString, int>(nextpair.filename, (
int)(
m_pairs.size() - 1)));
318 QString msg =
"[SerialNumber, FileName] = [" +
serialNumber +
", " 320 +
"] can not be added to serial number list.";
363 return m_pairs[index].filename;
366 QString msg =
"Unable to get the FileName. The given serial number [" 367 + sn +
"] does not exist in the list.";
389 QString msg =
"Unable to get the SerialNumber. The given file name [" 394 return m_pairs[index].serialNumber;
408 if (index >= 0 && index < (
int)
m_pairs.size()) {
409 return m_pairs[index].serialNumber;
412 QString msg =
"Unable to get the SerialNumber. The given index [" 413 +
toString(index) +
"] is invalid.";
430 if (index >= 0 && index < (
int)
m_pairs.size()) {
431 return m_pairs[index].observationNumber;
434 QString msg =
"Unable to get the ObservationNumber. The given index [" 435 +
toString(index) +
"] is invalid.";
456 QString msg =
"Unable to get the SerialNumber index. The given serial number [" 457 + sn +
"] does not exist in the list.";
479 std::map<QString, int>::iterator pos;
481 QString msg =
"Unable to get the FileName index. The given file name [" 499 if (index >= 0 && index < (
int)
m_pairs.size()) {
500 return m_pairs[index].filename;
503 QString msg =
"Unable to get the FileName. The given index [" 504 +
toString(index) +
"] is invalid.";
521 if (index >= 0 && index < (
int)
m_pairs.size()) {
522 QString scid = (
m_pairs[index].spacecraftName +
"/" +
m_pairs[index].instrumentId).toUpper();
525 (void)scid.simplified();
526 return scid.replace(
" ",
"");
529 QString msg =
"Unable to get the Spacecraft InstrumentId. The given index [" 530 +
toString(index) +
"] is invalid.";
549 QString scid = (
m_pairs[index].spacecraftName +
"/" +
m_pairs[index].instrumentId).toUpper();
552 (void)scid.simplified();
553 return scid.replace(
" ",
"");
556 QString msg =
"Unable to get the Spacecraft InstrumentId. The given serial number [" 557 + sn +
"] does not exist in the list.";
575 std::vector<QString> numbers;
576 for (
unsigned index = 0; index <
m_pairs.size(); index++) {
581 if (numbers.size() > 0) {
585 QString msg =
"Unable to get the possible serial numbers. The given observation number [" 586 + on +
"] does not exist in the list.";
int serialNumberIndex(const QString &sn)
Return a list index given a serial number.
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
void SetMaximumSteps(const int steps)
This sets the maximum number of steps in the process.
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
bool hasSerialNumber(QString sn)
Determines whether or not the requested serial number exists in the list.
virtual ~SerialNumberList()
Destructor.
File name manipulation and expansion.
void add(const QString &filename, bool def2filename=false)
Adds a new filename / serial number pair to the SerialNumberList.
PvlObjectIterator findObject(const QString &name, PvlObjectIterator beg, PvlObjectIterator end)
Find the index of object with a specified name, between two indexes.
QString serialNumber(const QString &filename)
Return a serial number given a filename.
Internalizes a list of files.
bool hasGroup(const QString &name) const
Returns a boolean value based on whether the object has the specified group or not.
QString spacecraftInstrumentId(int index)
Return the spacecraftname/instrumentid at the given index.
std::vector< QString > possibleSerialNumbers(const QString &on)
Return possible serial numbers given an observation number.
std::map< QString, int > m_fileMap
Maps filenames to their positions in the list.
int fileNameIndex(const QString &filename)
Return a list index given a filename.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
bool m_checkTarget
Specifies whether or not to check to make sure the target names match between files added to the seri...
This error is for when a programmer made an API call that was illegal.
void CheckStatus()
Checks and updates the status.
static QString Compose(Pvl &label, bool def2filename=false)
Compose a SerialNumber from a PVL.
std::map< QString, int > m_serialMap
Maps serial numbers to their positions in the list.
QString fileName(const QString &sn)
Return a filename given a serial number.
A serial number list entity that contains the filename serial number pair.
std::vector< Pair > m_pairs
List of serial number Pair entities.
Program progress reporter.
static QString Compose(Pvl &label, bool def2filename=false)
Compose a ObservationNumber from a PVL.
void SetText(const QString &text)
Changes the value of the text string reported just before 0% processed.
Contains multiple PvlContainers.
#define _FILEINFO_
Macro for the filename and line number.
QString m_target
Target name that the files must have if m_checkTarget is true.
A type of error that could only have occurred due to a mistake on the user's part (e...
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
void remove(const QString &sn)
Remove the specified serial number from the list.
Container for cube-like labels.
int size() const
How many serial number / filename combos are in the list.
QString observationNumber(int index)
Return a observation number given an index.
Namespace for ISIS/Bullet specific routines.
SerialNumberList(bool checkTarget=true)
Creates an empty SerialNumberList.
Contains Pvl Groups and Pvl Objects.