Isis 3 Programmer Reference
Isis::SerialNumberList Class Reference

Serial Number list generator. More...

#include <SerialNumberList.h>

Inheritance diagram for Isis::SerialNumberList:
Inheritance graph
Collaboration diagram for Isis::SerialNumberList:
Collaboration graph

Classes

struct  Pair
 A serial number list entity that contains the filename serial number pair. More...
 

Public Member Functions

 SerialNumberList (bool checkTarget=true)
 Creates an empty SerialNumberList. More...
 
 SerialNumberList (const QString &list, bool checkTarget=true, Progress *progress=NULL)
 Creates a SerialNumberList from a list of filenames. More...
 
virtual ~SerialNumberList ()
 Destructor. More...
 
void add (const QString &filename, bool def2filename=false)
 Adds a new filename / serial number pair to the SerialNumberList. More...
 
void add (const QString &serialNumber, const QString &filename)
 Adds a new filename / and pre-composed serial number pair to the SerialNumberList. More...
 
void add (const char *serialNumber, const char *filename)
 Overloaded add method that takes char * parameters. More...
 
bool hasSerialNumber (QString sn)
 Determines whether or not the requested serial number exists in the list. More...
 
void remove (const QString &sn)
 Remove the specified serial number from the list. More...
 
int size () const
 How many serial number / filename combos are in the list. More...
 
QString fileName (const QString &sn)
 Return a filename given a serial number. More...
 
QString fileName (int index)
 Return the filename at the given index. More...
 
QString serialNumber (const QString &filename)
 Return a serial number given a filename. More...
 
QString serialNumber (int index)
 Return a serial number given an index. More...
 
QString observationNumber (int index)
 Return a observation number given an index. More...
 
QString spacecraftInstrumentId (int index)
 Return the spacecraftname/instrumentid at the given index. More...
 
QString spacecraftInstrumentId (const QString &sn)
 Return the spacecraftname/instrumentid given a serial number. More...
 
int serialNumberIndex (const QString &sn)
 Return a list index given a serial number. More...
 
int fileNameIndex (const QString &filename)
 Return a list index given a filename. More...
 
std::vector< QString > possibleSerialNumbers (const QString &on)
 Return possible serial numbers given an observation number. More...
 

Protected Attributes

std::vector< Pairm_pairs
 List of serial number Pair entities. More...
 
std::map< QString, int > m_serialMap
 Maps serial numbers to their positions in the list. More...
 
std::map< QString, int > m_fileMap
 Maps filenames to their positions in the list. More...
 
bool m_checkTarget
 Specifies whether or not to check to make sure the target names match between files added to the serialnumber list. More...
 
QString m_target
 Target name that the files must have if m_checkTarget is true. More...
 

Detailed Description

Serial Number list generator.

Create a list of serial numbers from a list of files

Author
2005-08-03 Jeff Anderson
History:

2005-08-03 Jeff Anderson - Original Version

2006-02-10 Jacob Danton - Added SerialNumber function

2006-02-13 Stuart Sides - Added checks to make sure all the serial number items have the same target.

2006-05-31 Tracie Sucharski - Added filename function that uses index instead of serial number.

2006-06-15 Jeff Anderson - Added GetIndex method

2006-06-22 Brendan George - Added functions to get index, modified/added functions to get filename and serial number, and modified so that index corresponds to order files are input.

2006-08-16 Brendan George - Added/fixed error checking in FileNameIndex() and SerialNumber(string filename).

2006-08-18 Brendan George - Modified to use Expanded FileName on input, allowing for filenames that use environment variables

2006-09-13 Steven Koechle - Added method to get the ObservationNumber when you give it an index

2008-01-10 Christopher Austin - Adapted for the new ObservationNumber class.

2008-10-30 Steven Lambright - Fixed problem with definition of struct Pair, pointed out by "novus0x2a" (Support Board Member)

2009-10-20 Jeannie Walldren - Added Progress flag to Constructor

2009-11-05 Jeannie Walldren - Modified number of maximum steps for Progress flag in Constructor

2010-09-09 Sharmila Prasad - Added API to delete serial# off of the list given Serial #

2010-11-24 Tracie Sucharski - Added bool def2filename parameter to the Add method. This will allow level 2 images to be added to a serial number list.

2012-07-12 Tracie Sucharski - Added new method Add, which takes a pre-composed serial number and a filename.

2016-06-02 Ian Humphrey - Removed SpacecraftInstrumentId method prototypes Fixes #3967.

