1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
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
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.
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
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 # ------------------------------------------------------------------------ */
27 #include "vtkInteractorStyleBaseView3D.h"
29 #include "vtkObjectFactory.h"
31 vtkStandardNewMacro(vtkInteractorStyleBaseView3D);
33 //---------------------------------------------------------------------------
34 vtkInteractorStyleBaseView3D::vtkInteractorStyleBaseView3D(){
36 //---------------------------------------------------------------------------
37 vtkInteractorStyleBaseView3D::~vtkInteractorStyleBaseView3D(){
39 //---------------------------------------------------------------------------
40 void vtkInteractorStyleBaseView3D::OnRightButtonDown ()
42 vtkInteractorStyleBaseView::OnRightButtonDown();
45 if (GetInteractor()->GetControlKey()==1 ){
46 this->vtkInteractorStyleTrackballCamera::OnRightButtonDown();
49 this->FindPokedRenderer(this->Interactor->GetEventPosition()[0],
50 this->Interactor->GetEventPosition()[1]);
52 if (this->CurrentRenderer == NULL)
57 if (this->Interactor->GetControlKey()) {
62 //---------------------------------------------------------------------------
63 void vtkInteractorStyleBaseView3D::OnRightButtonUp ()
65 vtkInteractorStyleBaseView::OnRightButtonUp();
68 if (GetInteractor()->GetControlKey()==1 ){
69 this->vtkInteractorStyleTrackballCamera::OnRightButtonUp();
81 //---------------------------------------------------------------------------
82 void vtkInteractorStyleBaseView3D::OnMouseMove ()
84 vtkInteractorStyleBaseView::OnMouseMove();
86 // this->vtkInteractorStyleTrackballCamera::OnMouseMove();
88 // int x = this->Interactor->GetEventPosition()[0]; // JPRx
89 // int y = this->Interactor->GetEventPosition()[1]; // JPRx
92 // vtkRenderWindowInteractor *rwi = this->Interactor;
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
103 // this->FindPokedRenderer(x, y);
105 // this->InvokeEvent(vtkCommand::InteractionEvent, NULL);
109 // this->FindPokedRenderer(x, y);
111 // this->InvokeEvent(vtkCommand::InteractionEvent, NULL);
115 // this->FindPokedRenderer(x, y);
117 // this->InvokeEvent(vtkCommand::InteractionEvent, NULL);
121 // this->FindPokedRenderer(x, y);
123 // this->InvokeEvent(vtkCommand::InteractionEvent, NULL);
130 //---------------------------------------------------------------------------
131 void vtkInteractorStyleBaseView3D::OnLeftButtonDown()
133 // printf("EED creaMaracasVisu::vtkInteractorStyleBaseView3D::OnLeftButtonDown \n");
134 vtkInteractorStyleBaseView::OnLeftButtonDown();
136 if (GetInteractor()->GetControlKey()==1 ){
137 this->vtkInteractorStyleTrackballCamera::OnMiddleButtonDown();
139 this->vtkInteractorStyleTrackballCamera::OnLeftButtonDown();
144 this->FindPokedRenderer(this->Interactor->GetEventPosition()[0],
145 this->Interactor->GetEventPosition()[1]);
146 if (this->CurrentRenderer == NULL)
152 if ((GetInteractor()->GetControlKey()==0) && (GetInteractor()->GetShiftKey()==1) )
154 this->vtkInteractorStyleImage::OnLeftButtonDown();
158 if (this->Interactor->GetControlKey()) {
168 if (this->Interactor->GetShiftKey())
170 if (this->Interactor->GetControlKey())
181 if (this->Interactor->GetControlKey())
194 //---------------------------------------------------------------------------
195 void vtkInteractorStyleBaseView3D::OnLeftButtonUp ()
197 vtkInteractorStyleBaseView::OnLeftButtonUp();
200 if (GetInteractor()->GetControlKey()==1 ){
201 this->vtkInteractorStyleTrackballCamera::OnMiddleButtonUp();
203 this->vtkInteractorStyleTrackballCamera::OnLeftButtonUp();
218 //---------------------------------------------------------------------------
219 void vtkInteractorStyleBaseView3D::OnMiddleButtonDown ()
221 vtkInteractorStyleBaseView::OnMiddleButtonDown();
222 // this->vtkInteractorStyleTrackballCamera::OnMiddleButtonDown();
224 //---------------------------------------------------------------------------
225 void vtkInteractorStyleBaseView3D::OnMiddleButtonUp ()
227 vtkInteractorStyleBaseView::OnMiddleButtonUp();
229 // this->vtkInteractorStyleTrackballCamera::OnMiddleButtonUp();
233 //---------------------------------------------------------------------------
234 void vtkInteractorStyleBaseView3D::OnMouseWheelForward () // virtual
236 vtkInteractorStyleBaseView::OnMouseWheelForward();
237 if ((GetInteractor()->GetControlKey()==0) || (GetInteractor()->GetShiftKey()==0) )
239 this->vtkInteractorStyleImage::OnMouseWheelForward();
243 //---------------------------------------------------------------------------
244 void vtkInteractorStyleBaseView3D::OnMouseWheelBackward () // virtual
246 vtkInteractorStyleBaseView::OnMouseWheelBackward();
247 if ((GetInteractor()->GetControlKey()==0) || (GetInteractor()->GetShiftKey()==0) )
249 this->vtkInteractorStyleImage::OnMouseWheelBackward();