]> Creatis software - creaMaracasVisu.git/blob - bbtk/src/bbcreaMaracasVisuManualPaint_UndoRedo.cxx
#3335 creaMaracasVisu Feature New Normal - Manual Paint Model Undo Redo from box
[creaMaracasVisu.git] / bbtk / src / bbcreaMaracasVisuManualPaint_UndoRedo.cxx
1 //===== 
2 // 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)
3 //===== 
4 #include "bbcreaMaracasVisuManualPaint_UndoRedo.h"
5 #include "bbcreaMaracasVisuPackage.h"
6
7 #include <wxMPRBaseData.h>
8
9 namespace bbcreaMaracasVisu
10 {
11
12 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ManualPaint_UndoRedo)
13 BBTK_BLACK_BOX_IMPLEMENTATION(ManualPaint_UndoRedo,bbtk::AtomicBlackBox);
14 //===== 
15 // 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)
16 //===== 
17 void ManualPaint_UndoRedo::Process()
18 {
19
20 // THE MAIN PROCESSING METHOD BODY
21 //   Here we simply set the input 'In' value to the output 'Out'
22 //   And print out the output value
23 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
24 //    void bbSet{Input|Output}NAME(const TYPE&)
25 //    const TYPE& bbGet{Input|Output}NAME() const 
26 //    Where :
27 //    * NAME is the name of the input/output
28 //      (the one provided in the attribute 'name' of the tag 'input')
29 //    * TYPE is the C++ type of the input/output
30 //      (the one provided in the attribute 'type' of the tag 'input')
31 //    bbSetOutputOut( bbGetInputIn() );
32 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
33   
34         if (bbGetInputManualpaintmodel()!=NULL)
35         {
36                 if ( bbGetInputType()==1 )
37                 {       
38                         bbGetInputManualpaintmodel()->Undo();
39                 } // if Type 1
40                 if ( bbGetInputType()==2 )
41                 {       
42                         bbGetInputManualpaintmodel()->Redo();
43                 } // if Type 2
44
45
46                 if (bbGetInputwxvtkbaseview()!=NULL)
47                 {
48
49                         vtkMPRBaseData* vtkmprbasedata = (vtkMPRBaseData*) (bbGetInputwxvtkbaseview()->GetVtkBaseData());
50                         vtkmprbasedata->SetX( bbGetInputManualpaintmodel()->GetRestorBaseInitialPointX() );
51                         vtkmprbasedata->SetY( bbGetInputManualpaintmodel()->GetRestorBaseInitialPointY() );
52                         vtkmprbasedata->SetZ( bbGetInputManualpaintmodel()->GetRestorBaseInitialPointZ() );
53                         wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,12121);  // Refresh
54                         //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
55                         #if wxMAJOR_VERSION <= 2
56                                         bbGetInputwxvtkbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent( newevent );
57                         #else
58                                         bbGetInputwxvtkbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessWindowEvent( newevent );
59                         #endif                          
60                 } // if bbGetInputwxvtkbaseview()
61
62
63         } // if bbGetInputManualpaintmodel()
64
65
66
67
68 }
69 //===== 
70 // 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)
71 //===== 
72 void ManualPaint_UndoRedo::bbUserSetDefaultValues()
73 {
74 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
75 //    Here we initialize the input 'In' to 0
76    bbSetInputType(1);
77    bbSetInputManualpaintmodel(NULL);
78    bbSetInputwxvtkbaseview(NULL);
79 }
80
81 //===== 
82 // 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)
83 //===== 
84 void ManualPaint_UndoRedo::bbUserInitializeProcessing()
85 {
86 //  THE INITIALIZATION METHOD BODY :
87 //    Here does nothing 
88 //    but this is where you should allocate the internal/output pointers 
89 //    if any 
90 }
91
92 //===== 
93 // 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)
94 //===== 
95 void ManualPaint_UndoRedo::bbUserFinalizeProcessing()
96 {
97 //  THE FINALIZATION METHOD BODY :
98 //    Here does nothing 
99 //    but this is where you should desallocate the internal/output pointers 
100 //    if any 
101 }
102
103 } // EO namespace bbcreaMaracasVisu
104
105