]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleBaseView3D.cxx
Support #1768 CREATIS Licence insertion
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / vtkInteractorStyleBaseView3D.cxx
1 /*# ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 #                        pour la Sant�)
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
8 #
9 #  This software is governed by the CeCILL-B license under French law and
10 #  abiding by the rules of distribution of free software. You can  use,
11 #  modify and/ or redistribute the software under the terms of the CeCILL-B
12 #  license as circulated by CEA, CNRS and INRIA at the following URL
13 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 #  or in the file LICENSE.txt.
15 #
16 #  As a counterpart to the access to the source code and  rights to copy,
17 #  modify and redistribute granted by the license, users are provided only
18 #  with a limited warranty  and the software's author,  the holder of the
19 #  economic rights,  and the successive licensors  have only  limited
20 #  liability.
21 #
22 #  The fact that you are presently reading this means that you have had
23 #  knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
25
26
27 #include "vtkInteractorStyleBaseView3D.h"
28
29 #include "vtkObjectFactory.h"
30
31 vtkStandardNewMacro(vtkInteractorStyleBaseView3D);
32
33 //---------------------------------------------------------------------------
34 vtkInteractorStyleBaseView3D::vtkInteractorStyleBaseView3D(){
35 }
36 //---------------------------------------------------------------------------
37 vtkInteractorStyleBaseView3D::~vtkInteractorStyleBaseView3D(){
38 }
39 //---------------------------------------------------------------------------
40 void  vtkInteractorStyleBaseView3D::OnRightButtonDown ()
41 {    
42         vtkInteractorStyleBaseView::OnRightButtonDown();
43
44 /*
45                 if (GetInteractor()->GetControlKey()==1 ){
46                         this->vtkInteractorStyleTrackballCamera::OnRightButtonDown();
47                 }
48 */
49   this->FindPokedRenderer(this->Interactor->GetEventPosition()[0], 
50                           this->Interactor->GetEventPosition()[1]);
51
52   if (this->CurrentRenderer == NULL)
53     {
54     return;
55     }
56
57   if (this->Interactor->GetControlKey()) {
58       this->StartDolly();
59   }
60
61 }
62 //---------------------------------------------------------------------------
63 void  vtkInteractorStyleBaseView3D::OnRightButtonUp () 
64 {
65         vtkInteractorStyleBaseView::OnRightButtonUp();
66
67 /*
68                 if (GetInteractor()->GetControlKey()==1 ){
69                         this->vtkInteractorStyleTrackballCamera::OnRightButtonUp();
70                 }
71 */
72
73                 
74   switch (this->State) 
75     {
76     case VTKIS_DOLLY:
77       this->EndDolly();
78       break;
79     }
80 }
81 //---------------------------------------------------------------------------
82 void  vtkInteractorStyleBaseView3D::OnMouseMove () 
83 {
84         vtkInteractorStyleBaseView::OnMouseMove();
85
86 //              this->vtkInteractorStyleTrackballCamera::OnMouseMove();
87
88  // int x = this->Interactor->GetEventPosition()[0]; // JPRx
89  // int y = this->Interactor->GetEventPosition()[1]; // JPRx
90
91
92  // vtkRenderWindowInteractor *rwi = this->Interactor;
93
94  // int lx =  rwi->GetLastEventPosition()[0]; // JPRx
95  // int ly =  rwi->GetLastEventPosition()[1]; // JPRx
96  // int dx = rwi->GetEventPosition()[0] ; // JPRx
97  // int dy = rwi->GetEventPosition()[1] ; // JPRx
98
99
100   switch (this->State) 
101     {
102     case VTKIS_ROTATE:
103  //     this->FindPokedRenderer(x, y);
104       this->Rotate();
105  //     this->InvokeEvent(vtkCommand::InteractionEvent, NULL);
106       break;
107
108     case VTKIS_PAN:
109  //     this->FindPokedRenderer(x, y);
110       this->Pan();
111  //     this->InvokeEvent(vtkCommand::InteractionEvent, NULL);
112       break;
113
114     case VTKIS_DOLLY:
115  //     this->FindPokedRenderer(x, y);
116       this->Dolly();
117  //     this->InvokeEvent(vtkCommand::InteractionEvent, NULL);
118       break;
119
120     case VTKIS_SPIN:
121  //     this->FindPokedRenderer(x, y);
122       this->Spin();
123  //     this->InvokeEvent(vtkCommand::InteractionEvent, NULL);
124       break;
125     }
126
127
128
129 }
130 //---------------------------------------------------------------------------
131 void vtkInteractorStyleBaseView3D::OnLeftButtonDown()
132 {
133 //      printf("EED creaMaracasVisu::vtkInteractorStyleBaseView3D::OnLeftButtonDown \n");
134         vtkInteractorStyleBaseView::OnLeftButtonDown();
135 /*
136                 if (GetInteractor()->GetControlKey()==1 ){
137                         this->vtkInteractorStyleTrackballCamera::OnMiddleButtonDown();
138                 } else {
139                         this->vtkInteractorStyleTrackballCamera::OnLeftButtonDown();
140                 }
141 */
142
143
144   this->FindPokedRenderer(this->Interactor->GetEventPosition()[0], 
145                           this->Interactor->GetEventPosition()[1]);
146   if (this->CurrentRenderer == NULL)
147     {
148     return;
149     }
150
151         
152         if ((GetInteractor()->GetControlKey()==0) && (GetInteractor()->GetShiftKey()==1) )
153         {
154                 this->vtkInteractorStyleImage::OnLeftButtonDown();
155         }
156         
157         
158   if (this->Interactor->GetControlKey()) {
159       this->StartPan();
160   } else {
161       this->StartRotate();
162   }
163
164         
165         
166
167  /* 
168   if (this->Interactor->GetShiftKey()) 
169     {
170     if (this->Interactor->GetControlKey()) 
171       {
172       this->StartDolly();
173       }
174     else 
175       {
176       this->StartPan();
177       }
178     } 
179   else 
180     {
181     if (this->Interactor->GetControlKey()) 
182       {
183       this->StartSpin();
184       }
185     else 
186       {
187       this->StartRotate();
188       }
189     }
190 */
191
192
193 }
194 //---------------------------------------------------------------------------
195 void  vtkInteractorStyleBaseView3D::OnLeftButtonUp () 
196 {
197         vtkInteractorStyleBaseView::OnLeftButtonUp();
198
199 /*
200                 if (GetInteractor()->GetControlKey()==1 ){
201                         this->vtkInteractorStyleTrackballCamera::OnMiddleButtonUp();
202                 } else {
203                         this->vtkInteractorStyleTrackballCamera::OnLeftButtonUp();
204                 }
205 */
206   switch (this->State) 
207     {
208
209     case VTKIS_PAN:
210       this->EndPan();
211       break;
212
213     case VTKIS_ROTATE:
214       this->EndRotate();
215       break;
216     }
217 }
218 //---------------------------------------------------------------------------
219 void  vtkInteractorStyleBaseView3D::OnMiddleButtonDown () 
220 {
221         vtkInteractorStyleBaseView::OnMiddleButtonDown();
222         //              this->vtkInteractorStyleTrackballCamera::OnMiddleButtonDown();
223 }
224 //---------------------------------------------------------------------------
225 void  vtkInteractorStyleBaseView3D::OnMiddleButtonUp () 
226 {
227         vtkInteractorStyleBaseView::OnMiddleButtonUp();
228
229         //              this->vtkInteractorStyleTrackballCamera::OnMiddleButtonUp();
230 }
231
232
233 //---------------------------------------------------------------------------
234 void vtkInteractorStyleBaseView3D::OnMouseWheelForward () // virtual
235 {
236         vtkInteractorStyleBaseView::OnMouseWheelForward();      
237         if ((GetInteractor()->GetControlKey()==0) || (GetInteractor()->GetShiftKey()==0) )
238         {
239                 this->vtkInteractorStyleImage::OnMouseWheelForward();
240         }
241 }
242
243 //---------------------------------------------------------------------------
244 void vtkInteractorStyleBaseView3D::OnMouseWheelBackward () // virtual
245 {
246         vtkInteractorStyleBaseView::OnMouseWheelBackward();     
247         if ((GetInteractor()->GetControlKey()==0) || (GetInteractor()->GetShiftKey()==0) )
248         {
249                 this->vtkInteractorStyleImage::OnMouseWheelBackward();
250         }
251 }