]> SALOME platform Git repositories - modules/gui.git/blob - src/VTKViewer/VTKViewer_ViewWindow.h
Salome HOME
a998414d74df38debd4ddd03a79cd6751d10fd6c
[modules/gui.git] / src / VTKViewer / VTKViewer_ViewWindow.h
1 #ifndef VTKVIEWER_VIEWWINDOW_H
2 #define VTKVIEWER_VIEWWINDOW_H
3
4 #include "VTKViewer.h"
5
6 #include "SUIT_ViewWindow.h"
7
8 #include "QtxAction.h"
9
10 class vtkRenderer;
11 class SUIT_Desktop;
12 class VTKViewer_Viewer;
13 class VTKViewer_Trihedron;
14 class VTKViewer_Transform;
15 class VTKViewer_RenderWindow;
16 class VTKViewer_InteractorStyle;
17 class VTKViewer_RenderWindowInteractor;
18 class VTKViewer_Actor;
19
20 #ifdef WIN32
21 #pragma warning( disable:4251 )
22 #endif
23
24 class VTKVIEWER_EXPORT VTKViewer_ViewWindow : public SUIT_ViewWindow
25 {
26   Q_OBJECT
27
28 public:
29   VTKViewer_ViewWindow( SUIT_Desktop*, VTKViewer_Viewer*,
30                         VTKViewer_InteractorStyle* = 0,
31                         VTKViewer_RenderWindowInteractor* = 0 );
32   virtual ~VTKViewer_ViewWindow();
33   
34   QToolBar*    getToolBar() { return myToolBar; }
35   
36   void         setBackgroundColor( const QColor& );
37   QColor       backgroundColor() const;
38
39   vtkRenderer*                      getRenderer()     { return myRenderer;     }
40   VTKViewer_RenderWindow*           getRenderWindow() { return myRenderWindow; }
41   VTKViewer_RenderWindowInteractor* getRWInteractor() { return myRWInteractor; }
42   bool                              isTrihedronDisplayed();
43
44   void Repaint( bool theUpdateTrihedron = true );
45   void onAdjustTrihedron();
46   void GetScale( double theScale[3] );
47   void SetScale( double theScale[3] );
48   void AddActor( VTKViewer_Actor*, bool update = false );
49   void RemoveActor( VTKViewer_Actor*, bool update = false);
50
51 public slots:
52   void onFrontView();
53   void onBackView();
54   void onTopView();
55   void onBottomView();
56   void onLeftView();
57   void onRightView();
58   void onResetView();
59   void onFitAll();
60   void onDumpView();
61   void activateZoom();
62   void activateWindowFit();
63   void activateRotation();
64   void activatePanning();
65   void activateGlobalPanning();
66   void onTrihedronShow();
67
68 protected slots:
69   void onKeyPressed(QKeyEvent* event);
70   void onKeyReleased(QKeyEvent* event);
71   void onMousePressed(QMouseEvent* event);
72   void onMouseDoubleClicked(QMouseEvent* event);
73   void onMouseReleased(QMouseEvent* event);
74   void onMouseMoving(QMouseEvent* event);
75
76 private:
77   void                              InsertActor( VTKViewer_Actor* theActor,
78                                                  bool theMoveInternalActors = false );
79   void                              MoveActor( VTKViewer_Actor* theActor );
80
81 private:
82   enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, RotationId,
83          FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId, TrihedronShowId };
84   typedef QMap<int, QtxAction*> ActionsMap;
85   
86   void    createActions();
87   void    createToolBar();
88   
89   VTKViewer_Viewer*                 myModel;
90  
91   vtkRenderer*                      myRenderer;
92   VTKViewer_RenderWindow*           myRenderWindow;
93   VTKViewer_RenderWindowInteractor* myRWInteractor;
94   
95   VTKViewer_Trihedron*              myTrihedron;  
96   VTKViewer_Transform*              myTransform;
97   
98   QToolBar*                         myToolBar;
99   ActionsMap                        myActionsMap;  
100   
101   double                            myCurScale;
102
103   friend class VTKViewer_RenderWindowInteractor;
104 };
105
106 #ifdef WIN32
107 #pragma warning( default:4251 )
108 #endif
109
110 #endif