18 #include <itkCommand.h>
20 int mitk::UndoStackItem::m_CurrObjectEventId = 0;
21 int mitk::UndoStackItem::m_CurrGroupEventId = 0;
36 return m_CurrObjectEventId;
41 return m_CurrGroupEventId;
46 ++m_CurrObjectEventId;
56 return m_ObjectEventId;
61 return m_GroupEventId;
71 m_Reversed = !m_Reversed;
89 std::string description)
91 m_Destination(destination),
92 m_Operation(operation),
93 m_UndoOperation(undoOperation),
97 if (itk::Object *
object = dynamic_cast<itk::Object *>(m_Destination))
101 m_DeleteTag =
object->AddObserver(itk::DeleteEvent(), command);
110 if (itk::Object *
object = dynamic_cast<itk::Object *>(m_Destination))
112 object->RemoveObserver(m_DeleteTag);
117 delete m_UndoOperation;
124 if (m_Operation ==
nullptr)
128 m_Operation = m_UndoOperation;
129 m_UndoOperation = tempOperation;
137 if (m_Destination && m_Operation && !m_Invalid)
138 m_Destination->ExecuteOperation(m_Operation);
143 return m_Destination;
int GetObjectEventId()
Returns the ObjectEventId for this object.
itk::SmartPointer< Self > Pointer
Base class of all Operation-classes.
std::string GetDescription()
Returns the textual description of this object.
static int GetCurrGroupEventId()
For combining operations in groups.
OperationActor * GetDestination()
abstract class, that can be used by Undo to undo an operation.
virtual void ReverseAndExecute()
virtual void ReverseOperations()
Operation * GetOperation()
virtual ~OperationEvent()
virtual void ReverseAndExecute() override
int GetGroupEventId()
Returns the GroupEventId for this object.
Represents an entry of the undo or redo stack.
UndoStackItem(std::string description="")
OperationEvent(OperationActor *destination, Operation *operation, Operation *undoOperation, std::string description="")
virtual void ReverseOperations() override
static void IncCurrObjectEventId()
Increases the current ObjectEventId For example if a button click generates operations the ObjectEven...
static int GetCurrObjectEventId()
For combining operations in Objects.
static void IncCurrGroupEventId()
Increases the current GroupEventId For example if a button click generates operations the GroupEventI...
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.