]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleBaseView3D.cxx
067ceb91c0bc842400221c19aa2694cb4f2793cd
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / vtkInteractorStyleBaseView3D.cxx
1
2 #include "vtkInteractorStyleBaseView3D.h"
3
4 #include "vtkObjectFactory.h"
5
6 vtkStandardNewMacro(vtkInteractorStyleBaseView3D);
7
8 //---------------------------------------------------------------------------
9 vtkInteractorStyleBaseView3D::vtkInteractorStyleBaseView3D(){
10 }
11 //---------------------------------------------------------------------------
12 vtkInteractorStyleBaseView3D::~vtkInteractorStyleBaseView3D(){
13 }
14 //---------------------------------------------------------------------------
15 void  vtkInteractorStyleBaseView3D::OnRightButtonDown ()
16 {    
17         vtkInteractorStyleBaseView::OnRightButtonDown();
18
19 /*
20                 if (GetInteractor()->GetControlKey()==1 ){
21                         this->vtkInteractorStyleTrackballCamera::OnRightButtonDown();
22                 }
23 */
24   this->FindPokedRenderer(this->Interactor->GetEventPosition()[0], 
25                           this->Interactor->GetEventPosition()[1]);
26
27   if (this->CurrentRenderer == NULL)
28     {
29     return;
30     }
31
32   if (this->Interactor->GetControlKey()) {
33       this->StartDolly();
34   }
35
36 }
37 //---------------------------------------------------------------------------
38 void  vtkInteractorStyleBaseView3D::OnRightButtonUp () 
39 {
40         vtkInteractorStyleBaseView::OnRightButtonUp();
41
42 /*
43                 if (GetInteractor()->GetControlKey()==1 ){
44                         this->vtkInteractorStyleTrackballCamera::OnRightButtonUp();
45                 }
46 */
47
48                 
49   switch (this->State) 
50     {
51     case VTKIS_DOLLY:
52       this->EndDolly();
53       break;
54     }
55 }
56 //---------------------------------------------------------------------------
57 void  vtkInteractorStyleBaseView3D::OnMouseMove () 
58 {
59         vtkInteractorStyleBaseView::OnMouseMove();
60
61 //              this->vtkInteractorStyleTrackballCamera::OnMouseMove();
62
63  // int x = this->Interactor->GetEventPosition()[0]; // JPRx
64  // int y = this->Interactor->GetEventPosition()[1]; // JPRx
65
66
67  // vtkRenderWindowInteractor *rwi = this->Interactor;
68
69  // int lx =  rwi->GetLastEventPosition()[0]; // JPRx
70  // int ly =  rwi->GetLastEventPosition()[1]; // JPRx
71  // int dx = rwi->GetEventPosition()[0] ; // JPRx
72  // int dy = rwi->GetEventPosition()[1] ; // JPRx
73
74
75   switch (this->State) 
76     {
77     case VTKIS_ROTATE:
78  //     this->FindPokedRenderer(x, y);
79       this->Rotate();
80  //     this->InvokeEvent(vtkCommand::InteractionEvent, NULL);
81       break;
82
83     case VTKIS_PAN:
84  //     this->FindPokedRenderer(x, y);
85       this->Pan();
86  //     this->InvokeEvent(vtkCommand::InteractionEvent, NULL);
87       break;
88
89     case VTKIS_DOLLY:
90  //     this->FindPokedRenderer(x, y);
91       this->Dolly();
92  //     this->InvokeEvent(vtkCommand::InteractionEvent, NULL);
93       break;
94
95     case VTKIS_SPIN:
96  //     this->FindPokedRenderer(x, y);
97       this->Spin();
98  //     this->InvokeEvent(vtkCommand::InteractionEvent, NULL);
99       break;
100     }
101
102
103
104 }
105 //---------------------------------------------------------------------------
106 void vtkInteractorStyleBaseView3D::OnLeftButtonDown()
107 {
108 //      printf("EED creaMaracasVisu::vtkInteractorStyleBaseView3D::OnLeftButtonDown \n");
109         vtkInteractorStyleBaseView::OnLeftButtonDown();
110 /*
111                 if (GetInteractor()->GetControlKey()==1 ){
112                         this->vtkInteractorStyleTrackballCamera::OnMiddleButtonDown();
113                 } else {
114                         this->vtkInteractorStyleTrackballCamera::OnLeftButtonDown();
115                 }
116 */
117
118
119   this->FindPokedRenderer(this->Interactor->GetEventPosition()[0], 
120                           this->Interactor->GetEventPosition()[1]);
121   if (this->CurrentRenderer == NULL)
122     {
123     return;
124     }
125
126         
127         if ((GetInteractor()->GetControlKey()==0) && (GetInteractor()->GetShiftKey()==1) )
128         {
129                 this->vtkInteractorStyleImage::OnLeftButtonDown();
130         }
131         
132         
133   if (this->Interactor->GetControlKey()) {
134       this->StartPan();
135   } else {
136       this->StartRotate();
137   }
138
139         
140         
141
142  /* 
143   if (this->Interactor->GetShiftKey()) 
144     {
145     if (this->Interactor->GetControlKey()) 
146       {
147       this->StartDolly();
148       }
149     else 
150       {
151       this->StartPan();
152       }
153     } 
154   else 
155     {
156     if (this->Interactor->GetControlKey()) 
157       {
158       this->StartSpin();
159       }
160     else 
161       {
162       this->StartRotate();
163       }
164     }
165 */
166
167
168 }
169 //---------------------------------------------------------------------------
170 void  vtkInteractorStyleBaseView3D::OnLeftButtonUp () 
171 {
172         vtkInteractorStyleBaseView::OnLeftButtonUp();
173
174 /*
175                 if (GetInteractor()->GetControlKey()==1 ){
176                         this->vtkInteractorStyleTrackballCamera::OnMiddleButtonUp();
177                 } else {
178                         this->vtkInteractorStyleTrackballCamera::OnLeftButtonUp();
179                 }
180 */
181   switch (this->State) 
182     {
183
184     case VTKIS_PAN:
185       this->EndPan();
186       break;
187
188     case VTKIS_ROTATE:
189       this->EndRotate();
190       break;
191     }
192 }
193 //---------------------------------------------------------------------------
194 void  vtkInteractorStyleBaseView3D::OnMiddleButtonDown () 
195 {
196         vtkInteractorStyleBaseView::OnMiddleButtonDown();
197         //              this->vtkInteractorStyleTrackballCamera::OnMiddleButtonDown();
198 }
199 //---------------------------------------------------------------------------
200 void  vtkInteractorStyleBaseView3D::OnMiddleButtonUp () 
201 {
202         vtkInteractorStyleBaseView::OnMiddleButtonUp();
203
204         //              this->vtkInteractorStyleTrackballCamera::OnMiddleButtonUp();
205 }
206
207
208 //---------------------------------------------------------------------------
209 void vtkInteractorStyleBaseView3D::OnMouseWheelForward () // virtual
210 {
211         vtkInteractorStyleBaseView::OnMouseWheelForward();      
212         if ((GetInteractor()->GetControlKey()==0) || (GetInteractor()->GetShiftKey()==0) )
213         {
214                 this->vtkInteractorStyleImage::OnMouseWheelForward();
215         }
216 }
217
218 //---------------------------------------------------------------------------
219 void vtkInteractorStyleBaseView3D::OnMouseWheelBackward () // virtual
220 {
221         vtkInteractorStyleBaseView::OnMouseWheelBackward();     
222         if ((GetInteractor()->GetControlKey()==0) || (GetInteractor()->GetShiftKey()==0) )
223         {
224                 this->vtkInteractorStyleImage::OnMouseWheelBackward();
225         }
226 }