Isis 3.0 Object Programmers' Reference |
Home |
Add cubes to a project. More...
#include <ImportImagesWorkOrder.h>
Classes | |
class | OriginalFileToProjectCubeFunctor |
This copies the given cube(s) into the project. More... | |
Public Types | |
enum | WorkOrderStatus { WorkOrderUnknownStatus = 0, WorkOrderNotStarted, WorkOrderRedoing, WorkOrderRedone, WorkOrderUndoing, WorkOrderUndone, WorkOrderFinished, WorkOrderLastStatus = WorkOrderFinished } |
enum | Context { NoContext, ProjectContext } |
Public Slots | |
virtual void | redo () |
Starts (or enqueues) a redo. | |
virtual void | undo () |
Starts (or enqueues) an undo. | |
Signals | |
void | creatingProgress (WorkOrder *) |
void | deletingProgress (WorkOrder *) |
void | finished (WorkOrder *) |
void | statusChanged (WorkOrder *) |
Public Member Functions | |
ImportImagesWorkOrder (Project *project) | |
ImportImagesWorkOrder (const ImportImagesWorkOrder &other) | |
virtual ImportImagesWorkOrder * | clone () const |
bool | execute () |
The (child) implementation of this method should prompt the user/gather state by any means necessary. | |
void | asyncRedo () |
This method is designed to be implemented by children work orders. | |
void | postSyncRedo () |
This method is designed to be implemented by children work orders. | |
void | asyncUndo () |
This method is designed to be implemented by children work orders. | |
void | postSyncUndo () |
This method is designed to be implemented by children work orders. | |
virtual bool | isExecutable (Context) |
Re-implement this method if your work order utilizes controls for data in order to operate. | |
virtual bool | isExecutable (QList< Control * > controls) |
Re-implement this method if your work order utilizes controls for data in order to operate. | |
virtual bool | isExecutable (ImageList *images) |
Re-implement this method if your work order utilizes images for data in order to operate. | |
void | read (XmlStackedHandlerReader *xmlReader) |
Read this work order's data from disk. | |
void | save (QXmlStreamWriter &stream) const |
Output XML format: | |
virtual void | setData (Context) |
virtual void | setData (ImageList *images) |
virtual void | setData (QList< Control * > controls) |
void | setNext (WorkOrder *nextWorkOrder) |
void | setPrevious (WorkOrder *previousWorkOrder) |
QString | bestText () const |
bool | createsCleanState () const |
QDateTime | executionTime () const |
bool | isFinished () const |
bool | isRedoing () const |
bool | isRedone () const |
bool | isUndoing () const |
bool | isUndone () const |
bool | modifiesDiskState () const |
WorkOrder * | next () const |
WorkOrder * | previous () const |
QString | statusText () const |
ProgressBar * | progressBar () |
Static Public Member Functions | |
static WorkOrderStatus | fromStatusString (QString) |
static QString | toString (WorkOrderStatus) |
Protected Slots | |
void | addCloneToProject () |
Protected Member Functions | |
ImageList * | imageList () |
const ImageList * | imageList () const |
QList< Control * > | controlList () |
virtual bool | dependsOn (WorkOrder *other) const |
Directory * | directory () const |
Project * | project () const |
void | setCreatesCleanState (bool createsCleanState) |
Declare that this work order is saving the project. | |
void | setModifiesDiskState (bool changesProjectOnDisk) |
void | setInternalData (QStringList data) |
int | progressMin () const |
int | progressMax () const |
int | progressValue () const |
void | setProgressRange (int, int) |
void | setProgressValue (int) |
QStringList | internalData () const |
virtual void | syncRedo () |
This method is designed to be implemented by children work orders. | |
virtual void | syncUndo () |
This method is designed to be implemented by children work orders. | |
Private Member Functions | |
ImportImagesWorkOrder & | operator= (const ImportImagesWorkOrder &rhs) |
void | importConfirmedImages (QStringList confirmedImages, bool copyDnData) |
Creates a project image folder and copies the cubes into it. | |
Private Attributes | |
ImageList * | m_newImages |
QString | m_warning |
Add cubes to a project.
Asks the user for a list of cube file names and whether they should be copied into the project. The cubes are then converted to external cube label files inside the project (and cube files if the user said to copy the DN data). These files are then handed off to the project.
2012-08-24 Steven Lambright and Stuart Sides - Removed GUI-thread slowdown of image verification
2012-08-29 Steven Lambright - This work order should now work correctly even when just 1 QtConcurrent thread is enabled.
2012-10-02 Steven Lambright - Image ID's are now guaranteed to be the same after undo/redo. This is a beginning step for making work orders whose images are freed from memory undo/redo correctly.
2012-10-29 Steven Lambright - Added a prompt to save the project if importing a lot of images to a temporary project.
Definition at line 61 of file ImportImagesWorkOrder.h.
|
inherited |
Enumerator | |
---|---|
WorkOrderFinished |
This is used for work orders that will not undo or redo (See createsCleanState()) |
Definition at line 91 of file WorkOrder.h.
|
virtual |
This method is designed to be implemented by children work orders.
The order of execution for redo is: syncRedo() - GUI thread asyncRedo() - Pooled thread* postSyncRedo() - GUI thread
State can be read from the parent WorkOrder class and from state set in syncRedo() while in this method. You can set state to be used in postSyncRedo() safely. Please be wary of creating QObjects inside of this method because they will associated with the pooled thread and must be moved back to the GUI thread with QObject::moveToThread(). This method is never executed in the GUI thread. You can update progress by calling setProgressRange() and setProgressValue(). Please do not manipulate any GUI objects here.
Reimplemented from Isis::WorkOrder.
Definition at line 153 of file ImportImagesWorkOrder.cpp.
|
virtual |
This method is designed to be implemented by children work orders.
The order of execution for undo is: syncUndo() - GUI thread asyncUndo() - Pooled thread* postSyncUndo() - GUI thread
State can be read from the parent WorkOrder class and from state set in syncUndo() while in this method. You can set state to be used in postSyncUndo() safely. Please be wary of deleting QObjects inside of this method because they will cause unpredictable crashes. This method is never executed in the GUI thread. You can update progress by calling setProgressRange() and setProgressValue(). Please do not manipulate any GUI objects here.
Reimplemented from Isis::WorkOrder.
Definition at line 137 of file ImportImagesWorkOrder.cpp.
|
virtual |
The (child) implementation of this method should prompt the user/gather state by any means necessary.
This method is designed to be implemented by children work orders, but they need to call this version inside of their execute (at the beginning).
Prompts for file names, questions, warnings, etc.. should be done here.
Once the work order has enough data to execute, this method needs to set the state in the parent (this) WorkOrder class. Call setData(ImageList), setInternalData(QStringList), etc... with all of the data/state necessary to perform the work order. This could be a list of file names, an ImageList of images you're viewing, or really anything else.
Finally, the actual work needs done in *Redo(), using only state (data) stored by the parent (this) WorkOrder class. You do not have to call *Redo() - this is done for you by WorkOrder::redo(). WorkOrder::redo() is called from Project::addToProject() when the workOrder is pushed onto the undo stack.
We do it this way to ensure saving/restoring from history can be done automatically/simply and implemented only once per data type. This also gives us full undo/redo functionality.
The order of execution for work orders is: execute() - GUI thread, can ask user for input* syncRedo() - GUI thread, should not prompt the user for input asyncRedo() - Pooled thread postSyncRedo() - GUI thread
syncUndo() - GUI thread, always called after redo finishes asyncUndo() - Pooled thread postSyncUndo() - GUI thread
syncRedo() - GUI thread asyncRedo() - Pooled thread postSyncRedo() - GUI thread
and so on...
State should only be set in the parent WorkOrder class in this method. You can set arbitrary state using setInternalData(). This method is always executed in the GUI thread and is the only place to ask the user questions.
Reimplemented from Isis::WorkOrder.
Definition at line 66 of file ImportImagesWorkOrder.cpp.
References Isis::WorkOrder::execute().
|
private |
Creates a project image folder and copies the cubes into it.
This will create the *.ecub and *.cub files inside of the project. This can be thought of as:
mkdir project/images/import1 cp in1.cub in2.cub project/images/import1
This should be called in a non-GUI thread
confirmedImages | This is a list of cube file names outside of the project folder |
copyDnData | If this is true, this will create both the *.cub and *.ecub files in the project. Otherwise, only the external label files (*.ecub) will be created inside of the project. |
Definition at line 274 of file ImportImagesWorkOrder.cpp.
References Isis::Image::closeCube(), Isis::Image::displayProperties(), Isis::Image::id(), Isis::Image::setId(), and Isis::IException::toString().
|
virtualinherited |
Re-implement this method if your work order utilizes controls for data in order to operate.
For example, "CnetEditorViewWorkOrder" works sometimes on controls - the logic in side of CnetEditorViewWorkOrder::isExecutable() determines whethere or not a user is prompted with this work order as a possibility.
Reimplemented in Isis::RenameProjectWorkOrder.
Definition at line 153 of file WorkOrder.cpp.
Re-implement this method if your work order utilizes controls for data in order to operate.
For example, "CnetEditorViewWorkOrder" works sometimes on controls - the logic in side of CnetEditorViewWorkOrder::isExecutable() determines whethere or not a user is prompted with this work order as a possibility.
Reimplemented in Isis::CnetEditorViewWorkOrder, and Isis::ExportControlNetWorkOrder.
Definition at line 165 of file WorkOrder.cpp.
|
virtualinherited |
Re-implement this method if your work order utilizes images for data in order to operate.
For example, "Footprint2DViewWorkOrder" works sometimes on images - the logic in side of Footprint2DViewWorkOrder::isExecutable(ImageList) determines whethere or not a user is prompted with this work order as a possibility.
images | An image list that this work order should execute on |
Reimplemented in Isis::ImageListActionWorkOrder, Isis::ImageFileListViewWorkOrder, Isis::CubeViewportViewWorkOrder, Isis::Footprint2DViewWorkOrder, and Isis::ExportImagesWorkOrder.
Definition at line 178 of file WorkOrder.cpp.
|
virtual |
This method is designed to be implemented by children work orders.
The order of execution for redo is: syncRedo() - GUI thread asyncRedo() - Pooled thread postSyncRedo() - GUI thread*
State can be read from the parent WorkOrder class and from state set in either syncRedo() or asyncRedo() while in this method. You can not set state to be used in any of the undo code safely. This method is always executed in the GUI thread and has no progress.
Reimplemented from Isis::WorkOrder.
Definition at line 160 of file ImportImagesWorkOrder.cpp.
|
virtual |
This method is designed to be implemented by children work orders.
The order of execution for undo is: syncUndo() - GUI thread asyncUndo() - Pooled thread postSyncUndo() - GUI thread*
State can be read from the parent WorkOrder class and from state set in either syncUndo() or asyncUndo() while in this method. You can not set state to be used in any of the redo code safely. This method is always executed in the GUI thread and has no progress.
Reimplemented from Isis::WorkOrder.
Definition at line 143 of file ImportImagesWorkOrder.cpp.
|
inherited |
Read this work order's data from disk.
Definition at line 186 of file WorkOrder.cpp.
|
virtualslotinherited |
Starts (or enqueues) a redo.
This should not be re-implemented by children.
Definition at line 475 of file WorkOrder.cpp.
References Isis::WorkOrder::asyncRedo(), and Isis::WorkOrder::syncRedo().
|
inherited |
Output XML format:
<workOrder actiontext="..." undotext="..." type="..." status="..."> <images> <image id="..."> </images>
<internalDataValues> <dataValue value="..."> </internalDataValues> </workOrder>
Definition at line 206 of file WorkOrder.cpp.
References _FILEINFO_, Isis::WorkOrder::m_executionTime, and Isis::IException::Unknown.
Referenced by Isis::Project::saveHistory().
|
protectedinherited |
Declare that this work order is saving the project.
This makes the work order not appear in the undo stack (cannot undo/redo), and instead is marked as a 'clean' state of the project. The QUndoCommand undo/redo will never be called. The default for createsCleanState is false.
createsCleanState | True if this work order is going to save the project to disk |
Definition at line 971 of file WorkOrder.cpp.
References Isis::WorkOrder::m_createsCleanState.
|
protectedvirtualinherited |
This method is designed to be implemented by children work orders.
The order of execution for redo is: syncRedo() - GUI thread* asyncRedo() - Pooled thread postSyncRedo() - GUI thread
State should only be read from the parent WorkOrder class in this method. You can set state to be used in asyncRedo() and postSyncRedo() safely. This method is always executed in the GUI thread and has no progress.
Reimplemented in Isis::ImageListActionWorkOrder, Isis::ImportControlNetWorkOrder, Isis::RenameProjectWorkOrder, Isis::ImageFileListViewWorkOrder, Isis::CubeViewportViewWorkOrder, Isis::Footprint2DViewWorkOrder, Isis::CnetEditorViewWorkOrder, Isis::MoveDownOneSceneWorkOrder, Isis::MoveToBottomSceneWorkOrder, Isis::MoveToTopSceneWorkOrder, and Isis::MoveUpOneSceneWorkOrder.
Definition at line 727 of file WorkOrder.cpp.
Referenced by Isis::WorkOrder::redo().
|
protectedvirtualinherited |
This method is designed to be implemented by children work orders.
The order of execution for undo is: syncUndo() - GUI thread* asyncUndo() - Pooled thread postSyncUndo() - GUI thread
State should only be read from the parent WorkOrder class in this method. You can set state to be used in asyncUndo() and postSyncUndo() safely. This method is always executed in the GUI thread and has no progress.
Reimplemented in Isis::ImageListActionWorkOrder, Isis::ImportControlNetWorkOrder, Isis::RenameProjectWorkOrder, Isis::ImageFileListViewWorkOrder, Isis::CubeViewportViewWorkOrder, Isis::Footprint2DViewWorkOrder, Isis::CnetEditorViewWorkOrder, Isis::MoveDownOneSceneWorkOrder, Isis::MoveToBottomSceneWorkOrder, Isis::MoveToTopSceneWorkOrder, and Isis::MoveUpOneSceneWorkOrder.
Definition at line 775 of file WorkOrder.cpp.
Referenced by Isis::WorkOrder::undo().
|
virtualslotinherited |
Starts (or enqueues) an undo.
This should not be re-implemented by children.
Definition at line 559 of file WorkOrder.cpp.
References Isis::WorkOrder::asyncUndo(), and Isis::WorkOrder::syncUndo().