Version: 9.16.0
SALOME_Actor.h
Go to the documentation of this file.
1// Copyright (C) 2007-2026 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 OBJECT : implementation of interactive object visualization for OCC and VTK viewers
24// File : SALOME_Actor.h
25// Author : Nicolas REJNERI
26
27#ifndef SALOME_ACTOR_H
28#define SALOME_ACTOR_H
29
30#include "SVTK_SelectionEvent.h"
31#include "SVTK_Selector.h"
32#include "SVTK.h"
33
35
36// undefining min and max because CASCADE's defines them and
37// it clashes with std::min(), std::max()
38#undef min
39#undef max
40
41#include <VTKViewer_Actor.h>
42#include <VTKViewer_MarkerDef.h>
43
44#include <vtkSmartPointer.h>
45
46class vtkAbstractPicker;
47class vtkPointPicker;
48class vtkCellPicker;
49class vtkOutlineSource;
52
54
55class SVTK_Actor;
56class SVTK_AreaPicker;
58
61
62#ifdef WIN32
63#pragma warning ( disable:4251 )
64#endif
65
67
73{
74 public:
75 static SALOME_Actor* New();
76
78
79 //----------------------------------------------------------------------------
81 virtual
82 Standard_Boolean
83 hasIO();
84
86 virtual
88 getIO();
89
91 virtual
92 void
93 setIO(const Handle(SALOME_InteractiveObject)& theIO);
94
96 virtual
97 void
98 setName(const char* theName);
99
100 //----------------------------------------------------------------------------
102 virtual
103 void
104 SetTransform(VTKViewer_Transform* theTransform);
105
107 virtual
108 void
109 SetPosition(double _arg1,
110 double _arg2,
111 double _arg3);
112
114 virtual
115 void
116 SetPosition(double _arg[3]);
117
118 //----------------------------------------------------------------------------
120 virtual
121 void
122 SetVisibility( int );
123
125 virtual
126 bool
127 ShouldBeDisplayed();
128
129 //----------------------------------------------------------------------------
131 virtual
132 void
133 AddToRender(vtkRenderer* theRendere);
134
136 virtual
137 void
138 RemoveFromRender(vtkRenderer* theRendere);
139
141 vtkRenderer*
142 GetRenderer();
143
144 //----------------------------------------------------------------------------
146 virtual
147 void
148 SetInteractor(vtkRenderWindowInteractor* theInteractor);
149
151 virtual
152 void
153 Update();
154
155 //----------------------------------------------------------------------------
157 virtual
158 void
159 SetSelector(SVTK_Selector* theSelector);
160
162 virtual
163 void
164 highlight(bool theHighlight);
165
167 virtual
168 void
169 Highlight(bool theHighlight);
170
171 //----------------------------------------------------------------------------
173 virtual
174 bool
175 PreHighlight(vtkInteractorStyle* theInteractorStyle,
176 SVTK_SelectionEvent* theSelectionEvent,
177 bool theIsHighlight);
178
180 virtual
181 bool
182 Highlight(vtkInteractorStyle* theInteractorStyle,
183 SVTK_SelectionEvent* theSelectionEvent,
184 bool theIsHighlight);
185
186 //----------------------------------------------------------------------------
188 virtual
189 bool
190 IsDisplayNameActor() const;
191
193 virtual
194 void
195 SetIsDisplayNameActor(bool theIsDisplayNameActor);
196
198 virtual
199 void
200 SetNameActorText(const char* theText);
201
203 virtual
204 void
205 SetNameActorOffset(double theOffset[2]);
206
208 virtual
209 void
210 GetNameActorSize(vtkRenderer* theRenderer, double theSize[2]) const;
211
213 virtual
214 void
215 UpdateNameActors();
216
217 //----------------------------------------------------------------------------
219 virtual
220 void
221 SetMarkerStd( VTK::MarkerType, VTK::MarkerScale );
222
224 virtual
225 void
226 SetMarkerTexture( int, VTK::MarkerTexture );
227
229 virtual
231 GetMarkerType();
232
234 virtual
236 GetMarkerScale();
237
239 virtual
240 int
241 GetMarkerTexture();
242
243 //----------------------------------------------------------------------------
245 void
246 SetPointPicker(vtkPointPicker* thePointPicker);
247
249 void
250 SetCellPicker(vtkCellPicker* theCellPicker);
251
253 void
254 SetPointAreaPicker(SVTK_AreaPicker* theAreaPicker);
255
257 void
258 SetCellAreaPicker(SVTK_AreaPicker* theAreaPicker);
259
260 //----------------------------------------------------------------------------
262 double* GetGravityCenter( int );
263
264 //----------------------------------------------------------------------------
266 void
267 SetPreHighlightProperty(vtkProperty* theProperty);
268
270 void
271 SetHighlightProperty(vtkProperty* theProperty);
272
273 protected:
274 //----------------------------------------------------------------------------
276 vtkRenderer* myRenderer;
277
279
282
283 protected:
285 vtkSmartPointer<SVTK_Selector> mySelector;
286
287 //----------------------------------------------------------------------------
288 // Highlight/ Prehighlight devices
289 vtkSmartPointer<vtkPointPicker> myPointPicker;
290 vtkSmartPointer<vtkCellPicker> myCellPicker;
291
292 vtkSmartPointer<SVTK_AreaPicker> myPointAreaPicker;
293 vtkSmartPointer<SVTK_AreaPicker> myCellAreaPicker;
294
295 vtkSmartPointer<SVTK_Actor> myPreHighlightActor;
296 vtkSmartPointer<SVTK_Actor> myHighlightActor;
297
298 vtkSmartPointer<VTKViewer_Actor> myOutlineActor;
299 vtkSmartPointer<vtkOutlineSource> myOutline;
300
302 vtkSmartPointer<VTKViewer_FramedTextActor> myNameActor;
303};
304
305namespace SVTK
306{
308 {
309 vtkAbstractPicker* myPicker;
310 public:
311 TPickLimiter(vtkAbstractPicker*, SALOME_Actor*);
313 };
314}
315
316#ifdef WIN32
317#pragma warning ( default:4251 )
318#endif
319
320#endif // SALOME_ACTOR_H
Handle(TDocStd_Application) CAF_Application
Get OCAF application.
Definition: CAF_Application.cxx:97
int SALOME_LINE_WIDTH
Definition: SALOME_Actor.cxx:82
int SALOME_POINT_SIZE
Definition: SALOME_Actor.cxx:81
Selection_Mode
Definition: SALOME_Selection.h:27
#define SVTK_EXPORT
Definition: SVTK.h:37
The class is a basic one for all SALOME VTK presentation.
Definition: SALOME_Actor.h:73
Handle(SALOME_InteractiveObject) myIO
static SALOME_Actor * New()
vtkSmartPointer< SVTK_Actor > myHighlightActor
Definition: SALOME_Actor.h:296
vtkSmartPointer< SVTK_AreaPicker > myCellAreaPicker
Definition: SALOME_Actor.h:293
bool myIsDisplayNameActor
Definition: SALOME_Actor.h:301
vtkSmartPointer< VTKViewer_Actor > myOutlineActor
Definition: SALOME_Actor.h:298
vtkSmartPointer< VTKViewer_FramedTextActor > myNameActor
Definition: SALOME_Actor.h:302
vtkSmartPointer< vtkCellPicker > myCellPicker
Definition: SALOME_Actor.h:290
vtkSmartPointer< SVTK_Selector > mySelector
Definition: SALOME_Actor.h:285
Selection_Mode mySelectionMode
Definition: SALOME_Actor.h:284
vtkSmartPointer< SVTK_Actor > myPreHighlightActor
Definition: SALOME_Actor.h:295
vtkRenderer * myRenderer
Definition: SALOME_Actor.h:276
vtkSmartPointer< SVTK_AreaPicker > myPointAreaPicker
Definition: SALOME_Actor.h:292
vtkSmartPointer< vtkOutlineSource > myOutline
Definition: SALOME_Actor.h:299
vtkRenderWindowInteractor * myInteractor
Definition: SALOME_Actor.h:275
vtkSmartPointer< vtkPointPicker > myPointPicker
Definition: SALOME_Actor.h:289
vtkTypeMacro(SALOME_Actor, VTKViewer_Actor) virtual Standard_Boolean hasIO()
To check, if the SALOME_Actor has a reference to SALOME_InteractiveObject.
virtual const Handle(SALOME_InteractiveObject) &getIO()
Get correspoinding reference to SALOME_InteractiveObject.
Definition: SALOME_Actor.h:308
vtkAbstractPicker * myPicker
Definition: SALOME_Actor.h:309
This class used for internal SVTK package purpose (highlight and prehighlight)
Definition: SVTK_Actor.h:47
Rectangular picker class.
Definition: SVTK_AreaPicker.h:55
Introduce SALOME way of user interaction.
Definition: SVTK_InteractorStyle.h:158
Define an abstract interface for selection in SVTK package.
Definition: SVTK_Selector.h:58
Definition: VTKViewer_Actor.h:79
virtual void AddToRender(vtkRenderer *theRendere)
To publish the actor an all its internal devices.
Definition: VTKViewer_Actor.cxx:129
virtual void highlight(bool theHighlight)
Just to update visibility of the highlight devices.
Definition: VTKViewer_Actor.cxx:731
virtual void RemoveFromRender(vtkRenderer *theRendere)
To remove the actor an all its internal devices.
Definition: VTKViewer_Actor.cxx:139
virtual void setName(const char *theName)
Name the VTKViewer_Actor.
Definition: VTKViewer_Actor.cxx:119
virtual void SetTransform(VTKViewer_Transform *theTransform)
Apply view transformation.
Definition: VTKViewer_Actor.cxx:158
Definition: VTKViewer_FramedTextActor.h:38
Describes linear transformations via a 4x4 matrix.
Definition: VTKViewer_Transform.h:34
Definition: SALOME_Actor.cxx:148
std::list< unsigned short > MarkerTexture
Definition: VTKViewer_MarkerDef.h:60
The structure is used for passing all infromation necessary for claculation of the selection.
Definition: SVTK_SelectionEvent.h:41