USGS

Isis 3.0 Object Programmers' Reference

Home

Isis::Project Class Reference

The main project for cnetsuite. More...

#include <Project.h>

Inheritance diagram for Isis::Project:
Inheritance graph
Collaboration diagram for Isis::Project:
Collaboration graph

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)
Controlcontrol (QString id)
Directorydirectory () const
 Returns the directory associated with this Project.
Imageimage (QString id)
ImageListimageList (QString name)
bool isTemporaryProject () const
WorkOrderlastNotUndoneWorkOrder ()
const WorkOrderlastNotUndoneWorkOrder () 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 ()
ControlListcontrolList (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.
QProgressBarprogress ()
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)
Projectoperator= (const Project &rhs)
void createFolders ()
 This creates the project root, image root, and control net root directories.
ControlListcreateOrRetrieveControlList (QString name)
ImageListcreateOrRetrieveImageList (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< Directorym_directory
QList< ImageList * > * m_images
QList< ControlList * > * m_controls
QMap< QString, Control * > * m_idToControlMap
QMap< QString, Image * > * m_idToImageMap
QString m_name
QStringListm_warnings
QList< QPointer< WorkOrder > > * m_workOrderHistory
QPointer< ImageReaderm_imageReader
bool m_isTemporaryProject
int m_numImagesCurrentlyReading
QMutex * m_mutex
QMutex * m_imageReadingMutex
QUndoStack m_undoStack

Detailed Description

The main project for cnetsuite.

Author
2012-??-?? ???
History:
2012-07-27 Kimberly Oyama - Added comments to some of the methods.
History:
2012-09-04 Tracie Sucharski - Renamed addCNets to addCnets, controlNetRoot to cnetRoot, networkLoaded to cnetLoaded. Added new method, addCnetFolder.
History:
2012-09-11 Tracie Sucharski - Added mutex accessor method.
History:
2012-09-12 Tracie Sucharski - Implemented ControlList instead of QList<Control *>, re-ordered some methods to match header order.
History:
2012-09-12 Steven Lambright - Renamed imageList() to createOrRetrieveImageList(), added imageList() and image().
History:
2012-09-17 Steven Lambright - Reduced the time complexity of image() to log(n) from n/2. This method is often called n times.
History:
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).
History:
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.
History:
2013-05-14 Jeannie Backer - Used return status of c++ system() in the constructor to verify that the call was successful.

Definition at line 78 of file Project.h.

Constructor & Destructor Documentation

Isis::Project::Project ( Directory directory,
QObject parent = 0 
)

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().

Member Function Documentation

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]

Parameters
workOrderThe 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().

QString Isis::Project::cnetRoot ( QString  projectRoot)
static

Appends the root directory name 'cnets' to the project.

Returns
The path to the root directory of the cnet data.

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.

Returns
The path to the root directory of the cnet data.

Definition at line 808 of file Project.cpp.

Referenced by addCnetFolder(), createFolders(), deleteAllProjectFiles(), and Isis::ControlList::save().

void Isis::Project::controlClosed ( QObject control)
privateslot

A control is being deleted from the project.

Definition at line 1121 of file Project.cpp.

References Isis::ControlList::removeAt().

Referenced by addControl().

void Isis::Project::controlListDeleted ( QObject controlList)
privateslot

An control list is being deleted from the project.

Definition at line 1140 of file Project.cpp.

void Isis::Project::createFolders ( )
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

Returns the directory associated with this Project.

The directory is not part of the project so a non-const pointer is returned and this is okay.

Returns
The Directory that was used to create this Project.

Definition at line 542 of file Project.cpp.

Referenced by Project().

void Isis::Project::imageClosed ( QObject image)
privateslot

An image is being deleted from the project.

Definition at line 1102 of file Project.cpp.

References Isis::ImageList::removeAt().

QString Isis::Project::imageDataRoot ( QString  projectRoot)
static

Appends the root directory name 'images' to the project .

Returns
The path to the root directory of the image data.

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.

Returns
The path to 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().

void Isis::Project::imageListDeleted ( QObject imageList)
privateslot

An image list is being deleted from the project.

Definition at line 1151 of file Project.cpp.

QStringList Isis::Project::images ( QStringList  fileNames)
static

Verify that the input fileNames are image files.

Parameters
fileNamesnames of files on disk
Returns
the files that are images.

Definition at line 385 of file Project.cpp.

QMutex * Isis::Project::mutex ( )

Return mutex used for Naif calls.

This method is thread-safe.

Author
2012-09-11 Tracie Sucharski
Returns
QMutex*

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.

void Isis::Project::open ( QString  projectPathStr)
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.

Parameters
newProjectRootThe new root directory for the project.

Definition at line 887 of file Project.cpp.

void Isis::Project::save ( QXmlStreamWriter &  stream,
FileName  newProjectRoot 
) const
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.

void Isis::Project::saveHistory ( QXmlStreamWriter &  stream) const
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().

void Isis::Project::saveWarnings ( QXmlStreamWriter &  stream) const
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.

QList< QAction * > Isis::Project::userPreferenceActions ( )

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.

QList< WorkOrder * > Isis::Project::workOrderHistory ( )

Get the entire list of work orders that have executed.

Definition at line 783 of file Project.cpp.

Referenced by Isis::HistoryTreeWidget::showHistory().


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