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 printf("EED InteractorwxVtkBaseView::OnLeftButtonDown \n");
54 if ( _box->bbGetInputInteractionType()==8 )
56 printf("EED InteractorwxVtkBaseView::OnLeftButtonDown 1\n");
59 if ( (_box->bbGetInputInteractionType()==1 ) && (_wxvtkbaseview!=NULL) )
61 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
62 _box->bbSignalOutputModification();
68 bool InteractorwxVtkBaseView::OnLeftButtonUp()
70 printf("EED InteractorwxVtkBaseView::OnLeftButtonUp \n");
71 if ( _box->bbGetInputInteractionType()==8 )
73 printf("EED InteractorwxVtkBaseView::OnLeftButtonUp 1\n");
76 if ( (_box->bbGetInputInteractionType()==2 ) && (_wxvtkbaseview!=NULL) )
78 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
79 _box->bbSignalOutputModification();
85 bool InteractorwxVtkBaseView::OnMouseMove()
88 if (flagDrag==true) intFlag=1; else intFlag=0;
89 printf("EED InteractorwxVtkBaseView::OnMouseMove Start this=%p type=%d flag=%d\n", this, _box->bbGetInputInteractionType() ,intFlag);
91 if ( (_box->bbGetInputInteractionType()==3 ) && (_wxvtkbaseview!=NULL) )
94 } // if InteractionType 3
95 if (( _box->bbGetInputInteractionType()==8 ) && (flagDrag==true) )
98 } // if InteractionType 8
99 if (( _box->bbGetInputInteractionType()==9 ) && (flagDrag==true) )
102 } // if InteractionType 9
105 printf("EED InteractorwxVtkBaseView::OnMouseMove 1\n");
106 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
107 _box->bbSignalOutputModification();
110 printf("EED InteractorwxVtkBaseView::OnMouseMove End\n");
114 bool InteractorwxVtkBaseView::OnRightButtonDown()
116 if ( _box->bbGetInputInteractionType()==9 )
120 if ( (_box->bbGetInputInteractionType()==4 ) && (_wxvtkbaseview!=NULL) )
122 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
123 _box->bbSignalOutputModification();
129 bool InteractorwxVtkBaseView::OnRightButtonUp()
131 if ( _box->bbGetInputInteractionType()==9 )
135 if ( (_box->bbGetInputInteractionType()==5 ) && (_wxvtkbaseview!=NULL) )
137 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
138 _box->bbSignalOutputModification();
145 bool InteractorwxVtkBaseView::OnLeftDClick()
147 printf("EED InteractorwxVtkBaseView::OnLeftDClick Start this=%p\n", this);
148 if ( (_box->bbGetInputInteractionType()==6 ) && (_wxvtkbaseview!=NULL) )
150 printf("EED InteractorwxVtkBaseView::OnLeftDClick 1\n");
151 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
152 _box->bbSignalOutputModification();
158 bool InteractorwxVtkBaseView::OnRightDClick()
160 printf("EED InteractorwxVtkBaseView::OnRightDClick Start\n");
161 if ( (_box->bbGetInputInteractionType()==7 ) && (_wxvtkbaseview!=NULL) )
163 printf("EED InteractorwxVtkBaseView::OnRightDClick 1\n");
164 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
165 _box->bbSignalOutputModification();
172 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,wxVtkBaseView_Info)
173 BBTK_BLACK_BOX_IMPLEMENTATION(wxVtkBaseView_Info,bbtk::AtomicBlackBox);
176 void wxVtkBaseView_Info::SetwxVtkBaseViewOutputs(wxVtkBaseView *wxvtkbaseview )
178 if (wxvtkbaseview!=NULL)
180 printf("EED wxVtkBaseView_Info::SetwxVtkBaseViewOutputs this=%p\n",this);
181 printf("EED wxVtkBaseView_Info::SetwxVtkBaseViewOutputs %s \n", bbGetFullName().c_str() );
182 bbSetOutputvtkRenderer( wxvtkbaseview->GetRenderer() );
183 bbSetOutputDirection( wxvtkbaseview->GetDirection() );
184 vtkBaseData *vtkbasedata = wxvtkbaseview->GetVtkBaseData();
185 if (vtkbasedata!=NULL)
187 marImageData *marimagedata = vtkbasedata->GetMarImageData();
188 if (marimagedata!=NULL)
190 bbSetOutputImage( marimagedata->GetImageData() );
192 std::vector<double> LstWindowColorLevel;
193 LstWindowColorLevel.push_back( vtkbasedata->GetColorWindow() );
194 LstWindowColorLevel.push_back( vtkbasedata->GetColorLevel() );
195 bbSetOutputWindowColorLevel( LstWindowColorLevel );
197 std::vector<double> lstPoint;
198 lstPoint.push_back( vtkbasedata->GetX() );
199 lstPoint.push_back( vtkbasedata->GetY() );
200 lstPoint.push_back( vtkbasedata->GetZ() );
201 bbSetOutputPoint( lstPoint );
202 printf("EED wxVtkBaseView_Info::SetwxVtkBaseViewOutputs point = %f %f %f\n",lstPoint[0],lstPoint[1],lstPoint[2] );
205 std::vector<double> lstNormal;
206 wxvtkbaseview->GetNormal( normal );
207 lstNormal.push_back( normal[0] );
208 lstNormal.push_back( normal[1] );
209 lstNormal.push_back( normal[2] );
210 bbSetOutputNormal( lstNormal );
212 bbSetOutputInterpolation( vtkbasedata->GetInterpolate() );
214 } // if wxvtkbaseview
218 // 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)
220 void wxVtkBaseView_Info::Process()
222 // THE MAIN PROCESSING METHOD BODY
223 // Here we simply set the input 'In' value to the output 'Out'
224 // And print out the output value
225 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
226 // void bbSet{Input|Output}NAME(const TYPE&)
227 // const TYPE& bbGet{Input|Output}NAME() const
229 // * NAME is the name of the input/output
230 // (the one provided in the attribute 'name' of the tag 'input')
231 // * TYPE is the C++ type of the input/output
232 // (the one provided in the attribute 'type' of the tag 'input')
236 printf("EED wxVtkBaseView_Info::Process Start\n");
238 if (bbGetInputInteractionType()==0)
240 SetwxVtkBaseViewOutputs( bbGetInputwxVtkBaseView() );
246 if (bbGetInputInteractionType()!=0)
248 SetwxVtkBaseViewOutputs( bbGetInputwxVtkBaseView() );
250 if (bbGetInputwxVtkBaseView()!=NULL)
252 InteractorwxVtkBaseView *interactorwxvtkbaseview = new InteractorwxVtkBaseView( this, bbGetInputwxVtkBaseView() );
253 vtkInteractorStyleBaseView *vtkinteractorstylebaseview = (vtkInteractorStyleBaseView*) (bbGetInputwxVtkBaseView()->GetInteractorStyleBaseView() );
254 vtkinteractorstylebaseview->AddInteractorStyleMaracas( interactorwxvtkbaseview );
255 } // if wxVtkBaseView
256 if (bbGetInputwxVtkBaseView2()!=NULL)
258 InteractorwxVtkBaseView *interactorwxvtkbaseview = new InteractorwxVtkBaseView( this, bbGetInputwxVtkBaseView2() );
259 vtkInteractorStyleBaseView *vtkinteractorstylebaseview = (vtkInteractorStyleBaseView*) (bbGetInputwxVtkBaseView2()->GetInteractorStyleBaseView() );
260 vtkinteractorstylebaseview->AddInteractorStyleMaracas( interactorwxvtkbaseview );
261 } // if wxVtkBaseView2
262 if (bbGetInputwxVtkBaseView3()!=NULL)
264 InteractorwxVtkBaseView *interactorwxvtkbaseview = new InteractorwxVtkBaseView( this, bbGetInputwxVtkBaseView3() );
265 vtkInteractorStyleBaseView *vtkinteractorstylebaseview = (vtkInteractorStyleBaseView*) (bbGetInputwxVtkBaseView3()->GetInteractorStyleBaseView() );
266 vtkinteractorstylebaseview->AddInteractorStyleMaracas( interactorwxvtkbaseview );
267 } // if wxVtkBaseView3
268 } // if InteractionType !=0
271 printf("EED wxVtkBaseView_Info::Process end\n");
276 // 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)
278 void wxVtkBaseView_Info::bbUserSetDefaultValues()
280 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
281 // Here we initialize the input 'In' to 0
283 std::vector<double> LstWindowColorLevel;
284 LstWindowColorLevel.push_back( 1000 );
285 LstWindowColorLevel.push_back( 500 );
286 bbSetInputwxVtkBaseView( NULL );
287 bbSetInputwxVtkBaseView2( NULL );
288 bbSetInputwxVtkBaseView3( NULL );
289 bbSetInputInteractionType(0);
290 bbSetOutputWindowColorLevel( LstWindowColorLevel );
291 bbSetOutputDirection(2);
292 bbSetOutputInterpolation(true);
293 bbSetOutputvtkRenderer(NULL);
297 // 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)
299 void wxVtkBaseView_Info::bbUserInitializeProcessing()
301 // THE INITIALIZATION METHOD BODY :
303 // but this is where you should allocate the internal/output pointers
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::bbUserFinalizeProcessing()
312 // THE FINALIZATION METHOD BODY :
314 // but this is where you should desallocate the internal/output pointers
318 }// EO namespace bbcreaMaracasVisu