1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/
19 #ifndef SVTK_VIEWWINDOW_H
20 #define SVTK_VIEWWINDOW_H
23 #pragma warning( disable:4251 )
27 #include "SVTK_Selection.h"
28 #include "SUIT_ViewWindow.h"
29 #include "SALOME_InteractiveObject.hxx"
33 class VTKViewer_Actor;
34 class VTKViewer_Trihedron;
36 class SVTK_ViewModelBase;
37 class SVTK_MainWindow;
41 class SVTK_InteractorStyle;
42 class SVTK_CubeAxesActor2D;
44 class SVTK_RenderWindow;
45 class SVTK_RenderWindowInteractor;
48 class vtkRenderWindow;
49 class vtkRenderWindowInteractor;
51 //! Define a container for SALOME VTK view window
52 class SVTK_EXPORT SVTK_ViewWindow : public SUIT_ViewWindow
57 //! To construct #SVTK_ViewWindow instance
58 SVTK_ViewWindow(SUIT_Desktop* theDesktop);
63 //! To initialize #SVTK_ViewWindow instance
66 Initialize(SVTK_ViewModelBase* theModel);
72 //! Get #SVTK_MainWindow
76 //! Redirect the request to #SVTK_MainWindow::getRenderWindow
80 //! Redirect the request to #SVTK_MainWindow::getInteractor
81 vtkRenderWindowInteractor*
84 //! Redirect the request to #SVTK_MainWindow::getRenderer
88 //! Redirect the request to #SVTK_MainWindow::GetSelector
92 //! Redirect the request to #SVTK_Selector::SelectionMode
94 SelectionMode() const;
96 //! Change selection mode
99 SetSelectionMode(Selection_Mode theMode);
101 //! Redirect the request to #SVTK_MainWindow::SetBackgroundColor
104 setBackgroundColor( const QColor& );
106 //! Redirect the request to #SVTK_MainWindow::SetBackgroundColor
108 backgroundColor() const;
110 //! Redirect the request to #SVTK_Renderer::IsTrihedronDisplayed
112 isTrihedronDisplayed();
114 //! Redirect the request to #SVTK_Renderer::IsCubeAxesDisplayed
116 isCubeAxesDisplayed();
118 /* interactive object management */
119 //! Redirect the request to #SVTK_View::highlight (to support old code)
122 highlight(const Handle(SALOME_InteractiveObject)& theIO,
123 bool theIsHighlight = true,
124 bool theIsUpdate = true);
126 //! Redirect the request to #SVTK_View::unHighlightAll (to support old code)
131 //! Redirect the request to #SVTK_View::isInViewer (to support old code)
133 isInViewer(const Handle(SALOME_InteractiveObject)& theIObject);
135 //! Redirect the request to #SVTK_View::isVisible (to support old code)
137 isVisible(const Handle(SALOME_InteractiveObject)& theIObject);
139 //! Redirect the request to #SVTK_View::FindIObject (to support old code)
140 //----------------------------------------------------------------------------
141 Handle(SALOME_InteractiveObject)
142 FindIObject(const char* theEntry);
145 //----------------------------------------------------------------------------
146 //! Redirect the request to #SVTK_View::Display (to support old code)
149 Display(const Handle(SALOME_InteractiveObject)& theIObject,
150 bool theImmediatly = true);
152 //! Redirect the request to #SVTK_View::DisplayOnly (to support old code)
155 DisplayOnly(const Handle(SALOME_InteractiveObject)& theIObject);
157 //! Redirect the request to #SVTK_View::Erase (to support old code)
160 Erase(const Handle(SALOME_InteractiveObject)& theIObject,
161 bool theImmediatly = true);
163 //! Redirect the request to #SVTK_View::DisplayAll (to support old code)
168 //! Redirect the request to #SVTK_View::EraseAll (to support old code)
173 //! To repaint the viewer
176 Repaint(bool theUpdateTrihedron = true);
178 //----------------------------------------------------------------------------
179 //! Redirect the request to #SVTK_Renderer::SetScale
182 SetScale( double theScale[3] );
184 //! Redirect the request to #SVTK_Renderer::GetScale
187 GetScale( double theScale[3] );
189 //! Redirect the request to #SVTK_Renderer::AddActor
192 AddActor(VTKViewer_Actor* theActor,
193 bool theIsUpdate = false);
195 //! Redirect the request to #SVTK_Renderer::RemoveActor
198 RemoveActor(VTKViewer_Actor* theActor,
199 bool theIsUpdate = false);
201 //----------------------------------------------------------------------------
202 //! Redirect the request to #SVTK_Renderer::AdjustActors
205 AdjustTrihedrons(const bool theIsForced);
207 //! Redirect the request to #SVTK_Renderer::GetTrihedron
211 //! Redirect the request to #SVTK_Renderer::GetCubeAxes
212 SVTK_CubeAxesActor2D*
215 //! Redirect the request to #SVTK_Renderer::GetTrihedronSize
217 GetTrihedronSize() const;
219 //! Redirect the request to #SVTK_Renderer::SetTrihedronSize
222 SetTrihedronSize( const int, const bool = true );
224 //! Redirect the request to #SVTK_Renderer::SetSelectionProp
227 SetSelectionProp(const double& theRed = 1,
228 const double& theGreen = 1,
229 const double& theBlue = 0,
230 const int& theWidth = 5);
232 //! Redirect the request to #SVTK_Renderer::SetPreselectionProp
235 SetPreselectionProp(const double& theRed = 0,
236 const double& theGreen = 1,
237 const double& theBlue = 1,
238 const int& theWidth = 5);
240 //! Redirect the request to #SVTK_Renderer::SetSelectionTolerance
243 SetSelectionTolerance(const double& theTolNodes = 0.025,
244 const double& theTolCell = 0.001);
246 //! Methods to save/restore visual parameters of a view (pan, zoom, etc.)
249 getVisualParameters();
253 setVisualParameters( const QString& parameters );
257 eventFilter( QObject*, QEvent* );
262 onSelectionChanged();
265 void selectionChanged();
268 //! Redirect the request to #SVTK_Renderer::OnFrontView
273 //! Redirect the request to #SVTK_Renderer::OnBackView
278 //! Redirect the request to #SVTK_Renderer::OnTopView
283 //! Redirect the request to #SVTK_Renderer::OnBottomView
288 //! Redirect the request to #SVTK_Renderer::OnRightView
293 //! Redirect the request to #SVTK_Renderer::OnLeftView
298 //! Redirect the request to #SVTK_Renderer::OnResetView
303 //! Redirect the request to #SVTK_Renderer::OnFitAll
308 //! Redirect the request to #SVTK_Renderer::OnViewTrihedron
313 //! Redirect the request to #SVTK_Renderer::OnViewCubeAxes
318 //! Redirect the request to #SVTK_Renderer::OnAdjustTrihedron
323 //! Redirect the request to #SVTK_Renderer::OnAdjustCubeAxes
329 void onKeyPressed(QKeyEvent* event);
330 void onKeyReleased(QKeyEvent* event);
331 void onMousePressed(QMouseEvent* event);
332 void onMouseDoubleClicked(QMouseEvent* event);
333 void onMouseReleased(QMouseEvent* event);
334 void onMouseMoving(QMouseEvent* event);
339 Initialize(SVTK_View* theView,
340 SVTK_ViewModelBase* theModel);
343 doSetVisualParameters( const QString& );
346 virtual bool action( const int );
349 SVTK_MainWindow* myMainWindow;
350 SVTK_ViewModelBase* myModel;
352 QString myVisualParams; // used for delayed setting of view parameters
356 #pragma warning( default:4251 )