]> Creatis software - clitk.git/blob - vv/vvInteractorStyleNavigator.h
upport
[clitk.git] / vv / vvInteractorStyleNavigator.h
1 /*=========================================================================
2
3  Program:   vv
4  Module:    $RCSfile: vvInteractorStyleNavigator.h,v $
5  Language:  C++
6  Date:      $Date: 2010/01/06 13:31:57 $
7  Version:   $Revision: 1.1 $
8  Author :   Pierre Seroul (pierre.seroul@gmail.com)
9
10 Copyright (C) 2008
11 Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
12 CREATIS-LRMN http://www.creatis.insa-lyon.fr
13
14 This program is free software: you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation, version 3 of the License.
17
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 GNU General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program.  If not, see <http://www.gnu.org/licenses/>.
25
26 =========================================================================*/
27 #ifndef __vvInteractorStyleNavigator_h
28 #define __vvInteractorStyleNavigator_h
29
30 #include "vtkInteractorStyle.h"
31
32 // Motion flags
33
34 #define VTKIS_WINDOW_LEVEL 1024
35 #define VTKIS_PICK         1025
36
37 class vvInteractorStyleNavigator : public vtkInteractorStyle
38
39 {
40 public:
41     static vvInteractorStyleNavigator *New();
42     vtkTypeRevisionMacro(vvInteractorStyleNavigator, vtkInteractorStyle);
43     void PrintSelf(ostream& os, vtkIndent indent);
44
45     // Description:
46     // Some useful information for handling window level
47     vtkGetVector2Macro(WindowLevelStartPosition,int);
48     vtkGetVector2Macro(WindowLevelCurrentPosition,int);
49
50     // Description:
51     // Event bindings controlling the effects of pressing mouse buttons
52     // or moving the mouse.
53     virtual void OnMouseMove();
54     virtual void OnLeftButtonDown();
55     virtual void OnLeftButtonUp();
56     virtual void OnRightButtonDown();
57     virtual void OnRightButtonUp();
58     virtual void OnMiddleButtonDown();
59     virtual void OnMiddleButtonUp();
60     virtual void OnEnter();
61     virtual void OnLeave();
62     virtual void OnMouseWheelForward();
63     virtual void OnMouseWheelBackward();
64
65     // Description:
66     // Override the "fly-to" (f keypress) for images.
67     virtual void OnChar();
68
69     // These methods for the different interactions in different modes
70     // are overridden in subclasses to perform the correct motion. Since
71     // they might be called from OnTimer, they do not have mouse coord parameters
72     // (use interactor's GetEventPosition and GetLastEventPosition)
73     virtual void WindowLevel();
74     virtual void Pick();
75
76     // Interaction mode entry points used internally.
77     virtual void StartWindowLevel();
78     virtual void EndWindowLevel();
79     virtual void StartPick();
80     virtual void EndPick();
81     virtual void Dolly();
82     virtual void Pan();
83
84     // We need to reimplement this because otherwise it returns the top renderer,
85     // not the active one
86     virtual void FindPokedRenderer(int, int);
87
88 protected:
89     vvInteractorStyleNavigator();
90     ~vvInteractorStyleNavigator();
91
92     static void ProcessEvents(vtkObject* object,
93                               unsigned long event,
94                               void* clientdata,
95                               void* calldata);
96
97     double MotionFactor;
98
99     virtual void Dolly(double factor);
100
101     int WindowLevelStartPosition[2];
102     int WindowLevelCurrentPosition[2];
103
104 private:
105     vvInteractorStyleNavigator(const vvInteractorStyleNavigator&);  // Not implemented.
106     void operator=(const vvInteractorStyleNavigator&);  // Not implemented.
107 };
108
109 #endif