Isis 3 Programmer Reference
|
Internalizes a list of shapes and allows for operations on the entire list. More...
#include <ShapeList.h>
Classes | |
class | CopyShapeDataFunctor |
This functor is used for copying the shapes between two projects quickly. More... | |
Signals | |
void | countChanged (int newCount) |
Public Member Functions | |
ShapeList (QString name, QString path, QObject *parent=NULL) | |
Creates an shape list from an shape list name and path (does not read Shapes). | |
ShapeList (QObject *parent=NULL) | |
Creates a blank shape list. | |
ShapeList (QList< Shape * >, QObject *parent=NULL) | |
Creates an shape list from a list of shapes. | |
ShapeList (QStringList &) | |
Creates an shape list from a list of cube file names. | |
ShapeList (const ShapeList &) | |
Copy constructor. | |
~ShapeList () | |
Destructor. | |
SerialNumberList | serialNumberList () |
Creates a SerialNumberList from the shape list. | |
void | append (Shape *const &value) |
Appends an shape to the shape list. | |
void | append (const QList< Shape * > &value) |
Appends a list of shapes to the shape list. | |
void | clear () |
Clears the shape list. | |
iterator | erase (iterator pos) |
Erases a single shape from the shape list. | |
iterator | erase (iterator begin, iterator end) |
Erases a range of shapes from the shape list. | |
void | insert (int i, Shape *const &value) |
Inserts an shape into the shape list at an index. | |
iterator | insert (iterator before, Shape *const &value) |
Inserts an shape into the shape list after an iterator. | |
void | prepend (Shape *const &value) |
Inserts an shape at the beginning of the shape list. | |
void | push_back (Shape *const &value) |
Appends an shape to the end of the shape list. | |
void | push_front (Shape *const &value) |
Prepends an shape to the beginning of the shape list. | |
int | removeAll (Shape *const &value) |
Removes all occurances of an shape. | |
void | removeAt (int i) |
Removes the shape at an index. | |
void | removeFirst () |
Removes the shape at the front of the shape list. | |
void | removeLast () |
Removes the shape at the end of the shape list. | |
bool | removeOne (Shape *const &value) |
Removes the first occurance of an shape. | |
void | swap (QList< Shape * > &other) |
Swaps the shape list with another list of shapes. | |
Shape * | takeAt (int i) |
Removes the shape at an index and returns it. | |
Shape * | takeFirst () |
Removes and returns the first shape. | |
Shape * | takeLast () |
Removes and returns the last shape. | |
ShapeList & | operator+= (const QList< Shape * > &other) |
Appends a list of shapes to the end of the shape list. | |
ShapeList & | operator+= (Shape *const &other) |
Appends a single shape to the end of the shape list. | |
ShapeList & | operator<< (const QList< Shape * > &other) |
Appends a list of shapes to the end of the shape list. | |
ShapeList & | operator<< (Shape *const &other) |
Appends a single shape to the end of the shape list. | |
ShapeList & | operator= (const QList< Shape * > &rhs) |
Assigns another list of shapes to the shape list. | |
ShapeList & | operator= (const ShapeList &rhs) |
Assignment operator. | |
void | setName (QString newName) |
Set the human-readable name of this shape list. | |
void | setPath (QString newPath) |
Set the relative path (from the project root) to this shape list's folder. | |
QString | name () const |
Get the human-readable name of this shape list. | |
QString | path () const |
Get the path to the shapes in the shape list (relative to project root). | |
void | deleteFromDisk (Project *project) |
Delete all of the contained Shapes from disk. | |
void | save (QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const |
Convert this shape list into XML format for saving/restoring capabilities. | |
Private Attributes | |
QString | m_name |
This stores the shape list's name. | |
QString | m_path |
This stores the directory name that contains the shapes in this shape list. | |
Internalizes a list of shapes and allows for operations on the entire list.
This class reads a list of shapes from an shapes.xml file and internalizes them as aQList of shapes. It also allows for modifications to the entire list of shapes and storing the shape list as an shapes.xml file.
Definition at line 31 of file ShapeList.h.
Isis::ShapeList::ShapeList | ( | QString | name, |
QString | path, | ||
QObject * | parent = NULL ) |
Creates an shape list from an shape list name and path (does not read Shapes).
name | The ShapeList's name (i.e. import1, import2, ...). |
path | The ShapeList's folder name (i.e. import1, import2, ...). |
parent | The Qt-relationship parent. |
Definition at line 34 of file ShapeList.cpp.
|
explicit |
Creates a blank shape list.
parent | The Qt-relationship parent. |
Definition at line 45 of file ShapeList.cpp.
Creates an shape list from a list of shapes.
shapes | The list of shapes. |
parent | The Qt-relationship parent. |
Definition at line 55 of file ShapeList.cpp.
References append().
|
explicit |
Creates an shape list from a list of cube file names.
This is slow (serial) and not recommended.
fileNames | The list of cube fileNames. |
Definition at line 77 of file ShapeList.cpp.
References append().
Isis::ShapeList::ShapeList | ( | const ShapeList & | other | ) |
Copy constructor.
other | The shape list to copy. |
Definition at line 65 of file ShapeList.cpp.
Isis::ShapeList::~ShapeList | ( | ) |
Appends a list of shapes to the shape list.
value | the list of shapes to be appened. |
Definition at line 132 of file ShapeList.cpp.
void Isis::ShapeList::append | ( | Shape *const & | value | ) |
Appends an shape to the shape list.
value | The shape to be appended. |
Definition at line 119 of file ShapeList.cpp.
Referenced by Isis::ImportShapesWorkOrder::importConfirmedShapes(), Isis::WorkOrder::isExecutable(), Isis::WorkOrder::setData(), ShapeList(), and ShapeList().
void Isis::ShapeList::clear | ( | ) |
Clears the shape list.
Definition at line 143 of file ShapeList.cpp.
void Isis::ShapeList::deleteFromDisk | ( | Project * | project | ) |
Delete all of the contained Shapes from disk.
project | The project the shapes in the shape list belong to. |
Definition at line 564 of file ShapeList.cpp.
References Isis::Shape::deleteFromDisk(), m_path, and Isis::Project::shapeDataRoot().
Referenced by Isis::ImportShapesWorkOrder::undoExecution().
Erases a range of shapes from the shape list.
Erases all shapes from begin up to (but not including) end.
begin | An iterator pointing to the first shape to be erased. |
end | An iterator pointing to the shape just after the last shape to be erased. Will be invalid after the call. |
Definition at line 180 of file ShapeList.cpp.
Erases a single shape from the shape list.
pos | An iterator pointing to the shape to be erased. |
Definition at line 161 of file ShapeList.cpp.
void Isis::ShapeList::insert | ( | int | i, |
Shape *const & | value ) |
Inserts an shape into the shape list at an index.
i | The index at which to insert the shape. |
value | the shape to be inserted. |
Definition at line 195 of file ShapeList.cpp.
Inserts an shape into the shape list after an iterator.
before | An iterator pointing to the shape that value will be inserted after |
value | The shape to be inserted. |
Definition at line 212 of file ShapeList.cpp.
QString Isis::ShapeList::name | ( | ) | const |
Get the human-readable name of this shape list.
Definition at line 541 of file ShapeList.cpp.
References m_name.
Referenced by Isis::ProjectItemModel::onShapesAdded(), Isis::ProjectItem::setShapeList(), Isis::Project::shapeList(), and ShapeList().
Appends a list of shapes to the end of the shape list.
other | The list of shapes to be appended. |
Definition at line 405 of file ShapeList.cpp.
Appends a single shape to the end of the shape list.
other | The shape to be appended. |
Definition at line 426 of file ShapeList.cpp.
Appends a list of shapes to the end of the shape list.
other | The list of shapes to be appended. |
Definition at line 443 of file ShapeList.cpp.
Appends a single shape to the end of the shape list.
other | The shape to be appended. |
Definition at line 464 of file ShapeList.cpp.
Assigns another list of shapes to the shape list.
rhs | The list of shapes that shapeList will become a copy of. |
Definition at line 480 of file ShapeList.cpp.
Assignment operator.
rhs | The right hand side of the '=' operator |
Definition at line 499 of file ShapeList.cpp.
QString Isis::ShapeList::path | ( | ) | const |
Get the path to the shapes in the shape list (relative to project root).
This only applies to an shape list from the project.
Definition at line 552 of file ShapeList.cpp.
References m_path.
Referenced by Isis::ProjectItem::setShapeList(), and ShapeList().
void Isis::ShapeList::prepend | ( | Shape *const & | value | ) |
Inserts an shape at the beginning of the shape list.
value | The shape to be inserted. |
Definition at line 226 of file ShapeList.cpp.
void Isis::ShapeList::push_back | ( | Shape *const & | value | ) |
Appends an shape to the end of the shape list.
Equivalent to append().
value | The shape to be appended. |
Definition at line 240 of file ShapeList.cpp.
void Isis::ShapeList::push_front | ( | Shape *const & | value | ) |
Prepends an shape to the beginning of the shape list.
Equivalent to prepend().
value | The shape to be appended. |
Definition at line 254 of file ShapeList.cpp.
int Isis::ShapeList::removeAll | ( | Shape *const & | value | ) |
Removes all occurances of an shape.
value | The shape to be removed. |
Definition at line 269 of file ShapeList.cpp.
void Isis::ShapeList::removeAt | ( | int | i | ) |
Removes the shape at an index.
i | The index of the shape to be removed. |
Definition at line 287 of file ShapeList.cpp.
Referenced by Isis::Project::shapeClosed().
void Isis::ShapeList::removeFirst | ( | ) |
Removes the shape at the front of the shape list.
Definition at line 298 of file ShapeList.cpp.
void Isis::ShapeList::removeLast | ( | ) |
Removes the shape at the end of the shape list.
Definition at line 309 of file ShapeList.cpp.
bool Isis::ShapeList::removeOne | ( | Shape *const & | value | ) |
Removes the first occurance of an shape.
value | The shape to be removed. |
Definition at line 324 of file ShapeList.cpp.
void Isis::ShapeList::save | ( | QXmlStreamWriter & | stream, |
const Project * | project, | ||
FileName | newProjectRoot ) const |
Convert this shape list into XML format for saving/restoring capabilities.
This writes:
<shapeList name="..." path="...">
to the given xml stream, and creates an 'shapes.xml' inside the folder with the shapes. Inside the shapes.xml, this writes:
<shapes> ... </shapes>
stream | XmlStream to write out the document. |
project | The project the shape list will be saved to. |
newProjectRoot | The path to the root directory for the new project. |
iException::Io | "Failed to create directory" |
iException::Io | "Unable to save shape information because new file could not be opened for writing" |
Definition at line 601 of file ShapeList.cpp.
References Isis::FileName::dir(), Isis::IException::Io, m_name, m_path, Isis::FileName::original(), Isis::FileName::path(), Isis::Shape::save(), Isis::Project::shapeDataRoot(), and Isis::FileName::toString().
SerialNumberList Isis::ShapeList::serialNumberList | ( | ) |
Creates a SerialNumberList from the shape list.
Definition at line 101 of file ShapeList.cpp.
References Isis::SerialNumberList::add().
void Isis::ShapeList::setName | ( | QString | newName | ) |
Set the human-readable name of this shape list.
This is really only useful for project shape lists (not anonymous temporary ones).
newName | The name to give this shape list |
Definition at line 520 of file ShapeList.cpp.
References m_name.
Referenced by Isis::ProjectItemModel::setData().
void Isis::ShapeList::setPath | ( | QString | newPath | ) |
Set the relative path (from the project root) to this shape list's folder.
This is really only useful for project shape lists (not anonymous temporary ones).
newPath | The path to the shapes in this shape list |
Definition at line 531 of file ShapeList.cpp.
References m_path.
Swaps the shape list with another list of shapes.
other | The list of shapes to swapped with. |
Definition at line 342 of file ShapeList.cpp.
Shape * Isis::ShapeList::takeAt | ( | int | i | ) |
Removes the shape at an index and returns it.
i | The index of the shape to be removed and returned. |
Definition at line 360 of file ShapeList.cpp.
Shape * Isis::ShapeList::takeFirst | ( | ) |
Removes and returns the first shape.
Definition at line 374 of file ShapeList.cpp.
Shape * Isis::ShapeList::takeLast | ( | ) |
Removes and returns the last shape.
Definition at line 388 of file ShapeList.cpp.
|
private |
This stores the shape list's name.
Definition at line 131 of file ShapeList.h.
Referenced by name(), operator=(), save(), setName(), ShapeList(), and ShapeList().
|
private |
This stores the directory name that contains the shapes in this shape list.
For example: import1 or import2
This path is relative to Project::shapeDataRoot()
Definition at line 143 of file ShapeList.h.
Referenced by deleteFromDisk(), operator=(), path(), save(), setPath(), ShapeList(), and ShapeList().