added methods to convert between Cartesian and spherical coordinates
[engrid-github.git] / src / libengrid / egvtkinteractorstyle.h
blob79918ad169d449461a50305c556569d44a0c2e7c
1 //
2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 // + +
4 // + This file is part of enGrid. +
5 // + +
6 // + Copyright 2008-2012 enGits GmbH +
7 // + +
8 // + enGrid is free software: you can redistribute it and/or modify +
9 // + it under the terms of the GNU General Public License as published by +
10 // + the Free Software Foundation, either version 3 of the License, or +
11 // + (at your option) any later version. +
12 // + +
13 // + enGrid is distributed in the hope that it will be useful, +
14 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
15 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
16 // + GNU General Public License for more details. +
17 // + +
18 // + You should have received a copy of the GNU General Public License +
19 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
20 // + +
21 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
22 //
23 #ifndef EGVTKINTERACTORSTYLE_H
24 #define EGVTKINTERACTORSTYLE_H
26 #include <vtkInteractorStyle.h>
28 #include "vtkCamera.h"
29 #include "vtkRenderWindowInteractor.h"
30 #include "vtkCallbackCommand.h"
31 #include "vtkRenderer.h"
32 #include "vtkRenderWindow.h"
34 #include <iostream>
35 using namespace std;
37 class egvtkInteractorStyle : public vtkInteractorStyle
39 public:
41 // Event information
42 int AltKey;
43 int ControlKey;
44 int ShiftKey;
45 char KeyCode;
46 int RepeatCount;
47 char* KeySym;
48 int EventPosition[2];
49 int LastEventPosition[2];
50 int EventSize[2];
51 int Size[2];
52 int TimerEventId;
53 int TimerEventType;
54 int TimerEventDuration;
55 int TimerEventPlatformId;
57 static egvtkInteractorStyle *New();
58 void PrintSelf(ostream& os, vtkIndent indent);
60 // Description:
61 // Event bindings controlling the effects of pressing mouse buttons
62 // or moving the mouse.
63 void OnMouseMove();
64 void OnLeftButtonDown();
65 void OnLeftButtonUp();
66 void OnMiddleButtonDown();
67 void OnMiddleButtonUp();
68 void OnRightButtonDown();
69 void OnRightButtonUp();
70 void OnMouseWheelForward();
71 void OnMouseWheelBackward();
72 void OnChar();
74 /* void OnKeyDown (){
75 cout<<"OnKeyDown "<<this->Interactor->GetKeyCode()<<endl;
76 this->EventCallbackCommand->SetAbortFlag(1);
78 void OnKeyUp (){
79 cout<<"OnKeyUp "<<this->Interactor->GetKeyCode()<<endl;
80 this->EventCallbackCommand->SetAbortFlag(1);
82 void OnKeyPress (){
83 cout<<"OnKeyPress "<<this->Interactor->GetKeyCode()<<endl;
84 this->EventCallbackCommand->SetAbortFlag(1);
86 void OnKeyRelease (){
87 cout<<"OnKeyRelease "<<this->Interactor->GetKeyCode()<<endl;
88 this->EventCallbackCommand->SetAbortFlag(1);
89 };*/
91 // These methods for the different interactions in different modes
92 // are overridden in subclasses to perform the correct motion. Since
93 // they are called by OnTimer, they do not have mouse coord parameters
94 // (use interactor's GetEventPosition and GetLastEventPosition)
95 void Rotate();
96 void Spin();
97 void Pan();
98 void Dolly();
100 // Description:
101 // Set the apparent sensitivity of the interactor style to mouse motion.
103 protected:
104 egvtkInteractorStyle();
105 ~egvtkInteractorStyle();
107 double MotionFactor;
109 void Dolly(double factor);
111 private:
112 egvtkInteractorStyle(const egvtkInteractorStyle&); // Not implemented.
113 void operator=(const egvtkInteractorStyle&); // Not implemented.
116 #endif