2017-08-09 Adam Goins - Modified code to be consistent with ISIS coding standards Fixes #3991.

Definition at line 80 of file SerialNumberList.h.

Constructor & Destructor Documentation

◆ SerialNumberList() [1/2]

Isis::SerialNumberList::SerialNumberList ( bool  checkTarget = true)

Creates an empty SerialNumberList.

Parameters
checkTargetSpecifies whether or not to check to make sure the target names match between files added to the serialnumber list

Definition at line 20 of file SerialNumberList.cpp.

References m_checkTarget, and m_target.

◆ SerialNumberList() [2/2]

Isis::SerialNumberList::SerialNumberList ( const QString &  listfile,
bool  checkTarget = true,
Progress progress = NULL 
)

Creates a SerialNumberList from a list of filenames.

Parameters
listfileThe list of files to be given serial numbers
checkTargetSpecifies whether or not to check to make sure the target names match between files added to the serialnumber list
progressMonitors progress of serial number creation
Exceptions
IException::User"Can't open or invalid file list"
History:

2009-10-20 Jeannie Walldren - Added Progress flag

2009-11-05 Jeannie Walldren - Modified number of maximum steps for Progress flag

Definition at line 40 of file SerialNumberList.cpp.

References _FILEINFO_, add(), Isis::Progress::CheckStatus(), m_checkTarget, m_target, Isis::Progress::SetMaximumSteps(), Isis::Progress::SetText(), Isis::toString(), and Isis::IException::User.

◆ ~SerialNumberList()

Isis::SerialNumberList::~SerialNumberList ( )
virtual

Destructor.

Definition at line 71 of file SerialNumberList.cpp.

Member Function Documentation

◆ add() [1/3]

void Isis::SerialNumberList::add ( const QString &  filename,
bool  def2filename = false 
)

Adds a new filename / serial number pair to the SerialNumberList.

Parameters
filenameThe filename to be added
def2filenameIf a serial number could not be found, try to return the filename
Exceptions
IException::User"Unable to find Instrument or Mapping group for comparing target."
IException::User"Unable to find Instrument group for comparing target."
IException::User"Target name from file does not match."
IException::User"Invalid serial number [Unknown] from file."
IException::User"Duplicate serial number from files [file1] and [file2]."
IException::User"FileName cannot be added to serial number list."
History:

2007-06-04 Tracie Sucharski - Expand filename to include full path before adding to list.

2010-11-24 Tracie Sucharski - Added bool def2filename parameter. This will allow level 2 images to be added to a serial number list.

2010-11-29 Tracie Sucharski - Only read the Instrument group if m_checkTarget is True. If def2filename is True, check for Mapping group if Target does not exist.

Definition at line 115 of file SerialNumberList.cpp.

References _FILEINFO_, Isis::ObservationNumber::Compose(), Isis::SerialNumber::Compose(), Isis::FileName::expanded(), fileName(), Isis::PvlObject::findGroup(), Isis::PvlObject::findObject(), Isis::PvlObject::hasGroup(), Isis::PvlContainer::hasKeyword(), hasSerialNumber(), m_checkTarget, m_fileMap, m_pairs, m_serialMap, m_target, serialNumberIndex(), and Isis::IException::User.

Referenced by add(), Isis::ControlNetGraphicsItem::buildChildren(), Isis::BundleAdjust::BundleAdjust(), Isis::QnetTool::openGround(), Isis::ShapeList::serialNumberList(), Isis::ImageList::serialNumberList(), SerialNumberList(), Isis::MatchTool::serialNumberList(), Isis::StereoTool::setFiles(), and Isis::ControlPointEditWidget::setGroundSourceInfo().

◆ add() [2/3]

void Isis::SerialNumberList::add ( const QString &  serialNumber,
const QString &  filename 
)

Adds a new filename / and pre-composed serial number pair to the SerialNumberList.

Parameters
serialNumberthe serial number to be added
filenamethe filename to be added
Exceptions
IException::User"Unable to find Instrument or Mapping group for comparing target."
IException::User"Target name from file does not match."
IException::User"Invalid serial number [Unknown] from file."
IException::User"Duplicate serial number from files [file1] and [file2]."
IException::User"Unable to find Instrument group need for performing bundle adjustment."
IException::User"Unable to find Spacecraftname or InstrumentId keywords needed for performing bundle adjustment."
IException::User"[SerialNumber, FileName] can not be added to serial number list."
Author
2012-07-12 Tracie Sucharski

