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 # ------------------------------------------------------------------------ */
28 #include "vtkInteractorStyleBaseView2D.h"
29 #include <vtkObjectFactory.h>
31 vtkStandardNewMacro(vtkInteractorStyleBaseView2D);
33 //---------------------------------------------------------------------------
34 vtkInteractorStyleBaseView2D::vtkInteractorStyleBaseView2D()
37 // RaC 04-2010 This mechanism of adding new functionalities has to be made externally in order
38 // to maintain a plugin architecture.
39 // Remember: The manualInteractorWindowLevel changes the window level over the image
40 // The vtkInteractorScrollZ changes the slice with right click interaction
41 // This vtkInteractorStyleBaseView2D gives the minimal interaction with a 2D scene
43 // _manualinteractorwindowlevel= new manualInteractorWindowLevel();
44 // AddInteractorStyleMaracas( _manualinteractorwindowlevel );
46 // _vtkInteractorScrollZ = new vtkInteractorScrollZ();
47 // AddInteractorStyleMaracas(_vtkInteractorScrollZ);
50 //---------------------------------------------------------------------------
51 vtkInteractorStyleBaseView2D::~vtkInteractorStyleBaseView2D()
55 //---------------------------------------------------------------------------
56 void vtkInteractorStyleBaseView2D::SetInteractorScrollZ(vtkInteractorScrollZ* interactorScroll)
58 _vtkInteractorScrollZ = interactorScroll;
59 AddInteractorStyleMaracas(_vtkInteractorScrollZ);
62 //---------------------------------------------------------------------------
63 void vtkInteractorStyleBaseView2D::SetInteractorWindowLevel(manualInteractorWindowLevel* interactorWindowLevel)
65 _manualinteractorwindowlevel = interactorWindowLevel;
66 AddInteractorStyleMaracas(_manualinteractorwindowlevel);
69 //---------------------------------------------------------------------------
70 void vtkInteractorStyleBaseView2D::OnRightButtonDown() // virtual
72 vtkInteractorStyleBaseView::OnRightButtonDown();
74 if ((GetInteractor()->GetControlKey()==1) && (GetInteractor()->GetShiftKey()==0) )
76 this->vtkInteractorStyleImage::OnRightButtonDown();
80 //---------------------------------------------------------------------------
81 void vtkInteractorStyleBaseView2D::OnRightButtonUp() // virtual
83 vtkInteractorStyleBaseView::OnRightButtonUp();
84 this->vtkInteractorStyleImage::OnRightButtonUp();
87 //---------------------------------------------------------------------------
88 void vtkInteractorStyleBaseView2D::OnMouseMove () // virtual
90 vtkInteractorStyleBaseView::OnMouseMove();
91 this->vtkInteractorStyleImage::OnMouseMove();
94 //---------------------------------------------------------------------------
95 void vtkInteractorStyleBaseView2D::OnLeftButtonDown() // virtual
97 vtkInteractorStyleBaseView::OnLeftButtonDown();
99 if ((GetInteractor()->GetControlKey()==0) && (GetInteractor()->GetShiftKey()==1) )
101 this->vtkInteractorStyleImage::OnLeftButtonDown();
105 //---------------------------------------------------------------------------
106 void vtkInteractorStyleBaseView2D::OnLeftButtonUp () // virtual
108 vtkInteractorStyleBaseView::OnLeftButtonUp();
110 this->vtkInteractorStyleImage::OnLeftButtonUp();
113 //---------------------------------------------------------------------------
114 void vtkInteractorStyleBaseView2D::OnMiddleButtonDown () // virtual
116 vtkInteractorStyleBaseView::OnMiddleButtonDown();
118 if ((GetInteractor()->GetControlKey()==1) || (GetInteractor()->GetShiftKey()==1) )
120 this->vtkInteractorStyleImage::OnLeftButtonDown();
124 //---------------------------------------------------------------------------
125 void vtkInteractorStyleBaseView2D::OnMiddleButtonUp () // virtual
127 vtkInteractorStyleBaseView::OnMiddleButtonUp();
129 if ((GetInteractor()->GetControlKey()==1) || (GetInteractor()->GetShiftKey()==1) )
131 this->vtkInteractorStyleImage::OnLeftButtonUp();
135 //---------------------------------------------------------------------------
136 void vtkInteractorStyleBaseView2D::OnMouseWheelForward () // virtual
138 vtkInteractorStyleBaseView::OnMouseWheelForward();
139 if ((GetInteractor()->GetControlKey()==0) || (GetInteractor()->GetShiftKey()==0) )
141 this->vtkInteractorStyleImage::OnMouseWheelForward();
145 //---------------------------------------------------------------------------
146 void vtkInteractorStyleBaseView2D::OnMouseWheelBackward () // virtual
148 vtkInteractorStyleBaseView::OnMouseWheelBackward();
149 if ((GetInteractor()->GetControlKey()==0) || (GetInteractor()->GetShiftKey()==0) )
151 this->vtkInteractorStyleImage::OnMouseWheelBackward();