]> Creatis software - creaMaracasVisu.git/blobdiff - bbtk/src/bbcreaMaracasVisuManualPaint_UndoRedo.cxx
#3335 creaMaracasVisu Feature New Normal - Manual Paint Model Undo Redo from box
[creaMaracasVisu.git] / bbtk / src / bbcreaMaracasVisuManualPaint_UndoRedo.cxx
diff --git a/bbtk/src/bbcreaMaracasVisuManualPaint_UndoRedo.cxx b/bbtk/src/bbcreaMaracasVisuManualPaint_UndoRedo.cxx
new file mode 100644 (file)
index 0000000..11c935b
--- /dev/null
@@ -0,0 +1,105 @@
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+#include "bbcreaMaracasVisuManualPaint_UndoRedo.h"
+#include "bbcreaMaracasVisuPackage.h"
+
+#include <wxMPRBaseData.h>
+
+namespace bbcreaMaracasVisu
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ManualPaint_UndoRedo)
+BBTK_BLACK_BOX_IMPLEMENTATION(ManualPaint_UndoRedo,bbtk::AtomicBlackBox);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void ManualPaint_UndoRedo::Process()
+{
+
+// THE MAIN PROCESSING METHOD BODY
+//   Here we simply set the input 'In' value to the output 'Out'
+//   And print out the output value
+// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+//    void bbSet{Input|Output}NAME(const TYPE&)
+//    const TYPE& bbGet{Input|Output}NAME() const 
+//    Where :
+//    * NAME is the name of the input/output
+//      (the one provided in the attribute 'name' of the tag 'input')
+//    * TYPE is the C++ type of the input/output
+//      (the one provided in the attribute 'type' of the tag 'input')
+//    bbSetOutputOut( bbGetInputIn() );
+//    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+  
+       if (bbGetInputManualpaintmodel()!=NULL)
+       {
+               if ( bbGetInputType()==1 )
+               {       
+                       bbGetInputManualpaintmodel()->Undo();
+               } // if Type 1
+               if ( bbGetInputType()==2 )
+               {       
+                       bbGetInputManualpaintmodel()->Redo();
+               } // if Type 2
+
+
+               if (bbGetInputwxvtkbaseview()!=NULL)
+               {
+
+                       vtkMPRBaseData* vtkmprbasedata = (vtkMPRBaseData*) (bbGetInputwxvtkbaseview()->GetVtkBaseData());
+                       vtkmprbasedata->SetX( bbGetInputManualpaintmodel()->GetRestorBaseInitialPointX() );
+                       vtkmprbasedata->SetY( bbGetInputManualpaintmodel()->GetRestorBaseInitialPointY() );
+                       vtkmprbasedata->SetZ( bbGetInputManualpaintmodel()->GetRestorBaseInitialPointZ() );
+                       wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,12121);  // Refresh
+                       //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+                       #if wxMAJOR_VERSION <= 2
+                                       bbGetInputwxvtkbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent( newevent );
+                       #else
+                                       bbGetInputwxvtkbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessWindowEvent( newevent );
+                       #endif                          
+               } // if bbGetInputwxvtkbaseview()
+
+
+       } // if bbGetInputManualpaintmodel()
+
+
+
+
+}
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void ManualPaint_UndoRedo::bbUserSetDefaultValues()
+{
+//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
+//    Here we initialize the input 'In' to 0
+   bbSetInputType(1);
+   bbSetInputManualpaintmodel(NULL);
+   bbSetInputwxvtkbaseview(NULL);
+}
+
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void ManualPaint_UndoRedo::bbUserInitializeProcessing()
+{
+//  THE INITIALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should allocate the internal/output pointers 
+//    if any 
+}
+
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void ManualPaint_UndoRedo::bbUserFinalizeProcessing()
+{
+//  THE FINALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should desallocate the internal/output pointers 
+//    if any 
+}
+
+} // EO namespace bbcreaMaracasVisu
+
+