Definition at line 235 of file SerialNumberList.cpp.

References _FILEINFO_, Isis::FileName::expanded(), fileName(), Isis::PvlObject::findGroup(), Isis::PvlObject::findObject(), Isis::PvlObject::hasGroup(), Isis::PvlContainer::hasKeyword(), hasSerialNumber(), m_checkTarget, m_fileMap, m_pairs, m_serialMap, m_target, observationNumber(), serialNumber(), serialNumberIndex(), and Isis::IException::User.

◆ add() [3/3]

void Isis::SerialNumberList::add ( const char *  serialNumber,
const char *  filename 
)

Overloaded add method that takes char * parameters.

Adds a new filename / serial number pair to the SerialNumberList

Parameters
serialNumberThe serial number to be added
filenameThe filename to be added
See also
add(QString, QString)

Definition at line 211 of file SerialNumberList.cpp.

References add(), and serialNumber().

◆ fileName() [1/2]

QString Isis::SerialNumberList::fileName ( const QString &  sn)

Return a filename given a serial number.

Parameters
snThe serial number of the desired filename
Exceptions
IException::Programmer"Unable to get the FileName. The given serial number does not exist in the list."
Returns
QString The filename matching the input serial number

Definition at line 360 of file SerialNumberList.cpp.

References _FILEINFO_, hasSerialNumber(), m_pairs, m_serialMap, and Isis::IException::Programmer.

Referenced by add(), Isis::QnetTool::addMeasure(), Isis::ControlPointEditWidget::checkReference(), Isis::QnetTool::checkReference(), Isis::SerialNumber::ComposeObservation(), Isis::ControlPointEditWidget::createControlPoint(), Isis::QnetPointCubeNameFilter::createCubeList(), Isis::QnetTool::createFixedPoint(), Isis::QnetTool::createPoint(), Isis::ControlNetFilter::CubeConvexHullFilter(), Isis::ControlNetFilter::CubeDistanceFilter(), Isis::ControlNetFilter::CubeNameExpressionFilter(), Isis::ControlNetFilter::CubeNumPointsFilter(), Isis::ControlPointEditWidget::deletePoint(), Isis::MatchTool::deletePoint(), Isis::QnetTool::deletePoint(), Isis::QnetCubeNameFilter::filter(), Isis::InterestOperator::FindCnetRef(), Isis::ImageOverlapSet::FindImageOverlaps(), Isis::ControlNetStatistics::GenerateImageStats(), Isis::ImageOverlapSet::HandleError(), Isis::InterestOperator::InterestByMeasure(), Isis::InterestOperator::InterestByPoint(), Isis::ControlPointEditWidget::loadGroundMeasure(), Isis::QnetTool::loadGroundMeasure(), Isis::QnetFileTool::loadImage(), Isis::MatchTool::loadMeasureTable(), Isis::QnetTool::loadMeasureTable(), Isis::ControlPointEditWidget::loadPoint(), Isis::MatchTool::loadPoint(), Isis::QnetTool::loadPoint(), Isis::ControlPointEditWidget::openReferenceRadius(), Isis::QnetTool::openReferenceRadius(), Isis::ControlNetFilter::PointCubeNamesFilter(), Isis::ControlNetFilter::PointDistanceFilter(), Isis::ControlNetFilter::PointLatLonFilter(), Isis::ControlNetFilter::PointMeasurePropertiesFilter(), Isis::ControlNetFilter::PrintCubeFileSerialNum(), Isis::ControlNetStatistics::PrintImageStats(), Isis::InterestOperator::ProcessLocked_Point_Reference(), remove(), Isis::ControlPointEditWidget::selectLeftMeasure(), Isis::MatchTool::selectLeftMeasure(), Isis::ControlPointEditWidget::selectRightMeasure(), Isis::MatchTool::selectRightMeasure(), Isis::MatchTool::serialNumberList(), Isis::QnetNewMeasureDialog::setFiles(), Isis::QnetFixedPointDialog::setFiles(), Isis::NewControlPointDialog::setFiles(), Isis::ControlNet::SetImages(), and Isis::ControlPointEditWidget::validateMeasureChange().

◆ fileName() [2/2]

QString Isis::SerialNumberList::fileName ( int  index)

Return the filename at the given index.

Parameters
indexThe index of the desired filename
Exceptions
IException::Programmer"Unable to get the FileName. The given index is invalid."
Returns
QString The filename at the given index

