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 );
168 _box->bbSignalOutputModification();
169 // _box->bbSignalOutputModification(std::string("BoxChange"),false);
177 bool InteractorwxVtkBaseView::OnRightButtonDown()
181 if ( _box->bbGetInputInteractionType()==9 )
185 if ( (_box->bbGetInputInteractionType()==4 ) && (_wxvtkbaseview!=NULL) )
187 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
188 _box->bbSignalOutputModification();
195 bool InteractorwxVtkBaseView::OnRightButtonUp()
199 if ( _box->bbGetInputInteractionType()==9 )
203 if ( (_box->bbGetInputInteractionType()==5 ) && (_wxvtkbaseview!=NULL) )
205 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
206 _box->bbSignalOutputModification();
214 bool InteractorwxVtkBaseView::OnLeftDClick()
218 if ( (_box->bbGetInputInteractionType()==6 ) && (_wxvtkbaseview!=NULL) )
220 printf("EED InteractorwxVtkBaseView::OnLeftDClick type=6 \n");
221 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
222 _box->bbSignalOutputModification();
229 bool InteractorwxVtkBaseView::OnRightDClick()
233 if ( (_box->bbGetInputInteractionType()==7 ) && (_wxvtkbaseview!=NULL) )
235 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
236 _box->bbSignalOutputModification();
243 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,wxVtkBaseView_Info)
244 BBTK_BLACK_BOX_IMPLEMENTATION(wxVtkBaseView_Info,bbtk::AtomicBlackBox);
246 void wxVtkBaseView_Info::SetwxVtkBaseViewOutputs(wxVtkBaseView *wxvtkbaseview )
248 if (wxvtkbaseview!=NULL)
250 bbSetOutputvtkRenderer( wxvtkbaseview->GetRenderer() );
251 bbSetOutputDirection( wxvtkbaseview->GetDirection() );
252 bbSetOutputwxVtkBaseView(wxvtkbaseview);
253 vtkBaseData *vtkbasedata = wxvtkbaseview->GetVtkBaseData();
254 if (vtkbasedata!=NULL)
256 marImageData *marimagedata = vtkbasedata->GetMarImageData();
257 if (marimagedata!=NULL)
259 bbSetOutputImage( marimagedata->GetImageData() );
261 std::vector<double> LstWindowColorLevel;
262 LstWindowColorLevel.push_back( vtkbasedata->GetColorWindow() );
263 LstWindowColorLevel.push_back( vtkbasedata->GetColorLevel() );
264 bbSetOutputWindowColorLevel( LstWindowColorLevel );
266 std::vector<double> lstPoint;
267 lstPoint.push_back( vtkbasedata->GetX() );
268 lstPoint.push_back( vtkbasedata->GetY() );
269 lstPoint.push_back( vtkbasedata->GetZ() );
270 bbSetOutputPoint( lstPoint );
272 int pointMouseX,pointMouseY,pointMouseZ;
273 vtkbasedata->GetPointMouse(pointMouseX,pointMouseY,pointMouseZ);
274 std::vector<double> lstPointMouse;
275 lstPointMouse.push_back( pointMouseX );
276 lstPointMouse.push_back( pointMouseY );
277 lstPointMouse.push_back( pointMouseZ );
278 bbSetOutputPointMouse( lstPointMouse );
281 std::vector<double> lstNormal;
282 wxvtkbaseview->GetNormal( normal );
283 lstNormal.push_back( normal[0] );
284 lstNormal.push_back( normal[1] );
285 lstNormal.push_back( normal[2] );
286 bbSetOutputNormal( lstNormal );
288 bbSetOutputInterpolation( vtkbasedata->GetInterpolate() );
290 } // if wxvtkbaseview
294 // 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)
296 void wxVtkBaseView_Info::Process()
298 // THE MAIN PROCESSING METHOD BODY
299 // Here we simply set the input 'In' value to the output 'Out'
300 // And print out the output value
301 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
302 // void bbSet{Input|Output}NAME(const TYPE&)
303 // const TYPE& bbGet{Input|Output}NAME() const
305 // * NAME is the name of the input/output
306 // (the one provided in the attribute 'name' of the tag 'input')
307 // * TYPE is the C++ type of the input/output
308 // (the one provided in the attribute 'type' of the tag 'input')
309 if (bbGetInputInteractionType()==0)
311 SetwxVtkBaseViewOutputs( bbGetInputwxVtkBaseView() );
317 if (bbGetInputInteractionType()!=0)
319 SetwxVtkBaseViewOutputs( bbGetInputwxVtkBaseView() );
321 interactorwxvtkbaseview = new InteractorwxVtkBaseView( this );
322 if (bbGetInputwxVtkBaseView()!=NULL)
324 interactorwxvtkbaseview->SetwxVtkBaseView( bbGetInputwxVtkBaseView() );
325 interactorwxvtkbaseview->AddThisInteractor();
326 } // if wxVtkBaseView
328 interactorwxvtkbaseview1 = new InteractorwxVtkBaseView( this );
329 if (bbGetInputwxVtkBaseView1()!=NULL)
331 interactorwxvtkbaseview1->SetwxVtkBaseView( bbGetInputwxVtkBaseView1() );
332 interactorwxvtkbaseview1->AddThisInteractor();
333 } // if wxVtkBaseView2
335 interactorwxvtkbaseview2 = new InteractorwxVtkBaseView( this );
336 if (bbGetInputwxVtkBaseView2()!=NULL)
338 interactorwxvtkbaseview2->SetwxVtkBaseView( bbGetInputwxVtkBaseView2() );
339 interactorwxvtkbaseview2->AddThisInteractor();
340 } // if wxVtkBaseView2
342 interactorwxvtkbaseview3 = new InteractorwxVtkBaseView( this );
343 if (bbGetInputwxVtkBaseView3()!=NULL)
345 interactorwxvtkbaseview3->SetwxVtkBaseView( bbGetInputwxVtkBaseView3() );
346 interactorwxvtkbaseview3->AddThisInteractor();
347 } // if wxVtkBaseView3
349 bbSetOutputInteractorwxVtkBaseView_model( interactorwxvtkbaseview );
350 bbSetOutputInteractorwxVtkBaseView_model1( interactorwxvtkbaseview1 );
351 bbSetOutputInteractorwxVtkBaseView_model2( interactorwxvtkbaseview2 );
352 bbSetOutputInteractorwxVtkBaseView_model3( interactorwxvtkbaseview3 );
353 } // if InteractionType !=0
356 bbSetOutputBox_wxVtkBaseView_Info( this );
360 // 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)
362 void wxVtkBaseView_Info::bbUserSetDefaultValues()
364 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
365 // Here we initialize the input 'In' to 0
367 std::vector<double> LstWindowColorLevel;
368 LstWindowColorLevel.push_back( 1000 );
369 LstWindowColorLevel.push_back( 500 );
370 bbSetInputwxVtkBaseView( NULL );
371 bbSetInputwxVtkBaseView2( NULL );
372 bbSetInputwxVtkBaseView3( NULL );
373 bbSetInputInteractionType(0);
374 bbSetOutputWindowColorLevel( LstWindowColorLevel );
375 bbSetOutputDirection(2);
376 bbSetOutputInterpolation(true);
377 bbSetOutputvtkRenderer(NULL);
378 interactorwxvtkbaseview=NULL;
379 interactorwxvtkbaseview2=NULL;
380 interactorwxvtkbaseview3=NULL;
381 bbSetOutputInteractorwxVtkBaseView_model( interactorwxvtkbaseview );
382 bbSetOutputInteractorwxVtkBaseView_model1( interactorwxvtkbaseview1 );
383 bbSetOutputInteractorwxVtkBaseView_model2( interactorwxvtkbaseview2 );
384 bbSetOutputInteractorwxVtkBaseView_model3( interactorwxvtkbaseview3 );
388 // 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)
390 void wxVtkBaseView_Info::bbUserInitializeProcessing()
392 // THE INITIALIZATION METHOD BODY :
394 // but this is where you should allocate the internal/output pointers
396 bbSetOutputInteractorwxVtkBaseView_model(NULL);
397 bbSetOutputInteractorwxVtkBaseView_model1(NULL);
398 bbSetOutputInteractorwxVtkBaseView_model2(NULL);
399 bbSetOutputInteractorwxVtkBaseView_model3(NULL);
403 // 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)
405 void wxVtkBaseView_Info::bbUserFinalizeProcessing()
407 // THE FINALIZATION METHOD BODY :
409 // but this is where you should desallocate the internal/output pointers
413 }// EO namespace bbcreaMaracasVisu