USGS

Isis 3.0 Object Programmers' Reference

Home

Isis::ImageListActionWorkOrder Class Reference

Work orders that can be performed on an image list that modifies internal state. More...

#include <ImageListActionWorkOrder.h>

Inheritance diagram for Isis::ImageListActionWorkOrder:
Inheritance graph
Collaboration diagram for Isis::ImageListActionWorkOrder:
Collaboration graph

Public Types

enum  Action {
  UnknownAction = 0, ChangeTransparency, ChangeColor, RandomizeColor,
  ToggleShowLabel, ToggleShowFilled, ToggleShowCubeData, ToggleShowOutline
}
 
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 bringToFront ()
 
void creatingProgress (WorkOrder *)
 
void deletingProgress (WorkOrder *)
 
void finished (WorkOrder *)
 
void statusChanged (WorkOrder *)
 

Public Member Functions

 ImageListActionWorkOrder (Project *project)
 
 ImageListActionWorkOrder (Action action, Project *project)
 
 ImageListActionWorkOrder (const ImageListActionWorkOrder &other)
 
ImageListActionWorkOrderclone () const
 Clone the current work order.
 
bool isExecutable (ImageList *images)
 This work order can be run on any non-empty image list.
 
void setData (ImageList *images)
 When this work order is assigned an image list, update the undo command text.
 
bool execute ()
 Prompt the user for input, if necessary, and remember the answers.
 
void syncRedo ()
 Perform the action.
 
void syncUndo ()
 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.
 
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 (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
 
WorkOrdernext () const
 
WorkOrderprevious () const
 
QString statusText () const
 
ProgressBarprogressBar ()
 

Static Public Member Functions

static QString qualifyString (QString unqualifiedString, ImageList *)
 
static QString toString (Action)
 
static Action fromActionString (QString)
 
static WorkOrderStatus fromStatusString (QString)
 
static QString toString (WorkOrderStatus)
 

Protected Slots

void addCloneToProject ()
 

Protected Member Functions

ImageListimageList ()
 
const ImageListimageList () const
 
QList< Control * > controlList ()
 
virtual bool dependsOn (WorkOrder *other) const
 
Directorydirectory () const
 
Projectproject () 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 asyncRedo ()
 This method is designed to be implemented by children work orders.
 
virtual void postSyncRedo ()
 This method is designed to be implemented by children work orders.
 
virtual void asyncUndo ()
 This method is designed to be implemented by children work orders.
 
virtual void postSyncUndo ()
 This method is designed to be implemented by children work orders.
 

Private Member Functions

ImageListActionWorkOrderoperator= (const ImageListActionWorkOrder &rhs)
 

Detailed Description

Work orders that can be performed on an image list that modifies internal state.

This encapsulates the set of image list work orders that modifies internal state to the image list. This means these work orders typically modify the ImageDisplayProperties on the images.

These work orders rely on the internal data to know the action to perform and what the expected state is. The internal data is stored like this:

internalData = (ActionString, UserInputValue (optional), OriginalValue1 (optional) SPACE NewValue1 (optional), OriginalValue2 (optional) SPACE NewValue2 (optional), OriginalValue3 (optional) SPACE NewValue3 (optional), OriginalValue4 (optional) SPACE NewValue4 (optional), ... )

For example, if we're changing the colors of the images, the internal data would be: internalData = (Change Color, NewColor, File1OriginalColor, File2OriginalColor, File3OriginalColor, ... )

The original colors will let us undo this action. A second example (randomize colors): internalData = (Random Color, File1OriginalColor File1NewColor, File2OriginalColor File2NewColor, File3OriginalColor File3NewColor, ... )

See Also
ImageList::supportedActions()
Author
2012-08-28 Steven Lambright
History:

2012-09-12 Stuart Sides and Steven Lambright - Added temporary work-around to Z order actions until we get around to implementing them properly. They cannot undo, but they redo just fine right now.

2012-09-17 Steven Lambright - Added warning to show labels

2012-10-02 Stuart Sides and Steven Lambright - Removed ZoomFit Action

Definition at line 56 of file ImageListActionWorkOrder.h.

Member Enumeration Documentation

Enumerator
WorkOrderFinished 

This is used for work orders that will not undo or redo (See createsCleanState())

Definition at line 91 of file WorkOrder.h.

Member Function Documentation

void Isis::WorkOrder::asyncRedo ( )
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 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 in Isis::ImportImagesWorkOrder, Isis::ImportControlNetWorkOrder, Isis::ExportImagesWorkOrder, and Isis::ExportControlNetWorkOrder.

Definition at line 745 of file WorkOrder.cpp.

Referenced by Isis::WorkOrder::redo().

void Isis::WorkOrder::asyncUndo ( )
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 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 in Isis::ImportImagesWorkOrder.

Definition at line 792 of file WorkOrder.cpp.

Referenced by Isis::WorkOrder::undo().

ImageListActionWorkOrder * Isis::ImageListActionWorkOrder::clone ( ) const
virtual

Clone the current work order.

Implements Isis::WorkOrder.

Definition at line 41 of file ImageListActionWorkOrder.cpp.

bool Isis::ImageListActionWorkOrder::execute ( )
virtual

Prompt the user for input, if necessary, and remember the answers.

Reimplemented from Isis::WorkOrder.

Definition at line 77 of file ImageListActionWorkOrder.cpp.

References Isis::ImageList::askAlpha(), and Isis::WorkOrder::execute().

bool Isis::ImageListActionWorkOrder::isExecutable ( ImageList images)
virtual

This work order can be run on any non-empty image list.

Reimplemented from Isis::WorkOrder.

Definition at line 49 of file ImageListActionWorkOrder.cpp.

bool Isis::WorkOrder::isExecutable ( Context  context)
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.

bool Isis::WorkOrder::isExecutable ( QList< Control * >  controls)
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::CnetEditorViewWorkOrder, and Isis::ExportControlNetWorkOrder.

Definition at line 165 of file WorkOrder.cpp.

void Isis::WorkOrder::postSyncRedo ( )
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 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 in Isis::ImportImagesWorkOrder, Isis::ImportControlNetWorkOrder, Isis::ExportImagesWorkOrder, and Isis::ExportControlNetWorkOrder.

Definition at line 760 of file WorkOrder.cpp.

void Isis::WorkOrder::postSyncUndo ( )
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 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 in Isis::ImportImagesWorkOrder.

Definition at line 807 of file WorkOrder.cpp.

void Isis::WorkOrder::read ( XmlStackedHandlerReader xmlReader)
inherited

Read this work order's data from disk.

Definition at line 186 of file WorkOrder.cpp.

void Isis::WorkOrder::redo ( )
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().

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

void Isis::WorkOrder::setCreatesCleanState ( bool  createsCleanState)
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.

Parameters
createsCleanStateTrue 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.

void Isis::ImageListActionWorkOrder::setData ( ImageList images)
virtual

When this work order is assigned an image list, update the undo command text.

Reimplemented from Isis::WorkOrder.

Definition at line 57 of file ImageListActionWorkOrder.cpp.

References Isis::Image::displayProperties().

void Isis::ImageListActionWorkOrder::syncRedo ( )
virtual

Perform the action.

Reimplemented from Isis::WorkOrder.

Definition at line 150 of file ImageListActionWorkOrder.cpp.

References Isis::toInt().

void Isis::ImageListActionWorkOrder::syncUndo ( )
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 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 from Isis::WorkOrder.

Definition at line 203 of file ImageListActionWorkOrder.cpp.

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


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