1 // File : VTKViewer_InteractorStyleSALOME.h
2 // Created : Wed Mar 20 11:36:07 2002
3 // Author : Christophe ATTANASIO
6 // Copyright : Open CASCADE 2002
10 #ifndef __VTKViewer_InteractorStyleSALOME_h
11 #define __VTKViewer_InteractorStyleSALOME_h
13 #include <vtkInteractorStyle.h>
16 #include "SALOME_Actor.h"
19 #define VTK_INTERACTOR_STYLE_CAMERA_NONE 0
20 #define VTK_INTERACTOR_STYLE_CAMERA_ROTATE 1
21 #define VTK_INTERACTOR_STYLE_CAMERA_PAN 2
22 #define VTK_INTERACTOR_STYLE_CAMERA_ZOOM 3
23 #define VTK_INTERACTOR_STYLE_CAMERA_SPIN 4
24 #define VTK_INTERACTOR_STYLE_CAMERA_FIT 5
25 #define VTK_INTERACTOR_STYLE_CAMERA_SELECT 6
26 #define VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN 7
28 class VTKViewer_InteractorStyleSALOME : public QObject, public vtkInteractorStyle
32 // This class must be supplied with a vtkRenderWindowInteractor wrapper or
33 // parent. This class should not normally be instantiated by application
35 static VTKViewer_InteractorStyleSALOME *New();
37 void setTriedron( vtkActorCollection* triedron );
39 vtkTypeMacro(VTKViewer_InteractorStyleSALOME, vtkObject);
40 void PrintSelf(ostream& os, vtkIndent indent);
42 // Generic event bindings must be overridden in subclasses
43 void OnMouseMove (int ctrl, int shift, int x, int y);
44 void OnLeftButtonDown(int ctrl, int shift, int x, int y);
45 void OnLeftButtonUp (int ctrl, int shift, int x, int y);
46 void OnMiddleButtonDown(int ctrl, int shift, int x, int y);
47 void OnMiddleButtonUp (int ctrl, int shift, int x, int y);
48 void OnRightButtonDown(int ctrl, int shift, int x, int y);
49 void OnRightButtonUp (int ctrl, int shift, int x, int y);
52 VTKViewer_InteractorStyleSALOME();
53 ~VTKViewer_InteractorStyleSALOME();
54 VTKViewer_InteractorStyleSALOME(const VTKViewer_InteractorStyleSALOME&) {};
55 void operator=(const VTKViewer_InteractorStyleSALOME&) {};
57 void RotateXY(int dx, int dy);
58 void PanXY(int x, int y, int oldX, int oldY);
59 void DollyXY(int dx, int dy);
60 void SpinXY(int dx, int dy, int oldX, int oldY);
61 void fitRect(const int left, const int top, const int right, const int bottom);
62 void Place(const int theX, const int theY);
63 void TranslateView(int toX, int toY, int fromX, int fromY);
64 bool IsInRect(vtkActor* theActor,
65 const int left, const int top,
66 const int right, const int bottom);
67 bool IsInRect(vtkCell* theCell,
68 const int left, const int top,
69 const int right, const int bottom);
70 bool IsInRect(float* thePoint,
71 const int left, const int top,
72 const int right, const int bottom);
76 float RadianToDegree; // constant: for conv from deg to rad
79 SALOME_Actor* preview;
82 bool eventFilter(QObject* object, QEvent* event);
85 void startGlobalPan();
89 bool needsRedrawing();
93 void startOperation(int operation);
94 void onStartOperation();
95 void onFinishOperation();
96 void onOperation(QPoint mousePos);
97 void onCursorMove(QPoint mousePos);
98 void setCursor(const int operation);
103 QCursor myZoomCursor;
104 QCursor myRotateCursor;
105 QCursor mySpinCursor;
106 QCursor myHandCursor;
107 QCursor myGlobalPanCursor;
113 vtkActorCollection* m_Triedron;