Salome HOME
Fix for Bug IPAL8945
[modules/visu.git] / src / VVTK / VVTK_MainWindow.h
1 #ifndef VVTK_MAINWINDOW_H
2 #define VVTK_MAINWINDOW_H
3
4 #ifdef WIN32
5 #pragma warning( disable:4251 )
6 #endif
7
8 #include "VVTK.h"
9 #include "SVTK_MainWindow.h"
10
11 class QSplitter;
12
13 class VISU_WidgetCtrl;
14 class VVTK_SegmentationCursorDlg;
15 class VISU_InsideCursorSettings;
16 class VISU_OutsideCursorSettings;
17 class VISU_PickingSettings;
18 class VVTK_InteractorStyle;
19 class VVTK_ControllerIncrement;
20 class VVTK_ControllerOnKeyDown;
21 class VVTK_PickingDlg;
22 class VVTK_MainWindow2;
23 class VVTK_Renderer1;
24 class VVTK_Renderer2;
25 class VVTK_Recorder;
26
27 //----------------------------------------------------------------------------
28 //! Customize SVTK_MainWindow to provide VVTK functionality
29 class VVTK_EXPORT VVTK_MainWindow: public SVTK_MainWindow
30 {
31   Q_OBJECT;
32
33 public:
34   //! Construct instance of the class
35   VVTK_MainWindow(QWidget* theParent, 
36                   const char* theName,
37                   SUIT_ResourceMgr* theResourceMgr,
38                   SUIT_ViewWindow* theViewWindow);
39
40   //! Reimplement SVTK_MainWindow::Initialize
41   virtual
42   void
43   Initialize(SVTK_RenderWindowInteractor* theInteractor);
44
45   //! Destroy instance of the class
46   virtual
47   ~VVTK_MainWindow();
48
49  public slots:
50
51   virtual
52   void
53   onDumpView();
54
55    //! To change active interactor style at run-time
56   virtual
57   void
58   OnInteractorStyleSwitch(bool theIsGaussStyleOn); 
59
60   virtual 
61   void
62   action( const int );
63
64   virtual
65   void
66   OnStartRecording();
67
68   virtual
69   void
70   OnPlayRecording();
71
72   virtual
73   void
74   OnPauseRecording();
75
76   virtual
77   void
78   OnStopRecording();
79
80  protected:
81   vtkSmartPointer<VVTK_InteractorStyle> myInteractorStyle;
82   vtkSmartPointer<VVTK_ControllerIncrement> myControllerIncrement;
83   vtkSmartPointer<VVTK_ControllerOnKeyDown> myControllerOnKeyDown; 
84
85   QToolBar* myRecordingToolBar;
86   QtxAction* myStartAction;
87   QtxAction* myPlayAction;
88   QtxAction* myPauseAction;
89   QtxAction* myStopAction;
90
91   VVTK_Recorder *myRecorder;
92 };
93
94
95 //----------------------------------------------------------------------------
96 //! Extend VVTK_MainWindow to implement functionality for base view
97 class VVTK_EXPORT VVTK_MainWindow1: public VVTK_MainWindow
98 {
99   Q_OBJECT;
100
101 public:
102   //! Construct instance of the class
103   VVTK_MainWindow1(QSplitter* theParent, 
104                    const char* theName,
105                    SUIT_ResourceMgr* theResourceMgr,
106                    SUIT_ViewWindow* theViewWindow);
107
108   //! Reimplement VVTK_MainWindow::Initialize
109   virtual
110   void
111   Initialize(SVTK_RenderWindowInteractor* theInteractor,
112              VVTK_Renderer1* theRenderer);
113
114   //! Destroy instance of the class
115   virtual
116   ~VVTK_MainWindow1();
117
118   //! Create instance of the segmented VVTK_MainWindow
119   /*!
120     The two views (VVTK_MainWindow1 and VVTK_MainWindow2) should change its behaviour in the same time.
121     So, it is necessary to synhronize them through sharing some common pointers.
122   */
123   VVTK_MainWindow2*
124   CreateMainWindow2(QWidget* theParent, 
125                     const char* theName,
126                     SUIT_ResourceMgr* theResourceMgr,
127                     SUIT_ViewWindow* theViewWindow);
128
129   VISU_WidgetCtrl*  GetWidgetCtrl();
130
131   void
132   SetPlanesSegementation(bool theIsOn);
133
134   void
135   SetSphereSegementation(bool theIsOn);
136
137   VISU_InsideCursorSettings*
138   GetInsideCursorSettings();
139
140   //! Get contained VISU_OutsideCursorSettings
141   VISU_OutsideCursorSettings*
142   GetOutsideCursorSettings();
143
144   //! Get contained VISU_PickingSettings
145   VISU_PickingSettings* 
146   GetPickingSettings();
147
148  public slots:
149   //! To activate/ deactivate the segementation cursor at run-time
150   void
151   OnSegmentationSwitch();//bool theIsSegmentationOn); 
152
153   void
154   OnSegmentationSwitch(QtxAction* theAction);//bool theIsSegmentationOn); 
155
156    //! To change active selection mode at run-time
157   virtual
158   void
159   OnSelectionModeSwitch(bool theIsSelectionOn); 
160
161    //! To adjust to the current selection mode
162   virtual
163   void
164   OnSelectionChanged(); 
165
166  protected:
167   VVTK_Renderer1* myRenderer; //!< Keeps extended version of SVTK_Renderer
168
169   VVTK_MainWindow2* myMainWindow2; //!< Refer to segmented view
170
171   QtxAction* myStyleSwitchAction; //!< Action for switch interactor style
172   QToolBar* myPtsToolBar; //!< Additional tool bar
173
174   //! To implement show/hide segmented view on acttivate/ deactivate segementation cursor
175   QSplitter* mySplitter; 
176
177   QtxAction* myPickingAction; //!< Action for switch selection mode
178   QtxAction* myPlaneSegmentationAction; //!< Action for switch segmentation mode to plane
179   QtxAction* mySphereSegmentationAction; //!< Action for switch segmentation mode to sphere
180
181   //! Keep reference to VVTK_SegmentationCursorDlg
182   VVTK_SegmentationCursorDlg* mySegmentationCursorDlg; 
183   VVTK_PickingDlg* myPickingDlg; //!< Keep reference to VVTK_PickingDlg
184 };
185
186
187 //----------------------------------------------------------------------------
188 //! Extend VVTK_MainWindow to implement functionality for segmented view
189 class VVTK_EXPORT VVTK_MainWindow2: public VVTK_MainWindow
190 {
191   Q_OBJECT;
192
193   friend class VVTK_MainWindow1;
194
195   //! Construct instance of the class
196   VVTK_MainWindow2(QWidget* theParent, 
197                    const char* theName,
198                    SUIT_ResourceMgr* theResourceMgr,
199                    SUIT_ViewWindow* theViewWindow,
200                    QtxAction* theStyleSwitchAction);
201 public:
202   //! Destroy instance of the class
203   virtual
204   ~VVTK_MainWindow2();
205
206   //! Reimplement SVTK_MainWindow::Initialize
207   virtual
208   void
209   Initialize(SVTK_RenderWindowInteractor* theInteractor);
210
211  protected:
212   // Refer to the VVTK_MainWindow1::myStyleSwitchAction instance
213   QtxAction* myStyleSwitchAction; 
214
215 };
216
217
218 #ifdef WIN32
219 #pragma warning( default:4251 )
220 #endif
221
222 #endif