1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // SALOME VTKViewer : build VTK viewer into Salome desktop
23 // File : VVTK_InteractorStyle.h
24 // Author : Christophe ATTANASIO
28 #ifndef __VVTK_InteractorStyle_h
29 #define __VVTK_InteractorStyle_h
34 #include "SVTK_InteractorStyle.h"
36 //-------------------------------------------
37 //! Control the value of increment in new style of interaction.
39 This class controls of value of increment,
40 for pan/rotate/zoom operations in new style
43 class VVTK_ControllerIncrement : public SVTK_ControllerIncrement {
45 vtkTypeMacro(VVTK_ControllerIncrement,SVTK_ControllerIncrement);
46 static VVTK_ControllerIncrement* New();
48 //! Increace the increment value by multiplying on 2
49 virtual int Increase();
51 //! Decreace the increment value by division on 2
52 virtual int Decrease();
55 VVTK_ControllerIncrement();
56 virtual ~VVTK_ControllerIncrement();
59 VVTK_ControllerIncrement(const VVTK_ControllerIncrement&); //Not implemented
60 void operator=(const VVTK_ControllerIncrement&); //Not implemented
63 //-------------------------------------------
64 //! Control the behaviour of KeyDown event in new style of interaction.
66 This class controls of behaviour of of KeyDown event
67 in new style of interaction.
69 class VVTK_ControllerOnKeyDown : public SVTK_ControllerOnKeyDown{
71 vtkTypeMacro(VVTK_ControllerOnKeyDown, SVTK_ControllerOnKeyDown);
72 static VVTK_ControllerOnKeyDown* New();
74 //! Provides the action on event
75 virtual bool OnKeyDown(vtkInteractorStyle* );
78 VVTK_ControllerOnKeyDown();
79 virtual ~VVTK_ControllerOnKeyDown();
82 VVTK_ControllerOnKeyDown(const VVTK_ControllerOnKeyDown&);//Not implemented
83 void operator=(const VVTK_ControllerOnKeyDown&); //Not implemented
87 //! Introduce new style of interaction (keyboard free)
88 class VVTK_EXPORT VVTK_InteractorStyle : public SVTK_InteractorStyle
91 static VVTK_InteractorStyle *New();
92 vtkTypeMacro(VVTK_InteractorStyle,SVTK_InteractorStyle);
94 //! Redefined from SVTK_InteractorStyle::SetInteractor in order to add an observer (callback) for custorm event (space mouse event)
97 SetInteractor( vtkRenderWindowInteractor* );
100 VVTK_InteractorStyle();
101 ~VVTK_InteractorStyle();
103 VVTK_InteractorStyle(const VVTK_InteractorStyle&); // Not implemented
104 void operator=(const VVTK_InteractorStyle&); // Not implemented
106 // Generic event bindings must be overridden in subclasses
108 //! Redefine SVTK_InteractorStyle::OnLeftButtonDown
109 virtual void OnLeftButtonDown(int ctrl, int shift, int x, int y);
111 //! Redefine SVTK_InteractorStyle::OnMiddleButtonDown
112 virtual void OnMiddleButtonDown(int ctrl, int shift, int x, int y);
114 //! Redefine SVTK_InteractorStyle::OnLeftButtonUp
115 virtual void OnLeftButtonUp(int ctrl, int shift, int x, int y);
117 //! Redefine SVTK_InteractorStyle::OnMiddleButtonUp
118 virtual void OnMiddleButtonUp(int ctrl, int shift, int x, int y);
120 //! Redefine SVTK_InteractorStyle::onFinishOperation
121 virtual void onFinishOperation();
123 //! Main process VTK event method
126 ProcessEvents(vtkObject* object,
131 //! Redefine SVTK_InteractorStyle::onSpaceMouseButton
132 virtual void onSpaceMouseButton( int button );
134 //! To decrease magnification of the Gauss Points
135 void DecreaseGaussPointMagnification();
137 //! To increase magnification of the Gauss Points
138 void IncreaseGaussPointMagnification();
140 //! SpaceMouse short cuts
141 int mySMDecreaseMagnificationBtn;
142 int mySMIncreaseMagnificationBtn;
144 bool myIsMidButtonDown;
145 bool myIsLeftButtonDown;