Hi Pedro,

You can use the Undo/Redo mechanism by defining an operation event for each 
action. You'll need one operation for Undo and one operation for Redo.

  //specify the undo operation with the edited slice
  m_doOperation = new MyOperation();

  //specify the undo operation with the non-edited slice
  m_undoOperation = new MyOperation();

Where MyOperation is derived from mitk::Operation. There's also a need to have 
a class that executes the operation when Undo() or Redo() is called on 
UndoController. This is going to be derived from mitk::OperationActor. Then put 
everything together in an mitk::OperationEvent.

  //create an operation event for the undo stack
  OperationEvent* undoStackItem = new OperationEvent( 
MyOperationApplier::GetInstance(), m_doOperation, m_undoOperation, 
"Segmentation" );

And add it to the UndoController:

  //add it to the undo controller
  UndoController::GetCurrentUndoModel()->SetOperationEvent( undoStackItem );


Have a look at mitkSegTool2D to see how Undo/Redo is done for mitk tools.

Hope this helps.


Regards

Tobi


Von: Pedro Cardoso [mailto:[email protected]]
Gesendet: Dienstag, 27. August 2013 22:05
An: [email protected]
Betreff: [mitk-users] Undo Controller

Hi,

can someone explain me how can I use the mitkUndoController? I've looked into 
the Interaction and Undo/Redo Concepts 
(http://docs.mitk.org/nightly-qt4/InteractionPage.html), but I can't really 
understand how can I use the undo controller. Also, I'd like to know if the 
undo controller also works with the mitk tools


Thanks in advance.
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to