Definition at line 498 of file SerialNumberList.cpp.

References _FILEINFO_, m_pairs, Isis::IException::Programmer, and Isis::toString().

◆ fileNameIndex()

int Isis::SerialNumberList::fileNameIndex ( const QString &  filename)

Return a list index given a filename.

Parameters
filenameThe filename to be searched for
Exceptions
IException::Programmer"Unable to get the FileName index. The given file name does not exist in the list."
Returns
int The index of the input filename
History:

2007-06-04 Tracie Sucharski - Expand filename to include full path before searching list.

2007-07-11 Stuart Sides - Fixed bug where the correct index was not returned.

Definition at line 478 of file SerialNumberList.cpp.

References _FILEINFO_, Isis::FileName::expanded(), m_fileMap, and Isis::IException::Programmer.

Referenced by Isis::QnetTool::addMeasure(), Isis::ControlPointEditWidget::createControlPoint(), Isis::QnetTool::createFixedPoint(), Isis::QnetTool::createPoint(), Isis::ObservationNumberList::observationNumber(), and serialNumber().

◆ hasSerialNumber()

bool Isis::SerialNumberList::hasSerialNumber ( QString  sn)

Determines whether or not the requested serial number exists in the list.

Parameters
snThe serial number to be checked for
Returns
bool

Definition at line 334 of file SerialNumberList.cpp.

References m_serialMap.

Referenced by add(), Isis::MatchTool::deletePoint(), Isis::QnetTool::drawAllMeasurments(), fileName(), Isis::QnetTool::openGround(), Isis::ObservationNumberList::remove(), serialNumberIndex(), Isis::MatchTool::serialNumberList(), Isis::StereoTool::setFiles(), Isis::ControlNet::SetImages(), and spacecraftInstrumentId().

◆ observationNumber()

QString Isis::SerialNumberList::observationNumber ( int  index)

Return a observation number given an index.

Parameters
indexThe index of the desired observation number
Exceptions
IException::Programmer"Unable to get the ObservationNumber. The given index is invalid."
Returns
QString The observation number returned

Definition at line 429 of file SerialNumberList.cpp.

References _FILEINFO_, m_pairs, Isis::IException::Programmer, and Isis::toString().

Referenced by add(), Isis::ObservationNumberList::init(), and possibleSerialNumbers().

◆ possibleSerialNumbers()

std::vector< QString > Isis::SerialNumberList::possibleSerialNumbers ( const QString &  on)

Return possible serial numbers given an observation number.

Parameters
onThe observation number of the possible serial number
Exceptions
IException::Programmer"Unable to get the possible serial numbers. The given observation number does not exist in the list."
Returns
vector<QString> The list of possible serial numbers matching the input observation number

Definition at line 574 of file SerialNumberList.cpp.

References _FILEINFO_, m_pairs, observationNumber(), Isis::IException::Programmer, and serialNumber().

◆ remove()

void Isis::SerialNumberList::remove ( const QString &  sn)

◆ serialNumber() [1/2]

QString Isis::SerialNumberList::serialNumber ( const QString &  filename)

Return a serial number given a filename.

Parameters
filenameThe filename to be matched
Exceptions
IException::Programmer"Unable to get the SerialNumber. The given file name does not exist in the list."
Returns
QString The serial number corresponding to the input filename
History:
2007-06-04 Tracie Sucharski - Expand filename to include full path before searching list.

Definition at line 387 of file SerialNumberList.cpp.

References _FILEINFO_, Isis::FileName::expanded(), fileNameIndex(), m_fileMap, m_pairs, and Isis::IException::Programmer.

Referenced by add(), Isis::QnetTool::addMeasure(), Isis::ControlMeasureEditWidget::blinkStartRight(), Isis::ControlPointEditWidget::createControlPoint(), Isis::QnetTool::createFixedPoint(), Isis::QnetTool::createPoint(), Isis::ControlNetFilter::CubeConvexHullFilter(), Isis::ControlNetFilter::CubeDistanceFilter(), Isis::ControlNetFilter::CubeNameExpressionFilter(), Isis::ControlNetFilter::CubeNumPointsFilter(), Isis::QnetCubeDistanceFilter::filter(), Isis::QnetPointCubeNameFilter::filter(), Isis::ImageOverlapSet::FindImageOverlaps(), Isis::ControlNetStatistics::InitSerialNumMap(), Isis::MatchTool::mouseButtonRelease(), Isis::QnetTool::mouseButtonRelease(), Isis::ObservationNumber::PossibleSerial(), possibleSerialNumbers(), Isis::ControlPointEditWidget::selectLeftMeasure(), Isis::MatchTool::selectLeftMeasure(), Isis::QnetTool::selectLeftMeasure(), Isis::ControlPointEditWidget::selectRightMeasure(), Isis::MatchTool::selectRightMeasure(), Isis::QnetTool::selectRightMeasure(), Isis::QnetNewMeasureDialog::setFiles(), and Isis::ControlNet::SetImages().

