1 #ifndef SVTK_MAINWINDOW_H
2 #define SVTK_MAINWINDOW_H
5 #pragma warning( disable:4251 )
9 #include "SVTK_Selection.h"
11 #include <vtkSmartPointer.h>
13 #include <qmainwindow.h>
19 class vtkRenderWindow;
20 class vtkInteractorStyle;
21 class vtkRenderWindowInteractor;
23 class SUIT_ResourceMgr;
24 class SUIT_ViewWindow;
26 class SVTK_RenderWindowInteractor;
27 class SVTK_NonIsometricDlg;
28 class SVTK_CubeAxesActor2D;
29 class SVTK_CubeAxesDlg;
31 class VTKViewer_Trihedron;
32 class VTKViewer_Transform;
33 class VTKViewer_Actor;
39 //----------------------------------------------------------------------------
40 //! The class is a container for #SVTK_RenderWindowInteractor.
42 The class contains #SVTK_RenderWindowInteractor instance and
43 adds predefined viewer actions and toolbar for user interaction.
45 class SVTK_EXPORT SVTK_MainWindow: public QMainWindow
50 SVTK_MainWindow(QWidget* theParent,
52 SUIT_ResourceMgr* theResourceMgr,
53 SUIT_ViewWindow* theViewWindow);
55 //! To initialize the class
58 Initialize(SVTK_RenderWindowInteractor* theInteractor);
63 //----------------------------------------------------------------------------
64 //! Get used #SVTK_RenderWindowInteractor
65 SVTK_RenderWindowInteractor*
68 //! Get used #vtkRenderWindowInteractor (obsolete)
69 vtkRenderWindowInteractor*
72 //! Get used #vtkRenderWindow (obsolete)
76 //! To repaint the view
78 Repaint(bool theUpdateTrihedron = true);
80 //! To invoke a VTK event on #SVTK_RenderWindowInteractor instance
82 InvokeEvent(unsigned long theEvent, void* theCallData);
84 //----------------------------------------------------------------------------
85 //! Redirect the request to #SVTK_RenderWindowInteractor::GetInteractorStyle
89 //! Redirect the request to #SVTK_RenderWindowInteractor::PushInteractorStyle
91 PushInteractorStyle(vtkInteractorStyle* theStyle);
93 //! Redirect the request to #SVTK_RenderWindowInteractor::PopInteractorStyle
97 //----------------------------------------------------------------------------
98 //! Redirect the request to #SVTK_RenderWindowInteractor::GetSelector
102 //! Redirect the request to #SVTK_RenderWindowInteractor::SelectionMode
106 //! Redirect the request to #SVTK_RenderWindowInteractor::SetSelectionMode
108 SetSelectionMode(Selection_Mode theMode);
110 //----------------------------------------------------------------------------
111 //! Redirect the request to #SVTK_RenderWindowInteractor::GetRenderer
115 //! Redirect the request to #SVTK_RenderWindowInteractor::getRenderer
119 //! Set background color to the view
121 SetBackgroundColor(const QColor& theColor);
123 //! Get background color of the view
127 //! Redirect the request to #SVTK_Renderer::SetScale
129 SetScale(double theScale[3]);
131 //! Redirect the request to #SVTK_Renderer::GetScale
133 GetScale(double theScale[3]);
135 //! Redirect the request to #SVTK_Renderer::AddActor
138 AddActor(VTKViewer_Actor* theActor,
139 bool theIsUpdate = false);
141 //! Redirect the request to #SVTK_Renderer::RemoveActor
144 RemoveActor(VTKViewer_Actor* theActor,
145 bool theIsUpdate = false);
147 //! Redirect the request to #SVTK_Renderer::GetTrihedronSize
151 //! Redirect the request to #SVTK_Renderer::SetTrihedronSize
153 SetTrihedronSize(const int theSize);
155 //! Redirect the request to #SVTK_Renderer::AdjustActors
159 //! Redirect the request to #SVTK_Renderer::IsTrihedronDisplayed
161 IsTrihedronDisplayed();
163 //! Redirect the request to #SVTK_Renderer::IsCubeAxesDisplayed
165 IsCubeAxesDisplayed();
167 //! Redirect the request to #SVTK_Renderer::GetTrihedron
171 //! Redirect the request to #SVTK_Renderer::GetCubeAxes
172 SVTK_CubeAxesActor2D*
175 //----------------------------------------------------------------------------
176 QToolBar* getToolBar();
180 void activateWindowFit();
181 void activateRotation();
182 void activatePanning();
183 void activateGlobalPanning();
195 void onViewTrihedron();
196 void onViewCubeAxes();
198 void onNonIsometric(bool theIsActivate);
199 void onGraduatedAxes(bool theIsActivate);
201 void onAdjustTrihedron();
202 void onAdjustCubeAxes();
209 createActions(SUIT_ResourceMgr* theResourceMgr);
215 SetEventDispatcher(vtkObject* theDispatcher);
217 enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, RotationId,
218 FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId,
219 ViewTrihedronId, NonIsometric, GraduatedAxes};
220 typedef QMap<int, QtxAction*> TActionsMap;
222 SUIT_ViewWindow* myViewWindow;
224 SVTK_NonIsometricDlg* myNonIsometricDlg;
225 SVTK_CubeAxesDlg* myCubeAxesDlg;
227 vtkSmartPointer<vtkObject> myEventDispatcher;
228 TActionsMap myActionsMap;
231 SVTK_RenderWindowInteractor* myInteractor;
235 #pragma warning( default:4251 )