Version: 9.15.0
SVTK_Renderer.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2025 CEA, EDF, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 
23 // SALOME VTKViewer : build VTK viewer into Salome desktop
24 // File :
25 // Author :
26 
27 #ifndef SVTK_Renderer_h
28 #define SVTK_Renderer_h
29 
30 #include "SVTK.h"
31 #include "VTKViewer.h"
32 #include "SALOME_ListIO.hxx"
33 
34 #include <vtkObject.h>
35 #include <vtkSmartPointer.h>
36 
37 class vtkRenderer;
38 class vtkCallbackCommand;
40 
41 class vtkPicker;
42 class vtkPointPicker;
43 class vtkCellPicker;
44 class vtkProperty;
45 
46 class SVTK_AreaPicker;
47 
51 class VTKViewer_Actor;
52 class SVTK_Selector;
53 
54 #ifdef WIN32
55 #pragma warning ( disable:4251 )
56 #endif
57 
66 {
67  public:
69  static SVTK_Renderer* New();
70 
71  //----------------------------------------------------------------------------
73  vtkRenderer*
74  GetDevice();
75 
77  virtual
78  void
79  Initialize(vtkRenderWindowInteractor* theInteractor,
80  SVTK_Selector* theSelector);
81 
82  //----------------------------------------------------------------------------
84  virtual
85  void
86  AddActor(VTKViewer_Actor* theActor, bool theIsAdjustActors = true);
87 
89  virtual
90  void
91  RemoveActor(VTKViewer_Actor* theActor, bool theIsAdjustActors = true);
92 
95  GetTransform();
96 
98  virtual
99  void
100  SetScale( double theScale[3] );
101 
103  void
104  GetScale( double theScale[3] );
105 
106  //----------------------------------------------------------------------------
108  void
109  SetSelectionProp(const double& theRed = 1,
110  const double& theGreen = 1,
111  const double& theBlue = 0,
112  const int& theWidth = 5);
113 
115  void
116  SetPreselectionProp(const double& theRed = 0,
117  const double& theGreen = 1,
118  const double& theBlue = 1,
119  const int& theWidth = 5);
120 
122  void
123  SetSelectionTolerance(const double& theTolNodes = 0.025,
124  const double& theTolCell = 0.001,
125  const double& theTolObjects = 0.025);
126 
127  //----------------------------------------------------------------------------
129  void
130  AdjustActors();
131 
133  void
134  SetTrihedronSize(double theSize, const bool theRelative = true);
135 
137  double
138  GetTrihedronSize() const;
139 
141  bool
142  IsTrihedronRelative() const;
143 
144  //----------------------------------------------------------------------------
147  GetTrihedron();
148 
150  bool
151  IsTrihedronDisplayed();
152 
154  void
155  OnViewTrihedron();
156 
158 
159  void
160  SetTrihedronVisibility( const bool );
161 
163  void
164  OnAdjustTrihedron();
165 
166  //----------------------------------------------------------------------------
169  GetCubeAxes();
170 
172  bool
173  IsCubeAxesDisplayed();
174 
176  void
177  OnViewCubeAxes();
178 
180  void
181  OnAdjustCubeAxes();
182 
183  //----------------------------------------------------------------------------
185  void OnFitAll();
186 
187  //----------------------------------------------------------------------------
189  void onFitSelection();
190 
192  void OnFitIObjects(const SALOME_ListIO& objects);
193 
195  void OnResetView();
196 
198  void OnResetClippingRange();
199 
201  void OnFrontView();
202 
204  void OnBackView();
205 
207  void OnTopView();
208 
210  void OnBottomView();
211 
213  void OnRightView();
214 
216  void OnLeftView();
217 
219  void onClockWiseView();
220 
222  void onAntiClockWiseView();
223 
224 protected:
226  ~SVTK_Renderer();
227 
228  virtual
229  bool
230  OnAdjustActors();
231 
232  //----------------------------------------------------------------------------
233  // Priority at which events are processed
234  double myPriority;
235 
236  // Used to process events
237  vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
238 
239  // Description:
240  // Main process event method
241  static void ProcessEvents(vtkObject* object,
242  unsigned long event,
243  void* clientdata,
244  void* calldata);
245 
246  vtkSmartPointer<vtkRenderer> myDevice;
248  vtkSmartPointer<SVTK_Selector> mySelector;
249 
250  //----------------------------------------------------------------------------
251  vtkSmartPointer<VTKViewer_Transform> myTransform;
252 
253  //----------------------------------------------------------------------------
254  // Highlight/ Prehighlight devices
255  vtkSmartPointer<vtkPointPicker> myPointPicker;
256  vtkSmartPointer<vtkCellPicker> myCellPicker;
257 
258  vtkSmartPointer<SVTK_AreaPicker> myPointAreaPicker;
259  vtkSmartPointer<SVTK_AreaPicker> myCellAreaPicker;
260 
261  vtkSmartPointer<vtkProperty> myPreHighlightProperty;
262  vtkSmartPointer<vtkProperty> myHighlightProperty;
263 
264  //----------------------------------------------------------------------------
265  vtkSmartPointer<SVTK_CubeAxesActor2D> myCubeAxes;
266  vtkSmartPointer<VTKViewer_Trihedron> myTrihedron;
269  double myBndBox[6];
270 };
271 
272 #ifdef WIN32
273 #pragma warning ( default:4251 )
274 #endif
275 
276 #endif
const QString const bool const double theScale
Definition: OCCViewer_ViewModel.cxx:975
#define SVTK_EXPORT
Definition: SVTK.h:37
Definition: SALOME_ListIO.hxx:29
Rectangular picker class.
Definition: SVTK_AreaPicker.h:55
Definition: SVTK_CubeAxesActor2D.h:54
Definition: SVTK_Renderer.h:66
vtkSmartPointer< SVTK_CubeAxesActor2D > myCubeAxes
Definition: SVTK_Renderer.h:265
vtkSmartPointer< SVTK_AreaPicker > myPointAreaPicker
Definition: SVTK_Renderer.h:258
vtkSmartPointer< VTKViewer_Trihedron > myTrihedron
Definition: SVTK_Renderer.h:266
vtkTypeMacro(SVTK_Renderer, vtkObject) static SVTK_Renderer *New()
vtkRenderWindowInteractor * myInteractor
Definition: SVTK_Renderer.h:247
double myPriority
Definition: SVTK_Renderer.h:234
bool myIsTrihedronRelative
Definition: SVTK_Renderer.h:268
vtkSmartPointer< SVTK_AreaPicker > myCellAreaPicker
Definition: SVTK_Renderer.h:259
vtkSmartPointer< vtkCallbackCommand > myEventCallbackCommand
Definition: SVTK_Renderer.h:237
vtkSmartPointer< vtkRenderer > myDevice
Definition: SVTK_Renderer.h:246
vtkSmartPointer< SVTK_Selector > mySelector
Definition: SVTK_Renderer.h:248
vtkSmartPointer< VTKViewer_Transform > myTransform
Definition: SVTK_Renderer.h:251
vtkSmartPointer< vtkPointPicker > myPointPicker
Definition: SVTK_Renderer.h:255
vtkSmartPointer< vtkProperty > myPreHighlightProperty
Definition: SVTK_Renderer.h:261
vtkSmartPointer< vtkProperty > myHighlightProperty
Definition: SVTK_Renderer.h:262
vtkSmartPointer< vtkCellPicker > myCellPicker
Definition: SVTK_Renderer.h:256
double myTrihedronSize
Definition: SVTK_Renderer.h:267
Define an abstract interface for selection in SVTK package.
Definition: SVTK_Selector.h:58
Definition: VTKViewer_Actor.h:79
Describes linear transformations via a 4x4 matrix.
Definition: VTKViewer_Transform.h:34
Definition: VTKViewer_Trihedron.h:145