Isis 3 Programmer Reference
Isis::ControlList Class Reference

Maintains a list of Controls so that control nets can easily be copied from one Project to another, saved to disk, or deleted from disk. More...

#include <ControlList.h>

Inheritance diagram for Isis::ControlList:
Inheritance graph
Collaboration diagram for Isis::ControlList:
Collaboration graph

Classes

class  CopyControlDataFunctor
 This functor is used for copying the control nets between two projects quickly. More...
 
class  XmlHandler
 Nested class used to write the ControlList object information to an XML file for the purposes of saving an restoring the state of the object. More...
 

Signals

void countChanged (int newCount)
 
void deletingList (ControlList *list)
 

Public Member Functions

 ControlList (QString name, QString path, QObject *parent=NULL)
 Create an control list from a control list name and path (does not read Controls). More...
 
 ControlList (QObject *parent=NULL)
 Create a blank control list. More...
 
 ControlList (QList< Control * >, QObject *parent=NULL)
 Create an control list from a list of controls. More...
 
 ControlList (Project *project, XmlStackedHandlerReader *xmlReader, QObject *parent=NULL)
 Create an control list from XML. More...
 
 ControlList (QStringList &)
 Create an control list from a list of control net file names. More...
 
 ControlList (const ControlList &)
 Copy constructor. More...
 
 ~ControlList ()
 Destructor. More...
 
void append (Control *const &value)
 Appends a control pointer to the control list. More...
 
void append (const QList< Control * > &value)
 Appends a list of control pointers to the control list. More...
 
void clear ()
 Clears the control list. More...
 
iterator erase (iterator pos)
 Erases a control pointer from the control list at the specified position. More...
 
iterator erase (iterator begin, iterator end)
 Erases all control pointers starting at "begin" up to (but not including) end. More...
 
void insert (int i, Control *const &value)
 Inserts a control pointer at the specified position in the control list. More...
 
iterator insert (iterator before, Control *const &value)
 Inserts a control pointer before the specified iterator position. More...
 
void prepend (Control *const &value)
 Prepends a control pointer to the control list. More...
 
void push_back (Control *const &value)
 Equivalent to append(value) More...
 
void push_front (Control *const &value)
 Equivalent to prepend(value) More...
 
int removeAll (Control *const &value)
 Removes all occurences of the control pointer in the control list. More...
 
void removeAt (int i)
 Removes the control pointer at the specified index. More...
 
void removeFirst ()
 Removes the first control pointer from the control list. More...
 
void removeLast ()
 Removes the last control pointer from the control list. More...
 
bool removeOne (Control *const &value)
 Removes the first occurence of the control pointer from the control list. More...
 
void swap (QList< Control * > &other)
 Swaps this control list's control pointers with the other list of control pointers. More...
 
ControltakeAt (int i)
 Remove the control pointer at the specified index and returns it. More...
 
ControltakeFirst ()
 Removes the first control pointer from the control list and returns it. More...
 
ControltakeLast ()
 Removes the last control pointer from the control list and returns it. More...
 
ControlListoperator+= (const QList< Control * > &other)
 Appends control pointers from the other list to this control list. More...
 
ControlListoperator+= (Control *const &other)
 Appends a control pointer to this control list. More...
 
ControlListoperator<< (const QList< Control * > &other)
 Appends a list of other control pointers to this control list. More...
 
ControlListoperator<< (Control *const &other)
 Appends a control pointer to this control list. More...
 
ControlListoperator= (const QList< Control * > &rhs)
 Assigns another list of control pointers to this control list. More...
 
ControlListoperator= (const ControlList &rhs)
 Assignment operator. More...
 
QList< QAction * > supportedActions (Project *project=NULL)
 
bool allSupport (ControlDisplayProperties::Property prop)
 
void setName (QString newName)
 Set the human-readable name of this control list. More...
 
void setPath (QString newPath)
 Set the relative path (from the project root) to this control list's folder. More...
 
QString name () const
 Get the human-readable name of this control list. More...
 
QString path () const
 Get the path to these controls in the control list (relative to project root). More...
 
void deleteFromDisk (Project *project)
 Delete all of the contained Controls from disk. More...
 
