]> Creatis software - openheart.git/blob - Applications/vtkMyInteractorStyleTrackballCameraOpenHeart.h
commit all the files for the first time
[openheart.git] / Applications / vtkMyInteractorStyleTrackballCameraOpenHeart.h
1 /**
2 * Progam made by Olivier Bernard, associate professor
3 * at Institut National des Sciences Appliquees (INSA) Lyon,
4 * CREATIS-LRMN Laboratory,
5 * 69621 Villeurbanne, France,
6 * 20th of May 2014
7 */
8
9 #ifndef __vtkMyInteractorStyleTrackballCameraOpenHeart_h__
10 #define __vtkMyInteractorStyleTrackballCameraOpenHeart_h__
11
12 #include <vtkObjectFactory.h>
13 #include <vtkInteractorStyleTrackballCamera.h>
14 #include "OpenHeartGui.h"
15
16
17 class vtkMyInteractorStyleTrackballCameraOpenHeart : public vtkInteractorStyleTrackballCamera
18 {
19
20     public:
21
22         void SetOpenHeartGui( OpenHeartGui *win ) { this->window = win; }
23
24         static vtkMyInteractorStyleTrackballCameraOpenHeart *New()
25         {
26             /// First try to create the object from the vtkObjectFactory
27             vtkObject *ret = vtkObjectFactory::CreateInstance ("vtkMyInteractorStyleTrackballCameraOpenHeart");
28             if (ret)
29             {
30                 return (vtkMyInteractorStyleTrackballCameraOpenHeart *) ret;
31             }
32             /// If the factory was unable to create the object, then create it here.
33             return (new vtkMyInteractorStyleTrackballCameraOpenHeart);
34         }
35
36         virtual void OnChar();
37         virtual void OnMouseWheelForward();
38         virtual void OnMouseWheelBackward();
39
40         virtual void OnLeftButtonDown();
41         virtual void OnLeftButtonUp();
42         virtual void OnEnter();
43         virtual void OnLeave();
44
45
46     protected:
47
48         vtkMyInteractorStyleTrackballCameraOpenHeart() : FlagFirstTime(0), Step(1), PadBound(0.2), FlagLeftClick(false)
49         {
50             for (int i=0; i<6; i++) {
51                 Bounds[i] = 0;
52                 Limits[i] = 0;
53             }
54             for (int i=0; i<3; i++) {
55                 PadSliceDetection[i] = 0;
56                 SpacingImg[i] = 0;
57                 OriginImg[i] = 0;
58                 LimitImg[i] = 0;
59             }
60         }
61
62         ~vtkMyInteractorStyleTrackballCameraOpenHeart()
63         {}
64
65         OpenHeartGui *window;
66         int FlagFirstTime;
67         int Step;
68         double Bounds[6];
69         double Limits[6];
70         double PadSliceDetection[3];
71         double SpacingImg[3];
72         double OriginImg[3];
73         double LimitImg[3];
74         double PadBound;
75         bool FlagLeftClick;
76
77         void MoveForward();
78         void MoveForwardXYPlan();
79         void MoveForwardXZPlan();
80         void MoveForwardYZPlan();
81
82         void MoveBackward();
83         void MoveBackwardXYPlan();
84         void MoveBackwardXZPlan();
85         void MoveBackwardYZPlan();
86
87         void GetPickerPosition(double *pos);
88         bool IsInside(double *pos);
89
90 };
91
92
93 #endif