]> Creatis software - openheart.git/blobdiff - Applications/vtkMyInteractorStyleTrackballCameraOpenHeart.h
commit all the files for the first time
[openheart.git] / Applications / vtkMyInteractorStyleTrackballCameraOpenHeart.h
diff --git a/Applications/vtkMyInteractorStyleTrackballCameraOpenHeart.h b/Applications/vtkMyInteractorStyleTrackballCameraOpenHeart.h
new file mode 100644 (file)
index 0000000..8ef8802
--- /dev/null
@@ -0,0 +1,93 @@
+/**
+* Progam made by Olivier Bernard, associate professor
+* at Institut National des Sciences Appliquees (INSA) Lyon,
+* CREATIS-LRMN Laboratory,
+* 69621 Villeurbanne, France,
+* 20th of May 2014
+*/
+
+#ifndef __vtkMyInteractorStyleTrackballCameraOpenHeart_h__
+#define __vtkMyInteractorStyleTrackballCameraOpenHeart_h__
+
+#include <vtkObjectFactory.h>
+#include <vtkInteractorStyleTrackballCamera.h>
+#include "OpenHeartGui.h"
+
+
+class vtkMyInteractorStyleTrackballCameraOpenHeart : public vtkInteractorStyleTrackballCamera
+{
+
+    public:
+
+        void SetOpenHeartGui( OpenHeartGui *win ) { this->window = win; }
+
+        static vtkMyInteractorStyleTrackballCameraOpenHeart *New()
+        {
+            /// First try to create the object from the vtkObjectFactory
+            vtkObject *ret = vtkObjectFactory::CreateInstance ("vtkMyInteractorStyleTrackballCameraOpenHeart");
+            if (ret)
+            {
+                return (vtkMyInteractorStyleTrackballCameraOpenHeart *) ret;
+            }
+            /// If the factory was unable to create the object, then create it here.
+            return (new vtkMyInteractorStyleTrackballCameraOpenHeart);
+        }
+
+        virtual void OnChar();
+        virtual void OnMouseWheelForward();
+        virtual void OnMouseWheelBackward();
+
+        virtual void OnLeftButtonDown();
+        virtual void OnLeftButtonUp();
+        virtual void OnEnter();
+        virtual void OnLeave();
+
+
+    protected:
+
+        vtkMyInteractorStyleTrackballCameraOpenHeart() : FlagFirstTime(0), Step(1), PadBound(0.2), FlagLeftClick(false)
+        {
+            for (int i=0; i<6; i++) {
+                Bounds[i] = 0;
+                Limits[i] = 0;
+            }
+            for (int i=0; i<3; i++) {
+                PadSliceDetection[i] = 0;
+                SpacingImg[i] = 0;
+                OriginImg[i] = 0;
+                LimitImg[i] = 0;
+            }
+        }
+
+        ~vtkMyInteractorStyleTrackballCameraOpenHeart()
+        {}
+
+        OpenHeartGui *window;
+        int FlagFirstTime;
+        int Step;
+        double Bounds[6];
+        double Limits[6];
+        double PadSliceDetection[3];
+        double SpacingImg[3];
+        double OriginImg[3];
+        double LimitImg[3];
+        double PadBound;
+        bool FlagLeftClick;
+
+        void MoveForward();
+        void MoveForwardXYPlan();
+        void MoveForwardXZPlan();
+        void MoveForwardYZPlan();
+
+        void MoveBackward();
+        void MoveBackwardXYPlan();
+        void MoveBackwardXZPlan();
+        void MoveBackwardYZPlan();
+
+        void GetPickerPosition(double *pos);
+        bool IsInside(double *pos);
+
+};
+
+
+#endif