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)
4 #include "bbcreaMaracasVisuwxVtkBaseView_Info.h"
5 #include "bbcreaMaracasVisuPackage.h"
6 #include "InteractorStyleMaracas.h"
7 #include <vtkInteractorStyleBaseView.h>
9 namespace bbcreaMaracasVisu
13 class InteractorwxVtkBaseView : public InteractorStyleMaracas
16 InteractorwxVtkBaseView( );
17 InteractorwxVtkBaseView( wxVtkBaseView_Info *box, wxVtkBaseView *wxvtkbaseview );
18 ~InteractorwxVtkBaseView();
19 virtual bool OnLeftButtonDown();
20 virtual bool OnLeftButtonUp();
21 virtual bool OnMouseMove();
22 virtual bool OnRightButtonDown();
23 virtual bool OnRightButtonUp();
24 virtual bool OnLeftDClick();
25 virtual bool OnRightDClick();
28 wxVtkBaseView *_wxvtkbaseview;
29 wxVtkBaseView_Info *_box;
33 InteractorwxVtkBaseView::InteractorwxVtkBaseView( )
35 _wxvtkbaseview = NULL;
40 InteractorwxVtkBaseView::InteractorwxVtkBaseView( wxVtkBaseView_Info *box , wxVtkBaseView *wxvtkbaseview )
44 _wxvtkbaseview = wxvtkbaseview;
47 InteractorwxVtkBaseView::~InteractorwxVtkBaseView()
51 bool InteractorwxVtkBaseView::OnLeftButtonDown()
53 if ( _box->bbGetInputInteractionType()==8 )
57 if ( (_box->bbGetInputInteractionType()==1 ) && (_wxvtkbaseview!=NULL) )
59 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
60 _box->bbSignalOutputModification();
66 bool InteractorwxVtkBaseView::OnLeftButtonUp()
68 if ( _box->bbGetInputInteractionType()==8 )
72 if ( (_box->bbGetInputInteractionType()==2 ) && (_wxvtkbaseview!=NULL) )
74 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
75 _box->bbSignalOutputModification();
81 bool InteractorwxVtkBaseView::OnMouseMove()
84 if (flagDrag==true) intFlag=1; else intFlag=0;
86 if ( (_box->bbGetInputInteractionType()==3 ) && (_wxvtkbaseview!=NULL) )
89 } // if InteractionType 3
90 if (( _box->bbGetInputInteractionType()==8 ) && (flagDrag==true) )
93 } // if InteractionType 8
94 if (( _box->bbGetInputInteractionType()==9 ) && (flagDrag==true) )
97 } // if InteractionType 9
100 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
101 _box->bbSignalOutputModification();
107 bool InteractorwxVtkBaseView::OnRightButtonDown()
109 if ( _box->bbGetInputInteractionType()==9 )
113 if ( (_box->bbGetInputInteractionType()==4 ) && (_wxvtkbaseview!=NULL) )
115 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
116 _box->bbSignalOutputModification();
122 bool InteractorwxVtkBaseView::OnRightButtonUp()
124 if ( _box->bbGetInputInteractionType()==9 )
128 if ( (_box->bbGetInputInteractionType()==5 ) && (_wxvtkbaseview!=NULL) )
130 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
131 _box->bbSignalOutputModification();
138 bool InteractorwxVtkBaseView::OnLeftDClick()
140 if ( (_box->bbGetInputInteractionType()==6 ) && (_wxvtkbaseview!=NULL) )
142 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
143 _box->bbSignalOutputModification();
149 bool InteractorwxVtkBaseView::OnRightDClick()
151 if ( (_box->bbGetInputInteractionType()==7 ) && (_wxvtkbaseview!=NULL) )
153 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
154 _box->bbSignalOutputModification();
161 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,wxVtkBaseView_Info)
162 BBTK_BLACK_BOX_IMPLEMENTATION(wxVtkBaseView_Info,bbtk::AtomicBlackBox);
165 void wxVtkBaseView_Info::SetwxVtkBaseViewOutputs(wxVtkBaseView *wxvtkbaseview )
167 if (wxvtkbaseview!=NULL)
169 bbSetOutputvtkRenderer( wxvtkbaseview->GetRenderer() );
170 bbSetOutputDirection( wxvtkbaseview->GetDirection() );
171 vtkBaseData *vtkbasedata = wxvtkbaseview->GetVtkBaseData();
172 if (vtkbasedata!=NULL)
174 marImageData *marimagedata = vtkbasedata->GetMarImageData();
175 if (marimagedata!=NULL)
177 bbSetOutputImage( marimagedata->GetImageData() );
179 std::vector<double> LstWindowColorLevel;
180 LstWindowColorLevel.push_back( vtkbasedata->GetColorWindow() );
181 LstWindowColorLevel.push_back( vtkbasedata->GetColorLevel() );
182 bbSetOutputWindowColorLevel( LstWindowColorLevel );
184 std::vector<double> lstPoint;
185 lstPoint.push_back( vtkbasedata->GetX() );
186 lstPoint.push_back( vtkbasedata->GetY() );
187 lstPoint.push_back( vtkbasedata->GetZ() );
188 bbSetOutputPoint( lstPoint );
190 int pointMouseX,pointMouseY,pointMouseZ;
191 vtkbasedata->GetPointMouse(pointMouseX,pointMouseY,pointMouseZ);
192 std::vector<double> lstPointMouse;
193 lstPointMouse.push_back( pointMouseX );
194 lstPointMouse.push_back( pointMouseY );
195 lstPointMouse.push_back( pointMouseZ );
196 bbSetOutputPointMouse( lstPointMouse );
199 std::vector<double> lstNormal;
200 wxvtkbaseview->GetNormal( normal );
201 lstNormal.push_back( normal[0] );
202 lstNormal.push_back( normal[1] );
203 lstNormal.push_back( normal[2] );
204 bbSetOutputNormal( lstNormal );
206 bbSetOutputInterpolation( vtkbasedata->GetInterpolate() );
208 } // if wxvtkbaseview
212 // 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)
214 void wxVtkBaseView_Info::Process()
216 // THE MAIN PROCESSING METHOD BODY
217 // Here we simply set the input 'In' value to the output 'Out'
218 // And print out the output value
219 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
220 // void bbSet{Input|Output}NAME(const TYPE&)
221 // const TYPE& bbGet{Input|Output}NAME() const
223 // * NAME is the name of the input/output
224 // (the one provided in the attribute 'name' of the tag 'input')
225 // * TYPE is the C++ type of the input/output
226 // (the one provided in the attribute 'type' of the tag 'input')
227 if (bbGetInputInteractionType()==0)
229 SetwxVtkBaseViewOutputs( bbGetInputwxVtkBaseView() );
234 if (bbGetInputInteractionType()!=0)
236 SetwxVtkBaseViewOutputs( bbGetInputwxVtkBaseView() );
237 if (bbGetInputwxVtkBaseView()!=NULL)
239 InteractorwxVtkBaseView *interactorwxvtkbaseview = new InteractorwxVtkBaseView( this, bbGetInputwxVtkBaseView() );
240 vtkInteractorStyleBaseView *vtkinteractorstylebaseview = (vtkInteractorStyleBaseView*) (bbGetInputwxVtkBaseView()->GetInteractorStyleBaseView() );
241 vtkinteractorstylebaseview->AddInteractorStyleMaracas( interactorwxvtkbaseview );
242 } // if wxVtkBaseView
243 if (bbGetInputwxVtkBaseView2()!=NULL)
245 InteractorwxVtkBaseView *interactorwxvtkbaseview = new InteractorwxVtkBaseView( this, bbGetInputwxVtkBaseView2() );
246 vtkInteractorStyleBaseView *vtkinteractorstylebaseview = (vtkInteractorStyleBaseView*) (bbGetInputwxVtkBaseView2()->GetInteractorStyleBaseView() );
247 vtkinteractorstylebaseview->AddInteractorStyleMaracas( interactorwxvtkbaseview );
248 } // if wxVtkBaseView2
249 if (bbGetInputwxVtkBaseView3()!=NULL)
251 InteractorwxVtkBaseView *interactorwxvtkbaseview = new InteractorwxVtkBaseView( this, bbGetInputwxVtkBaseView3() );
252 vtkInteractorStyleBaseView *vtkinteractorstylebaseview = (vtkInteractorStyleBaseView*) (bbGetInputwxVtkBaseView3()->GetInteractorStyleBaseView() );
253 vtkinteractorstylebaseview->AddInteractorStyleMaracas( interactorwxvtkbaseview );
254 } // if wxVtkBaseView3
255 } // if InteractionType !=0
260 // 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)
262 void wxVtkBaseView_Info::bbUserSetDefaultValues()
264 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
265 // Here we initialize the input 'In' to 0
267 std::vector<double> LstWindowColorLevel;
268 LstWindowColorLevel.push_back( 1000 );
269 LstWindowColorLevel.push_back( 500 );
270 bbSetInputwxVtkBaseView( NULL );
271 bbSetInputwxVtkBaseView2( NULL );
272 bbSetInputwxVtkBaseView3( NULL );
273 bbSetInputInteractionType(0);
274 bbSetOutputWindowColorLevel( LstWindowColorLevel );
275 bbSetOutputDirection(2);
276 bbSetOutputInterpolation(true);
277 bbSetOutputvtkRenderer(NULL);
281 // 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)
283 void wxVtkBaseView_Info::bbUserInitializeProcessing()
285 // THE INITIALIZATION METHOD BODY :
287 // but this is where you should allocate the internal/output pointers
292 // 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)
294 void wxVtkBaseView_Info::bbUserFinalizeProcessing()
296 // THE FINALIZATION METHOD BODY :
298 // but this is where you should desallocate the internal/output pointers
302 }// EO namespace bbcreaMaracasVisu