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 <vtkInteractorStyleBaseView.h>
8 namespace bbcreaMaracasVisu
11 InteractorwxVtkBaseView_model::InteractorwxVtkBaseView_model()
13 _wxvtkbaseview = NULL;
16 InteractorwxVtkBaseView_model::~InteractorwxVtkBaseView_model()
20 void InteractorwxVtkBaseView_model::SetwxVtkBaseView( wxVtkBaseView *wxvtkbaseview)
22 _wxvtkbaseview = wxvtkbaseview;
25 void InteractorwxVtkBaseView_model::AddThisInteractor()
27 vtkInteractorStyleBaseView *vtkinteractorstylebaseview = (vtkInteractorStyleBaseView*) (_wxvtkbaseview->GetInteractorStyleBaseView() );
28 vtkinteractorstylebaseview->AddInteractorStyleMaracas( this );
35 class InteractorwxVtkBaseView : public InteractorwxVtkBaseView_model
38 InteractorwxVtkBaseView( wxVtkBaseView_Info *box );
39 ~InteractorwxVtkBaseView();
40 virtual bool OnLeftButtonDown();
41 virtual bool OnLeftButtonUp();
42 virtual bool OnMouseMove();
43 virtual bool OnRightButtonDown();
44 virtual bool OnRightButtonUp();
45 virtual bool OnMiddleButtonDown();
46 virtual bool OnMiddleButtonUp();
47 virtual bool OnLeftDClick();
48 virtual bool OnRightDClick();
50 wxVtkBaseView_Info *_box;
54 InteractorwxVtkBaseView::InteractorwxVtkBaseView( wxVtkBaseView_Info *box )
60 InteractorwxVtkBaseView::~InteractorwxVtkBaseView()
64 bool InteractorwxVtkBaseView::OnLeftButtonDown()
68 if ( _box->bbGetInputInteractionType()==8 )
72 if ( (_box->bbGetInputInteractionType()==1 ) && (_wxvtkbaseview!=NULL) )
74 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
75 _box->bbSignalOutputModification();
82 bool InteractorwxVtkBaseView::OnLeftButtonUp()
86 if ( _box->bbGetInputInteractionType()==8 )
90 if ( (_box->bbGetInputInteractionType()==2 ) && (_wxvtkbaseview!=NULL) )
92 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
93 _box->bbSignalOutputModification();
101 bool InteractorwxVtkBaseView::OnMiddleButtonDown()
105 if ( _box->bbGetInputInteractionType()==12 ) // MiddleDrag
109 if ( (_box->bbGetInputInteractionType()==10 ) && (_wxvtkbaseview!=NULL) ) // MiddleButton Down
111 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
112 _box->bbSignalOutputModification();
119 bool InteractorwxVtkBaseView::OnMiddleButtonUp()
123 if ( _box->bbGetInputInteractionType()==12 ) // MiddleDrag
127 if ( (_box->bbGetInputInteractionType()==11 ) && (_wxvtkbaseview!=NULL) ) // MiddleButton Up
129 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
130 _box->bbSignalOutputModification();
139 bool InteractorwxVtkBaseView::OnMouseMove()
144 if (flagDrag==true) intFlag=1; else intFlag=0;
146 if ( (_box->bbGetInputInteractionType()==3 ) && (_wxvtkbaseview!=NULL) )
149 } // if InteractionType 3
150 if (( _box->bbGetInputInteractionType()==8 ) && (flagDrag==true) )
153 } // if InteractionType 8
154 if (( _box->bbGetInputInteractionType()==9 ) && (flagDrag==true) )
157 } // if InteractionType 9
158 if (( _box->bbGetInputInteractionType()==12 ) && (flagDrag==true) )
161 } // if InteractionType 9
166 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
167 _box->bbSignalOutputModification();
174 bool InteractorwxVtkBaseView::OnRightButtonDown()
178 if ( _box->bbGetInputInteractionType()==9 )
182 if ( (_box->bbGetInputInteractionType()==4 ) && (_wxvtkbaseview!=NULL) )
184 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
185 _box->bbSignalOutputModification();
192 bool InteractorwxVtkBaseView::OnRightButtonUp()
196 if ( _box->bbGetInputInteractionType()==9 )
200 if ( (_box->bbGetInputInteractionType()==5 ) && (_wxvtkbaseview!=NULL) )
202 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
203 _box->bbSignalOutputModification();
211 bool InteractorwxVtkBaseView::OnLeftDClick()
215 if ( (_box->bbGetInputInteractionType()==6 ) && (_wxvtkbaseview!=NULL) )
217 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
218 _box->bbSignalOutputModification();
225 bool InteractorwxVtkBaseView::OnRightDClick()
229 if ( (_box->bbGetInputInteractionType()==7 ) && (_wxvtkbaseview!=NULL) )
231 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
232 _box->bbSignalOutputModification();
239 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,wxVtkBaseView_Info)
240 BBTK_BLACK_BOX_IMPLEMENTATION(wxVtkBaseView_Info,bbtk::AtomicBlackBox);
242 void wxVtkBaseView_Info::SetwxVtkBaseViewOutputs(wxVtkBaseView *wxvtkbaseview )
244 if (wxvtkbaseview!=NULL)
246 bbSetOutputvtkRenderer( wxvtkbaseview->GetRenderer() );
247 bbSetOutputDirection( wxvtkbaseview->GetDirection() );
248 bbSetOutputwxVtkBaseView(wxvtkbaseview);
249 vtkBaseData *vtkbasedata = wxvtkbaseview->GetVtkBaseData();
250 if (vtkbasedata!=NULL)
252 marImageData *marimagedata = vtkbasedata->GetMarImageData();
253 if (marimagedata!=NULL)
255 bbSetOutputImage( marimagedata->GetImageData() );
257 std::vector<double> LstWindowColorLevel;
258 LstWindowColorLevel.push_back( vtkbasedata->GetColorWindow() );
259 LstWindowColorLevel.push_back( vtkbasedata->GetColorLevel() );
260 bbSetOutputWindowColorLevel( LstWindowColorLevel );
262 std::vector<double> lstPoint;
263 lstPoint.push_back( vtkbasedata->GetX() );
264 lstPoint.push_back( vtkbasedata->GetY() );
265 lstPoint.push_back( vtkbasedata->GetZ() );
266 bbSetOutputPoint( lstPoint );
268 int pointMouseX,pointMouseY,pointMouseZ;
269 vtkbasedata->GetPointMouse(pointMouseX,pointMouseY,pointMouseZ);
270 std::vector<double> lstPointMouse;
271 lstPointMouse.push_back( pointMouseX );
272 lstPointMouse.push_back( pointMouseY );
273 lstPointMouse.push_back( pointMouseZ );
274 bbSetOutputPointMouse( lstPointMouse );
277 std::vector<double> lstNormal;
278 wxvtkbaseview->GetNormal( normal );
279 lstNormal.push_back( normal[0] );
280 lstNormal.push_back( normal[1] );
281 lstNormal.push_back( normal[2] );
282 bbSetOutputNormal( lstNormal );
284 bbSetOutputInterpolation( vtkbasedata->GetInterpolate() );
286 } // if wxvtkbaseview
290 // 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)
292 void wxVtkBaseView_Info::Process()
294 // THE MAIN PROCESSING METHOD BODY
295 // Here we simply set the input 'In' value to the output 'Out'
296 // And print out the output value
297 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
298 // void bbSet{Input|Output}NAME(const TYPE&)
299 // const TYPE& bbGet{Input|Output}NAME() const
301 // * NAME is the name of the input/output
302 // (the one provided in the attribute 'name' of the tag 'input')
303 // * TYPE is the C++ type of the input/output
304 // (the one provided in the attribute 'type' of the tag 'input')
305 if (bbGetInputInteractionType()==0)
307 SetwxVtkBaseViewOutputs( bbGetInputwxVtkBaseView() );
313 if (bbGetInputInteractionType()!=0)
315 SetwxVtkBaseViewOutputs( bbGetInputwxVtkBaseView() );
317 interactorwxvtkbaseview = new InteractorwxVtkBaseView( this );
318 if (bbGetInputwxVtkBaseView()!=NULL)
320 interactorwxvtkbaseview->SetwxVtkBaseView( bbGetInputwxVtkBaseView() );
321 interactorwxvtkbaseview->AddThisInteractor();
322 } // if wxVtkBaseView
324 interactorwxvtkbaseview1 = new InteractorwxVtkBaseView( this );
325 if (bbGetInputwxVtkBaseView1()!=NULL)
327 interactorwxvtkbaseview1->SetwxVtkBaseView( bbGetInputwxVtkBaseView1() );
328 interactorwxvtkbaseview1->AddThisInteractor();
329 } // if wxVtkBaseView2
331 interactorwxvtkbaseview2 = new InteractorwxVtkBaseView( this );
332 if (bbGetInputwxVtkBaseView2()!=NULL)
334 interactorwxvtkbaseview2->SetwxVtkBaseView( bbGetInputwxVtkBaseView2() );
335 interactorwxvtkbaseview2->AddThisInteractor();
336 } // if wxVtkBaseView2
338 interactorwxvtkbaseview3 = new InteractorwxVtkBaseView( this );
339 if (bbGetInputwxVtkBaseView3()!=NULL)
341 interactorwxvtkbaseview3->SetwxVtkBaseView( bbGetInputwxVtkBaseView3() );
342 interactorwxvtkbaseview3->AddThisInteractor();
343 } // if wxVtkBaseView3
345 bbSetOutputInteractorwxVtkBaseView_model( interactorwxvtkbaseview );
346 bbSetOutputInteractorwxVtkBaseView_model1( interactorwxvtkbaseview1 );
347 bbSetOutputInteractorwxVtkBaseView_model2( interactorwxvtkbaseview2 );
348 bbSetOutputInteractorwxVtkBaseView_model3( interactorwxvtkbaseview3 );
349 } // if InteractionType !=0
352 bbSetOutputBox_wxVtkBaseView_Info( this );
356 // 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)
358 void wxVtkBaseView_Info::bbUserSetDefaultValues()
360 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
361 // Here we initialize the input 'In' to 0
363 std::vector<double> LstWindowColorLevel;
364 LstWindowColorLevel.push_back( 1000 );
365 LstWindowColorLevel.push_back( 500 );
366 bbSetInputwxVtkBaseView( NULL );
367 bbSetInputwxVtkBaseView2( NULL );
368 bbSetInputwxVtkBaseView3( NULL );
369 bbSetInputInteractionType(0);
370 bbSetOutputWindowColorLevel( LstWindowColorLevel );
371 bbSetOutputDirection(2);
372 bbSetOutputInterpolation(true);
373 bbSetOutputvtkRenderer(NULL);
374 interactorwxvtkbaseview=NULL;
375 interactorwxvtkbaseview2=NULL;
376 interactorwxvtkbaseview3=NULL;
377 bbSetOutputInteractorwxVtkBaseView_model( interactorwxvtkbaseview );
378 bbSetOutputInteractorwxVtkBaseView_model1( interactorwxvtkbaseview1 );
379 bbSetOutputInteractorwxVtkBaseView_model2( interactorwxvtkbaseview2 );
380 bbSetOutputInteractorwxVtkBaseView_model3( interactorwxvtkbaseview3 );
384 // 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)
386 void wxVtkBaseView_Info::bbUserInitializeProcessing()
388 // THE INITIALIZATION METHOD BODY :
390 // but this is where you should allocate the internal/output pointers
392 bbSetOutputInteractorwxVtkBaseView_model(NULL);
393 bbSetOutputInteractorwxVtkBaseView_model1(NULL);
394 bbSetOutputInteractorwxVtkBaseView_model2(NULL);
395 bbSetOutputInteractorwxVtkBaseView_model3(NULL);
399 // 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)
401 void wxVtkBaseView_Info::bbUserFinalizeProcessing()
403 // THE FINALIZATION METHOD BODY :
405 // but this is where you should desallocate the internal/output pointers
409 }// EO namespace bbcreaMaracasVisu