Isis 3.0 Object Programmers' Reference |
Home |
The main project for cnetsuite. More...
#include <Project.h>
Classes | |
class | XmlHandler |
Public Slots | |
void | open (QString) |
Open the project at the given path. | |
Signals | |
void | allImagesClosed () |
void | controlListAdded (ControlList *controls) |
void | controlAdded (Control *control) |
void | imagesAdded (ImageList *images) |
void | nameChanged (QString newName) |
void | projectLoaded (Project *) |
void | projectRelocated (Project *) |
void | workOrderStarting (WorkOrder *) |
void | workOrderFinished (WorkOrder *) |
Public Member Functions | |
Project (Directory &directory, QObject *parent=0) | |
Create a new Project. | |
~Project () | |
Clean up the project. | |
QList< QAction * > | userPreferenceActions () |
Get a list of configuration/settings actions related to reading images into this Project. | |
QDir | addCnetFolder (QString prefix) |
Create and return the name of a folder for placing control networks. | |
void | addControl (Control *control) |
Add the given Control's to the current project. | |
QDir | addImageFolder (QString prefix) |
Create and return the name of a folder for placing images. | |
void | addImages (QStringList imageFiles) |
Read the given cube file names as Images and add them to the project. | |
void | addImages (ImageList newImages) |
Control * | control (QString id) |
Directory * | directory () const |
Returns the directory associated with this Project. | |
Image * | image (QString id) |
ImageList * | imageList (QString name) |
bool | isTemporaryProject () const |
WorkOrder * | lastNotUndoneWorkOrder () |
const WorkOrder * | lastNotUndoneWorkOrder () const |
QString | name () const |
Get the project's GUI name. | |
QMutex * | mutex () |
Return mutex used for Naif calls. | |
QString | projectRoot () const |
Get the top-level folder of the project. | |
void | setName (QString newName) |
Change the project's name (GUI only, doesn't affect location on disk). | |
QUndoStack * | undoStack () |
void | waitForImageReaderFinished () |
QList< WorkOrder * > | workOrderHistory () |
Get the entire list of work orders that have executed. | |
QString | cnetRoot () const |
Get where control networks ought to be stored inside the project. | |
QList< ControlList * > | controls () |
ControlList * | controlList (QString name) |
QString | imageDataRoot () const |
Accessor for the root directory of the image data. | |
QList< ImageList * > | images () |
void | deleteAllProjectFiles () |
Delete all of the files, that this project stores, from disk. | |
void | relocateProjectRoot (QString newRoot) |
This is called when the project is moved. | |
QProgressBar * | progress () |
void | save () |
void | save (FileName newPath, bool verifyPathDoesntExist=true) |
void | addToProject (WorkOrder *) |
Run the work order and stores it in the project. | |
template<typename Data > | |
void | warn (QString text, Data relevantData) |
void | warn (QString text) |
Static Public Member Functions | |
static QStringList | images (QStringList) |
Verify that the input fileNames are image files. | |
static QString | cnetRoot (QString projectRoot) |
Appends the root directory name 'cnets' to the project. | |
static QString | imageDataRoot (QString projectRoot) |
Appends the root directory name 'images' to the project . | |
Private Slots | |
void | controlClosed (QObject *control) |
A control is being deleted from the project. | |
void | controlListDeleted (QObject *controlList) |
An control list is being deleted from the project. | |
void | imagesReady (ImageList) |
void | imageClosed (QObject *image) |
An image is being deleted from the project. | |
void | imageListDeleted (QObject *imageList) |
An image list is being deleted from the project. | |
Private Member Functions | |
Project (const Project &other) | |
Project & | operator= (const Project &rhs) |
void | createFolders () |
This creates the project root, image root, and control net root directories. | |
ControlList * | createOrRetrieveControlList (QString name) |
ImageList * | createOrRetrieveImageList (QString name) |
QString | nextImageListGroupName () |
void | save (QXmlStreamWriter &stream, FileName newProjectRoot) const |
Converts the project settings into XML. | |
void | saveHistory (QXmlStreamWriter &stream) const |
Serialize the work orders into the given XML. | |
void | saveWarnings (QXmlStreamWriter &stream) const |
Serialize the warnings into the given XML. | |
void | storeWarning (QString text) |
void | storeWarning (QString text, const ImageList &relevantData) |
Private Attributes | |
QDir * | m_projectRoot |
QDir * | m_cnetRoot |
QDir | m_currentCnetFolder |
QPointer< Directory > | m_directory |
QList< ImageList * > * | m_images |
QList< ControlList * > * | m_controls |
QMap< QString, Control * > * | m_idToControlMap |
QMap< QString, Image * > * | m_idToImageMap |
QString | m_name |
QStringList * | m_warnings |
QList< QPointer< WorkOrder > > * | m_workOrderHistory |
QPointer< ImageReader > | m_imageReader |
bool | m_isTemporaryProject |
int | m_numImagesCurrentlyReading |
QMutex * | m_mutex |
QMutex * | m_imageReadingMutex |
QUndoStack | m_undoStack |
The main project for cnetsuite.
2012-07-27 Kimberly Oyama - Added comments to some of the methods.
2012-09-04 Tracie Sucharski - Renamed addCNets to addCnets, controlNetRoot to cnetRoot, networkLoaded to cnetLoaded. Added new method, addCnetFolder.
2012-09-11 Tracie Sucharski - Added mutex accessor method.
2012-09-12 Tracie Sucharski - Implemented ControlList instead of QList<Control *>, re-ordered some methods to match header order.
2012-09-12 Steven Lambright - Renamed imageList() to createOrRetrieveImageList(), added imageList() and image().
2012-09-17 Steven Lambright - Reduced the time complexity of image() to log(n) from n/2. This method is often called n times.
2012-09-17 Steven Lambright - Added crash detection/cleanup. Prompt is coded but disabled (we'll find a good wording or handle recovery better when we don't expect so many crashes during development).
2012-10-29 Steven Lambright and Stuart Sides - Added isTemporaryProject(). This is useful for the import images to know if it should prompt the user to save their project.
2013-05-14 Jeannie Backer - Used return status of c++ system() in the constructor to verify that the call was successful.
Create a new Project.
This creates a project on disk at /tmp/username_appname_pid.
Definition at line 62 of file Project.cpp.
References _FILEINFO_, createFolders(), directory(), Isis::IException::Programmer, Isis::toString(), and Isis::Environment::userName().
Isis::Project::~Project | ( | ) |
Clean up the project.
This will bring the Project back to a safe on-disk state.
Definition at line 159 of file Project.cpp.
References deleteAllProjectFiles().
QDir Isis::Project::addCnetFolder | ( | QString | prefix | ) |
Create and return the name of a folder for placing control networks.
This can be called from multiple threads, but should only be called by one thread at a time.
Definition at line 417 of file Project.cpp.
References _FILEINFO_, cnetRoot(), and Isis::IException::Io.
void Isis::Project::addControl | ( | Control * | control | ) |
Add the given Control's to the current project.
This will cause the controls to be saved/restored from disk, Project-related GUIs to display the control, and enable access to the controls given access to the project.
Definition at line 449 of file Project.cpp.
References controlClosed().
QDir Isis::Project::addImageFolder | ( | QString | prefix | ) |
Create and return the name of a folder for placing images.
This can be called from multiple threads, but should only be called by one thread at a time.
Definition at line 487 of file Project.cpp.
References _FILEINFO_, imageDataRoot(), and Isis::IException::Io.
void Isis::Project::addImages | ( | QStringList | imageFiles | ) |
Read the given cube file names as Images and add them to the project.
Definition at line 515 of file Project.cpp.
void Isis::Project::addToProject | ( | WorkOrder * | workOrder | ) |
Run the work order and stores it in the project.
If WorkOrder::execute() returns true then the work order's redo is called. This takes ownership of workOrder.
The order of events is: 1) WorkOrder::execute() 2) emit workOrderStarting() 3) WorkOrder::redo() [optional - see WorkOrder]
workOrder | The work order to be executed. This work order must not already be in the project. |
Definition at line 1013 of file Project.cpp.
References Isis::WorkOrder::execute().
|
static |
Appends the root directory name 'cnets' to the project.
Definition at line 798 of file Project.cpp.
Referenced by Isis::ControlList::deleteFromDisk(), and Isis::Control::updateFileName().
QString Isis::Project::cnetRoot | ( | ) | const |
Get where control networks ought to be stored inside the project.
This is a full path.
Definition at line 808 of file Project.cpp.
Referenced by addCnetFolder(), createFolders(), deleteAllProjectFiles(), and Isis::ControlList::save().
|
privateslot |
A control is being deleted from the project.
Definition at line 1121 of file Project.cpp.
References Isis::ControlList::removeAt().
Referenced by addControl().
|
privateslot |
An control list is being deleted from the project.
Definition at line 1140 of file Project.cpp.
|
private |
This creates the project root, image root, and control net root directories.
Definition at line 234 of file Project.cpp.
References _FILEINFO_, cnetRoot(), imageDataRoot(), and Isis::IException::Io.
Referenced by Project().
void Isis::Project::deleteAllProjectFiles | ( | ) |
Delete all of the files, that this project stores, from disk.
Definition at line 862 of file Project.cpp.
References cnetRoot(), Isis::ImageList::deleteFromDisk(), and imageDataRoot().
Referenced by ~Project().
Directory * Isis::Project::directory | ( | ) | const |
|
privateslot |
An image is being deleted from the project.
Definition at line 1102 of file Project.cpp.
References Isis::ImageList::removeAt().
|
static |
Appends the root directory name 'images' to the project .
Definition at line 839 of file Project.cpp.
Referenced by Isis::ImageList::deleteFromDisk(), and Isis::Image::updateFileName().
QString Isis::Project::imageDataRoot | ( | ) | const |
Accessor for the root directory of the image data.
Definition at line 849 of file Project.cpp.
Referenced by addImageFolder(), Isis::Image::copyToNewProjectRoot(), createFolders(), deleteAllProjectFiles(), and Isis::ImageList::save().
|
privateslot |
An image list is being deleted from the project.
Definition at line 1151 of file Project.cpp.
|
static |
Verify that the input fileNames are image files.
fileNames | names of files on disk |
Definition at line 385 of file Project.cpp.
QMutex * Isis::Project::mutex | ( | ) |
Return mutex used for Naif calls.
This method is thread-safe.
Definition at line 711 of file Project.cpp.
QString Isis::Project::name | ( | ) | const |
Get the project's GUI name.
Definition at line 682 of file Project.cpp.
|
slot |
Open the project at the given path.
Definition at line 550 of file Project.cpp.
References _FILEINFO_, and Isis::IException::Io.
QString Isis::Project::projectRoot | ( | ) | const |
Get the top-level folder of the project.
This is where the project is opened from/saved to.
Definition at line 719 of file Project.cpp.
Referenced by Isis::Image::copyToNewProjectRoot().
void Isis::Project::relocateProjectRoot | ( | QString | newProjectRoot | ) |
This is called when the project is moved.
newProjectRoot | The new root directory for the project. |
Definition at line 887 of file Project.cpp.
|
private |
Converts the project settings into XML.
The format of the project settings is:
<project> <controlNets> <controlNet name="..."> </controlNets> </project>
Definition at line 298 of file Project.cpp.
|
private |
Serialize the work orders into the given XML.
The format of the history xml is:
<history> <workOrder> ... </workOrder> <workOrder> ... </workOrder> </history>
Definition at line 342 of file Project.cpp.
References Isis::WorkOrder::save().
|
private |
Serialize the warnings into the given XML.
The format of the warnings xml is:
<warnings> <warning text="..."> <warning text="..."> </warnings>
Definition at line 365 of file Project.cpp.
void Isis::Project::setName | ( | QString | newName | ) |
Change the project's name (GUI only, doesn't affect location on disk).
Definition at line 727 of file Project.cpp.
Get a list of configuration/settings actions related to reading images into this Project.
These are things like default opacity, default filled, etc.
Definition at line 407 of file Project.cpp.
References Isis::ImageDisplayProperties::FootprintViewProperties.
Get the entire list of work orders that have executed.
Definition at line 783 of file Project.cpp.
Referenced by Isis::HistoryTreeWidget::showHistory().