void save (QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
 Convert this control list into XML format for saving/restoring capabilities. More...
 

Private Attributes

QString m_name
 Name of the ControlList. More...
 
QString m_path
 This stores the directory name that contains the controls in this control list. More...
 

Detailed Description

Maintains a list of Controls so that control nets can easily be copied from one Project to another, saved to disk, or deleted from disk.

Overrides several common QList methods for managing a list of Controls as well. Adapted from ImageList

Author
2012-09-01 Tracie Sucharski
History:
2012-09-01 Tracie Sucharski - Original version.
History:
2015-10-14 Jeffrey Covington - Declared ControlList * as a Qt metatype for use with QVariant.
History:
2016-06-06 Ian Humphrey - Updated documentation and coding standards. Fixes #3959.
History:
2017-05-05 Tracie Sucharski - Removed Workorder.h, never used.
History:
2017-12-08 Tracie Sucharski - When saving project only copy the control if project is being saved to a new location.

Definition at line 44 of file ControlList.h.

Constructor & Destructor Documentation

◆ ControlList() [1/6]

Isis::ControlList::ControlList ( QString  name,
QString  path,
QObject parent = NULL 
)

Create an control list from a control list name and path (does not read Controls).

Parameters
nameThe ControlList's name (i.e. import1, import2, ...)
pathThe ControlList's folder name (i.e. import1, import2, ...)
parentThe Qt-relationship parent

Definition at line 37 of file ControlList.cpp.

References m_name, m_path, name(), and path().

◆ ControlList() [2/6]

Isis::ControlList::ControlList ( QObject parent = NULL)
explicit

Create a blank control list.

Parameters
parentThe Qt-relationship parent

Definition at line 48 of file ControlList.cpp.

◆ ControlList() [3/6]

Isis::ControlList::ControlList ( QList< Control * >  controls,
QObject parent = NULL 
)
explicit

Create an control list from a list of controls.

Parameters
controlsThe list of controls
parentThe Qt-relationship parent

Definition at line 58 of file ControlList.cpp.

References append().

◆ ControlList() [4/6]

Isis::ControlList::ControlList ( Project project,
XmlStackedHandlerReader xmlReader,
QObject parent = NULL 
)
explicit

Create an control list from XML.

Parameters
projectThe project with the control list
xmlReaderThe XML reader currently at an <controlList > tag.
parentThe Qt-relationship parent

Definition at line 70 of file ControlList.cpp.

References Isis::XmlStackedHandlerReader::pushContentHandler().

◆ ControlList() [5/6]

Isis::ControlList::ControlList ( QStringList fileNames)
explicit

Create an control list from a list of control net file names.

This is slow (serial) and not recommended.

Parameters
fileNamesControl net file names

Definition at line 94 of file ControlList.cpp.

References append().

◆ ControlList() [6/6]

Isis::ControlList::ControlList ( const ControlList other)

Copy constructor.

Parameters
otherThe ControlList to copy

Definition at line 81 of file ControlList.cpp.

References m_name, and m_path.

◆ ~ControlList()

Isis::ControlList::~ControlList ( )

Destructor.

This does not free the Controls from memory.

Definition at line 109 of file ControlList.cpp.

Member Function Documentation

◆ append() [1/2]

void Isis::ControlList::append ( const QList< Control * > &  value)

Appends a list of control pointers to the control list.

Parameters
valueThe list of control pointers to append
See also
QList<Control *>::append()

Definition at line 134 of file ControlList.cpp.

◆ append() [2/2]

void Isis::ControlList::append ( Control *const &  value)

Appends a control pointer to the control list.

Parameters
valueThe control pointer to append
See also
QList<Control *>::append()

Definition at line 121 of file ControlList.cpp.

Referenced by Isis::Project::addControl(), and ControlList().

◆ clear()

void Isis::ControlList::clear ( )

Clears the control list.

See also
QList<Control *>::clear()

Definition at line 145 of file ControlList.cpp.

◆ deleteFromDisk()

void Isis::ControlList::deleteFromDisk ( Project project)

Delete all of the contained Controls from disk.

Parameters
projectProject to delete controls from
See also
Control::deleteFromDisk()

Definition at line 562 of file ControlList.cpp.

References Isis::Project::cnetRoot(), Isis::Control::deleteFromDisk(), and m_path.

Referenced by Isis::Project::deleteAllProjectFiles().

◆ erase() [1/2]

QList< Control * >::iterator Isis::ControlList::erase ( iterator  begin,
iterator  end 
)

Erases all control pointers starting at "begin" up to (but not including) end.

Parameters
beginIterator to the first control pointer to erase from the list
endIterator to the end control pointer (which will not be erased)
Returns
QList<Control *>::iterator Iterator to the end control pointer
See also
QList<Control *>::erase()

Definition at line 180 of file ControlList.cpp.

◆ erase() [2/2]

QList< Control * >::iterator Isis::ControlList::erase ( iterator  pos)

Erases a control pointer from the control list at the specified position.

Parameters
posThe position to erase at
Returns
QList<Control *>::iterator Iterator to the next item in the list
See also
QList<Control *>::erase()

Definition at line 163 of file ControlList.cpp.

◆ insert() [1/2]

void Isis::ControlList::insert ( int  i,
Control *const &  value 
)

Inserts a control pointer at the specified position in the control list.

Parameters
iThe index to insert at
valueThe control pointer to insert
See also
QList<Control *>::insert()

Definition at line 195 of file ControlList.cpp.

◆ insert() [2/2]

QList< Control * >::iterator Isis::ControlList::insert ( iterator  before,
Control *const &  value 
)

Inserts a control pointer before the specified iterator position.

Parameters
beforeIterator to the item to insert the control pointer before
valueThe control pointer to insert
Returns
QList<Control *>::iterator Iterator to the inserted control pointer
See also
QList<Control *>::insert()

Definition at line 212 of file ControlList.cpp.

◆ name()

QString Isis::ControlList::name ( ) const

Get the human-readable name of this control list.

Returns
QString The name of the control list (or an empty string if anonymous).

Definition at line 539 of file ControlList.cpp.

References m_name.

Referenced by Isis::Project::controlList(), ControlList(), Isis::ProjectItemModel::onControlListAdded(), Isis::ProjectItem::setControlList(), Isis::ExportControlNetWorkOrder::setupExecution(), and Isis::ControlList::XmlHandler::startElement().

◆ operator+=() [1/2]

ControlList & Isis::ControlList::operator+= ( const QList< Control * > &  other)

Appends control pointers from the other list to this control list.

Parameters
Thelist of other control pointers to append
Returns
ControlList & Reference to this control list
See also
QList<Control *>::operator+=()

Definition at line 404 of file ControlList.cpp.

◆ operator+=() [2/2]

ControlList & Isis::ControlList::operator+= ( Control *const &  other)

Appends a control pointer to this control list.

Parameters
otherThe control pointer to append
Returns
ControlList & Reference to this control list
See also
QList<Control *>::operator+=()

Definition at line 424 of file ControlList.cpp.

◆ operator<<() [1/2]

ControlList & Isis::ControlList::operator<< ( const QList< Control * > &  other)

Appends a list of other control pointers to this control list.

Parameters
otherThe list of other control pointers to append
Returns
ControlList & Reference to this control list
See also
QList<Control *>::operator<<()

Definition at line 440 of file ControlList.cpp.

◆ operator<<() [2/2]

ControlList & Isis::ControlList::operator<< ( Control *const &  other)

Appends a control pointer to this control list.

Parameters
otherThe control pointer to append
Returns
ControlList & Reference to this control list
See also
QList<Control *>::operator<<()

Definition at line 460 of file ControlList.cpp.

◆ operator=() [1/2]

ControlList & Isis::ControlList::operator= ( const ControlList rhs)

Assignment operator.

Parameters
rhsThe right hand side of the '=' operator
Returns
ControlList & Reference to this ControlList
See also
ControlList::operator=(const QList<Control *> &rhs)

Definition at line 497 of file ControlList.cpp.

References m_name, and m_path.

◆ operator=() [2/2]

ControlList & Isis::ControlList::operator= ( const QList< Control * > &  rhs)

Assigns another list of control pointers to this control list.

Parameters
rhsThe other list of control pointers to assign
Returns
ControlList & Reference to this control list
See also
QList<Control *>::operator=()

Definition at line 476 of file ControlList.cpp.

◆ path()

QString Isis::ControlList::path ( ) const

Get the path to these controls in the control list (relative to project root).

This only applies to a control list from the project.

Returns
QString The path to the controls in the control list (or an empty string if unknown).

Definition at line 550 of file ControlList.cpp.

References m_path.

Referenced by ControlList(), and Isis::ControlList::XmlHandler::startElement().

◆ prepend()

void Isis::ControlList::prepend ( Control *const &  value)

Prepends a control pointer to the control list.

Parameters
valueThe control pointer to prepend to the control list
See also
QList<Control *>::prepend()

Definition at line 226 of file ControlList.cpp.

◆ push_back()

void Isis::ControlList::push_back ( Control *const &  value)

Equivalent to append(value)

Parameters
valueThe control pointer to append to the control list
See also
ControlList::append(Control * const &value)
QList<Control *>::push_back()

Definition at line 240 of file ControlList.cpp.

◆ push_front()

void Isis::ControlList::push_front ( Control *const &  value)

Equivalent to prepend(value)

Parameters
valueThe control pointer to prepend to the control list
See also
ControlList::prepend(Control * const &value)
QList<Control *>::push_front()

Definition at line 254 of file ControlList.cpp.

◆ removeAll()

int Isis::ControlList::removeAll ( Control *const &  value)

Removes all occurences of the control pointer in the control list.

Parameters
valueThe control pointer value to remove
Returns
int The number of control pointers removed
See also
QList<Control *>::removeAll()

Definition at line 269 of file ControlList.cpp.

◆ removeAt()

void Isis::ControlList::removeAt ( int  i)

Removes the control pointer at the specified index.

Parameters
iThe index of the control pointer to remove
See also
QList<Control *>::removeAt()

Definition at line 287 of file ControlList.cpp.

◆ removeFirst()

void Isis::ControlList::removeFirst ( )

Removes the first control pointer from the control list.

See also
QList<Control *>::removeFirst()

Definition at line 298 of file ControlList.cpp.

◆ removeLast()

void Isis::ControlList::removeLast ( )

Removes the last control pointer from the control list.

See also
QList<Control *>::removeLast()

Definition at line 309 of file ControlList.cpp.

◆ removeOne()

bool Isis::ControlList::removeOne ( Control *const &  value)

Removes the first occurence of the control pointer from the control list.

Parameters
valueThe control pointer to remove
Returns
bool True if a control pointer was removed; otherwise false
See also
QList<Control *>::removeOne()

Definition at line 324 of file ControlList.cpp.

◆ save()

void Isis::ControlList::save ( QXmlStreamWriter &  stream,
const Project project,
FileName  newProjectRoot 
) const

Convert this control list into XML format for saving/restoring capabilities.

This writes:

  <controlList name="..." path="...">

to the given xml stream, and creates an 'controls.xml' inside the folder with the controls. Inside the controlNetworks.xml, this writes:

  <controls>
    ...
  </controls>
Parameters
streamXML stream that contains the control list data
projectProject to save control list from
newProjectRootFilename root to save control list to
Exceptions
IException::Io"Unable Failed to create directory"
IException::Io"Unable to save control information, could not be opened for writing"

Definition at line 599 of file ControlList.cpp.

References Isis::Project::cnetRoot(), Isis::FileName::dir(), Isis::IException::Io, m_name, m_path, Isis::Project::newProjectRoot(), Isis::FileName::original(), Isis::FileName::path(), Isis::Project::projectRoot(), Isis::Control::save(), and Isis::FileName::toString().

◆ setName()

void Isis::ControlList::setName ( QString  newName)

Set the human-readable name of this control list.

This is really only useful for project control lists (not anonymous temporary ones).

Parameters
newNameThe name to give this control list

Definition at line 518 of file ControlList.cpp.

References m_name.

Referenced by Isis::ProjectItemModel::setData().

◆ setPath()

void Isis::ControlList::setPath ( QString  newPath)

Set the relative path (from the project root) to this control list's folder.

This is really only useful for project control lists (not anonymous temporary ones).

Parameters
newPathThe path to the controls in this control list

Definition at line 529 of file ControlList.cpp.

References m_path.

◆ swap()

void Isis::ControlList::swap ( QList< Control * > &  other)

Swaps this control list's control pointers with the other list of control pointers.

Parameters
otherThe list of control pointers to swap
See also
QList<Control *>::swap()

Definition at line 342 of file ControlList.cpp.

◆ takeAt()

Control * Isis::ControlList::takeAt ( int  i)

Remove the control pointer at the specified index and returns it.

Parameters
iThe index of the control pointer to take
Returns
Contol * The removed control pointer
See also
QList<Control *>::takeAt()

Definition at line 360 of file ControlList.cpp.

◆ takeFirst()

Control * Isis::ControlList::takeFirst ( )

Removes the first control pointer from the control list and returns it.

Returns
Control * The first control pointer in the control list
See also
QList<Control *>::takeFirst()

Definition at line 374 of file ControlList.cpp.

◆ takeLast()

Control * Isis::ControlList::takeLast ( )

Removes the last control pointer from the control list and returns it.

Returns
Control * The last control pointer in the control list
See also
QList<Control *>::takeLast()

Definition at line 388 of file ControlList.cpp.

Member Data Documentation

◆ m_name

QString Isis::ControlList::m_name
private

Name of the ControlList.

Definition at line 170 of file ControlList.h.

Referenced by ControlList(), name(), operator=(), save(), and setName().

◆ m_path

QString Isis::ControlList::m_path
private

This stores the directory name that contains the controls in this control list.

For example: import1 or import2

This path is relative to Project::controlNetRoot()

Definition at line 182 of file ControlList.h.

Referenced by ControlList(), deleteFromDisk(), operator=(), path(), save(), and setPath().


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