]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleBaseView2D.cxx
#3418 creaMaracasVisu Feature New Normal - ManualPaint_model with openmp
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / vtkInteractorStyleBaseView2D.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
28 #include "vtkInteractorStyleBaseView2D.h"
29 #include <vtkObjectFactory.h>
30
31 vtkStandardNewMacro(vtkInteractorStyleBaseView2D);
32
33 //---------------------------------------------------------------------------
34 vtkInteractorStyleBaseView2D::vtkInteractorStyleBaseView2D()
35 {
36         ////////////
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
42         //
43         // _manualinteractorwindowlevel= new manualInteractorWindowLevel();
44         // AddInteractorStyleMaracas( _manualinteractorwindowlevel );
45         //
46         // _vtkInteractorScrollZ = new vtkInteractorScrollZ();
47         // AddInteractorStyleMaracas(_vtkInteractorScrollZ);
48         //
49         //_vtkInteractorZoomCamera = interactorZoomcamera;
50         //AddInteractorStyleMaracas(_vtkInteractorZoomCamera);
51         //
52         //
53         ////////////
54 }
55 //---------------------------------------------------------------------------
56 vtkInteractorStyleBaseView2D::~vtkInteractorStyleBaseView2D()
57 {
58 }
59
60 //---------------------------------------------------------------------------
61 void  vtkInteractorStyleBaseView2D::SetInteractorScrollZ(vtkInteractorScrollZ* interactorScroll)
62 {    
63         _vtkInteractorScrollZ = interactorScroll;
64         AddInteractorStyleMaracas(_vtkInteractorScrollZ);
65 }
66
67 //---------------------------------------------------------------------------
68 void  vtkInteractorStyleBaseView2D::SetInteractorWindowLevel(manualInteractorWindowLevel* interactorWindowLevel)
69 {    
70         _manualinteractorwindowlevel = interactorWindowLevel;
71         AddInteractorStyleMaracas(_manualinteractorwindowlevel);
72 }
73
74
75 //---------------------------------------------------------------------------
76 void  vtkInteractorStyleBaseView2D::SetInteractorZoomCamera(vtkInteractorZoomCamera* interactorZoomcamera)
77 {    
78         _vtkInteractorZoomCamera = interactorZoomcamera;
79         AddInteractorStyleMaracas(_vtkInteractorZoomCamera);
80 }
81
82
83 //---------------------------------------------------------------------------
84 void  vtkInteractorStyleBaseView2D::OnRightButtonDown()  // virtual
85 {    
86         vtkInteractorStyleBaseView::OnRightButtonDown();
87
88         if ((GetInteractor()->GetControlKey()==1) && (GetInteractor()->GetShiftKey()==0) )
89         {
90                 this->vtkInteractorStyleImage::OnRightButtonDown();
91         }
92 }
93
94 //---------------------------------------------------------------------------
95 void  vtkInteractorStyleBaseView2D::OnRightButtonUp()  // virtual
96 {
97         vtkInteractorStyleBaseView::OnRightButtonUp();
98         this->vtkInteractorStyleImage::OnRightButtonUp();
99 }
100
101 //---------------------------------------------------------------------------
102 void  vtkInteractorStyleBaseView2D::OnMouseMove () // virtual
103 {
104         vtkInteractorStyleBaseView::OnMouseMove();
105         this->vtkInteractorStyleImage::OnMouseMove();
106 }
107
108 //---------------------------------------------------------------------------
109 void  vtkInteractorStyleBaseView2D::OnLeftButtonDown() // virtual
110 {
111         vtkInteractorStyleBaseView::OnLeftButtonDown();
112
113         if ((GetInteractor()->GetControlKey()==0) && (GetInteractor()->GetShiftKey()==1) )
114         {
115                 this->vtkInteractorStyleImage::OnLeftButtonDown();
116         }
117 }
118
119 //---------------------------------------------------------------------------
120 void  vtkInteractorStyleBaseView2D::OnLeftButtonUp () // virtual
121 {
122         vtkInteractorStyleBaseView::OnLeftButtonUp();
123
124         this->vtkInteractorStyleImage::OnLeftButtonUp();
125 }
126
127 //---------------------------------------------------------------------------
128 void  vtkInteractorStyleBaseView2D::OnMiddleButtonDown () // virtual
129 {
130         vtkInteractorStyleBaseView::OnMiddleButtonDown();
131
132         if ((GetInteractor()->GetControlKey()==1) || (GetInteractor()->GetShiftKey()==1) )
133         {
134                 this->vtkInteractorStyleImage::OnLeftButtonDown();
135         }
136 }
137
138 //---------------------------------------------------------------------------
139 void vtkInteractorStyleBaseView2D::OnMiddleButtonUp () // virtual
140 {
141         vtkInteractorStyleBaseView::OnMiddleButtonUp();
142
143         if ((GetInteractor()->GetControlKey()==1) || (GetInteractor()->GetShiftKey()==1) )
144         {
145                 this->vtkInteractorStyleImage::OnLeftButtonUp();
146         }
147 }
148
149 //---------------------------------------------------------------------------
150 void vtkInteractorStyleBaseView2D::OnMouseWheelForward () // virtual
151 {
152         vtkInteractorStyleBaseView::OnMouseWheelForward();      
153         if ((GetInteractor()->GetControlKey()==0) || (GetInteractor()->GetShiftKey()==0) )
154         {
155                 this->vtkInteractorStyleImage::OnMouseWheelForward();
156         }
157 }
158
159 //---------------------------------------------------------------------------
160 void vtkInteractorStyleBaseView2D::OnMouseWheelBackward () // virtual
161 {
162         vtkInteractorStyleBaseView::OnMouseWheelBackward();     
163         if ((GetInteractor()->GetControlKey()==0) || (GetInteractor()->GetShiftKey()==0) )
164         {
165                 this->vtkInteractorStyleImage::OnMouseWheelBackward();
166         }
167 }
168
169