◆ serialNumber() [2/2]

QString Isis::SerialNumberList::serialNumber ( int  index)

Return a serial number given an index.

Parameters
indexThe index of the desired serial number
Exceptions
IException::Programmer"Unable to get the SerialNumber. The given index is invalid."
Returns
QString The serial number returned

Definition at line 407 of file SerialNumberList.cpp.

References _FILEINFO_, m_pairs, Isis::IException::Programmer, and Isis::toString().

◆ serialNumberIndex()

int Isis::SerialNumberList::serialNumberIndex ( const QString &  sn)

Return a list index given a serial number.

Parameters
snThe serial number searched for
Exceptions
IException::Programmer"Unable to get the SerialNumber index. The given serial number does not exist in the list."
Returns
int The index of the serial number

Definition at line 451 of file SerialNumberList.cpp.

References _FILEINFO_, hasSerialNumber(), m_serialMap, and Isis::IException::Programmer.

Referenced by add(), Isis::QnetTool::addMeasure(), Isis::ControlPointEditWidget::createTemporaryGroundMeasure(), Isis::QnetSetAprioriDialog::fillReferenceAprioriLineEdits(), Isis::QnetPointDistanceFilter::filter(), Isis::QnetTool::findPointLocation(), Isis::ObservationNumberList::observationNumberMapIndex(), remove(), and Isis::ControlPointEditWidget::setShapesForPoint().

◆ size()

◆ spacecraftInstrumentId() [1/2]

QString Isis::SerialNumberList::spacecraftInstrumentId ( int  index)

Return the spacecraftname/instrumentid at the given index.

Parameters
indexThe index of the desired spacecraftname/instrumentid
Exceptions
IException::Programmer"Unable to get the Spacecraft InstrumentId. The given index is invalid."
Returns
QString The spacecraftname/instrumentid at the given index

Definition at line 520 of file SerialNumberList.cpp.

References _FILEINFO_, m_pairs, Isis::IException::Programmer, and Isis::toString().

◆ spacecraftInstrumentId() [2/2]

QString Isis::SerialNumberList::spacecraftInstrumentId ( const QString &  sn)

Return the spacecraftname/instrumentid given a serial number.

Parameters
snThe serial number of the desired spacecraftname/instrumentid
Exceptions
IException::Programmer"Unable to get the Spacecraft InstrumentId. The given serial number does not exist in the list."
Returns
QString The spacecraftname/instrumentid matching the input serial number

Definition at line 546 of file SerialNumberList.cpp.

References _FILEINFO_, hasSerialNumber(), m_pairs, m_serialMap, and Isis::IException::Programmer.

Member Data Documentation

◆ m_checkTarget

bool Isis::SerialNumberList::m_checkTarget
protected

Specifies whether or not to check to make sure the target names match between files added to the serialnumber list.

Definition at line 128 of file SerialNumberList.h.

Referenced by add(), and SerialNumberList().

◆ m_fileMap

std::map<QString, int> Isis::SerialNumberList::m_fileMap
protected

Maps filenames to their positions in the list.

Definition at line 122 of file SerialNumberList.h.

Referenced by add(), fileNameIndex(), Isis::ObservationNumberList::observationNumber(), remove(), and serialNumber().

◆ m_pairs

◆ m_serialMap

std::map<QString, int> Isis::SerialNumberList::m_serialMap
protected

Maps serial numbers to their positions in the list.

Definition at line 121 of file SerialNumberList.h.

Referenced by add(), fileName(), hasSerialNumber(), remove(), serialNumberIndex(), and spacecraftInstrumentId().

◆ m_target

QString Isis::SerialNumberList::m_target
protected

Target name that the files must have if m_checkTarget is true.

Definition at line 129 of file SerialNumberList.h.

Referenced by add(), and SerialNumberList().


The documentation for this class was generated from the following files: