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 OnLeftDClick();
46 virtual bool OnRightDClick();
48 wxVtkBaseView_Info *_box;
52 InteractorwxVtkBaseView::InteractorwxVtkBaseView( wxVtkBaseView_Info *box )
58 InteractorwxVtkBaseView::~InteractorwxVtkBaseView()
62 bool InteractorwxVtkBaseView::OnLeftButtonDown()
66 if ( _box->bbGetInputInteractionType()==8 )
70 if ( (_box->bbGetInputInteractionType()==1 ) && (_wxvtkbaseview!=NULL) )
72 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
73 _box->bbSignalOutputModification();
80 bool InteractorwxVtkBaseView::OnLeftButtonUp()
84 if ( _box->bbGetInputInteractionType()==8 )
88 if ( (_box->bbGetInputInteractionType()==2 ) && (_wxvtkbaseview!=NULL) )
90 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
91 _box->bbSignalOutputModification();
98 bool InteractorwxVtkBaseView::OnMouseMove()
103 if (flagDrag==true) intFlag=1; else intFlag=0;
105 if ( (_box->bbGetInputInteractionType()==3 ) && (_wxvtkbaseview!=NULL) )
108 } // if InteractionType 3
109 if (( _box->bbGetInputInteractionType()==8 ) && (flagDrag==true) )
112 } // if InteractionType 8
113 if (( _box->bbGetInputInteractionType()==9 ) && (flagDrag==true) )
116 } // if InteractionType 9
119 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
120 _box->bbSignalOutputModification();
127 bool InteractorwxVtkBaseView::OnRightButtonDown()
131 if ( _box->bbGetInputInteractionType()==9 )
135 if ( (_box->bbGetInputInteractionType()==4 ) && (_wxvtkbaseview!=NULL) )
137 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
138 _box->bbSignalOutputModification();
145 bool InteractorwxVtkBaseView::OnRightButtonUp()
149 if ( _box->bbGetInputInteractionType()==9 )
153 if ( (_box->bbGetInputInteractionType()==5 ) && (_wxvtkbaseview!=NULL) )
155 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
156 _box->bbSignalOutputModification();
164 bool InteractorwxVtkBaseView::OnLeftDClick()
168 if ( (_box->bbGetInputInteractionType()==6 ) && (_wxvtkbaseview!=NULL) )
170 printf("EED InteractorwxVtkBaseView::OnLeftDClick type=6 \n");
171 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
172 _box->bbSignalOutputModification();
179 bool InteractorwxVtkBaseView::OnRightDClick()
183 if ( (_box->bbGetInputInteractionType()==7 ) && (_wxvtkbaseview!=NULL) )
185 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
186 _box->bbSignalOutputModification();
193 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,wxVtkBaseView_Info)
194 BBTK_BLACK_BOX_IMPLEMENTATION(wxVtkBaseView_Info,bbtk::AtomicBlackBox);
196 void wxVtkBaseView_Info::SetwxVtkBaseViewOutputs(wxVtkBaseView *wxvtkbaseview )
198 if (wxvtkbaseview!=NULL)
200 bbSetOutputvtkRenderer( wxvtkbaseview->GetRenderer() );
201 bbSetOutputDirection( wxvtkbaseview->GetDirection() );
202 bbSetOutputwxVtkBaseView(wxvtkbaseview);
203 vtkBaseData *vtkbasedata = wxvtkbaseview->GetVtkBaseData();
204 if (vtkbasedata!=NULL)
206 marImageData *marimagedata = vtkbasedata->GetMarImageData();
207 if (marimagedata!=NULL)
209 bbSetOutputImage( marimagedata->GetImageData() );
211 std::vector<double> LstWindowColorLevel;
212 LstWindowColorLevel.push_back( vtkbasedata->GetColorWindow() );
213 LstWindowColorLevel.push_back( vtkbasedata->GetColorLevel() );
214 bbSetOutputWindowColorLevel( LstWindowColorLevel );
216 std::vector<double> lstPoint;
217 lstPoint.push_back( vtkbasedata->GetX() );
218 lstPoint.push_back( vtkbasedata->GetY() );
219 lstPoint.push_back( vtkbasedata->GetZ() );
220 bbSetOutputPoint( lstPoint );
222 int pointMouseX,pointMouseY,pointMouseZ;
223 vtkbasedata->GetPointMouse(pointMouseX,pointMouseY,pointMouseZ);
224 std::vector<double> lstPointMouse;
225 lstPointMouse.push_back( pointMouseX );
226 lstPointMouse.push_back( pointMouseY );
227 lstPointMouse.push_back( pointMouseZ );
228 bbSetOutputPointMouse( lstPointMouse );
231 std::vector<double> lstNormal;
232 wxvtkbaseview->GetNormal( normal );
233 lstNormal.push_back( normal[0] );
234 lstNormal.push_back( normal[1] );
235 lstNormal.push_back( normal[2] );
236 bbSetOutputNormal( lstNormal );
238 bbSetOutputInterpolation( vtkbasedata->GetInterpolate() );
240 } // if wxvtkbaseview
244 // 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)
246 void wxVtkBaseView_Info::Process()
248 // THE MAIN PROCESSING METHOD BODY
249 // Here we simply set the input 'In' value to the output 'Out'
250 // And print out the output value
251 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
252 // void bbSet{Input|Output}NAME(const TYPE&)
253 // const TYPE& bbGet{Input|Output}NAME() const
255 // * NAME is the name of the input/output
256 // (the one provided in the attribute 'name' of the tag 'input')
257 // * TYPE is the C++ type of the input/output
258 // (the one provided in the attribute 'type' of the tag 'input')
259 if (bbGetInputInteractionType()==0)
261 SetwxVtkBaseViewOutputs( bbGetInputwxVtkBaseView() );
267 if (bbGetInputInteractionType()!=0)
269 SetwxVtkBaseViewOutputs( bbGetInputwxVtkBaseView() );
271 interactorwxvtkbaseview = new InteractorwxVtkBaseView( this );
272 if (bbGetInputwxVtkBaseView()!=NULL)
274 interactorwxvtkbaseview->SetwxVtkBaseView( bbGetInputwxVtkBaseView() );
275 interactorwxvtkbaseview->AddThisInteractor();
276 } // if wxVtkBaseView
278 interactorwxvtkbaseview2 = new InteractorwxVtkBaseView( this );
279 if (bbGetInputwxVtkBaseView2()!=NULL)
281 interactorwxvtkbaseview2->SetwxVtkBaseView( bbGetInputwxVtkBaseView2() );
282 interactorwxvtkbaseview2->AddThisInteractor();
284 // vtkInteractorStyleBaseView *vtkinteractorstylebaseview = (vtkInteractorStyleBaseView*) (bbGetInputwxVtkBaseView2()->GetInteractorStyleBaseView() );
285 // vtkinteractorstylebaseview->AddInteractorStyleMaracas( interactorwxvtkbaseview2 );
286 } // if wxVtkBaseView2
288 interactorwxvtkbaseview3 = new InteractorwxVtkBaseView( this );
289 if (bbGetInputwxVtkBaseView3()!=NULL)
291 interactorwxvtkbaseview3->SetwxVtkBaseView( bbGetInputwxVtkBaseView3() );
292 interactorwxvtkbaseview3->AddThisInteractor();
294 // vtkInteractorStyleBaseView *vtkinteractorstylebaseview = (vtkInteractorStyleBaseView*) (bbGetInputwxVtkBaseView3()->GetInteractorStyleBaseView() );
295 // vtkinteractorstylebaseview->AddInteractorStyleMaracas( interactorwxvtkbaseview3 );
296 } // if wxVtkBaseView3
298 bbSetOutputInteractorwxVtkBaseView_model( interactorwxvtkbaseview );
299 bbSetOutputInteractorwxVtkBaseView_model2( interactorwxvtkbaseview2 );
300 bbSetOutputInteractorwxVtkBaseView_model3( interactorwxvtkbaseview3 );
301 } // if InteractionType !=0
304 bbSetOutputBox_wxVtkBaseView_Info( this );
308 // 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)
310 void wxVtkBaseView_Info::bbUserSetDefaultValues()
312 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
313 // Here we initialize the input 'In' to 0
315 std::vector<double> LstWindowColorLevel;
316 LstWindowColorLevel.push_back( 1000 );
317 LstWindowColorLevel.push_back( 500 );
318 bbSetInputwxVtkBaseView( NULL );
319 bbSetInputwxVtkBaseView2( NULL );
320 bbSetInputwxVtkBaseView3( NULL );
321 bbSetInputInteractionType(0);
322 bbSetOutputWindowColorLevel( LstWindowColorLevel );
323 bbSetOutputDirection(2);
324 bbSetOutputInterpolation(true);
325 bbSetOutputvtkRenderer(NULL);
326 interactorwxvtkbaseview=NULL;
327 interactorwxvtkbaseview2=NULL;
328 interactorwxvtkbaseview3=NULL;
329 bbSetOutputInteractorwxVtkBaseView_model( interactorwxvtkbaseview );
330 bbSetOutputInteractorwxVtkBaseView_model2( interactorwxvtkbaseview2 );
331 bbSetOutputInteractorwxVtkBaseView_model3( interactorwxvtkbaseview3 );
335 // 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)
337 void wxVtkBaseView_Info::bbUserInitializeProcessing()
339 // THE INITIALIZATION METHOD BODY :
341 // but this is where you should allocate the internal/output pointers
343 bbSetOutputInteractorwxVtkBaseView_model(NULL);
344 bbSetOutputInteractorwxVtkBaseView_model2(NULL);
345 bbSetOutputInteractorwxVtkBaseView_model3(NULL);
349 // 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)
351 void wxVtkBaseView_Info::bbUserFinalizeProcessing()
353 // THE FINALIZATION METHOD BODY :
355 // but this is where you should desallocate the internal/output pointers
359 }// EO namespace bbcreaMaracasVisu