Version: 9.16.0
SMESH_DeviceActor.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// SMESH OBJECT : interactive object for SMESH visualization
24// File : SMESH_DeviceActor.h
25// Author : Nicolas REJNERI
26// Module : SMESH
27// $Header$
28//
29#ifndef SMESH_DEVICE_ACTOR_H
30#define SMESH_DEVICE_ACTOR_H
31
32#include <VTKViewer_GeometryFilter.h>
33#include <VTKViewer_MarkerDef.h>
34#include "SMESH_Controls.hxx"
35#include "SMESH_Object.h"
36
37#include <vtkLODActor.h>
38#include <vtkSmartPointer.h>
39
40class vtkCell;
41class vtkProperty;
42class vtkMergeFilter;
43class vtkShrinkFilter;
45class vtkLookupTable;
46class vtkImplicitBoolean;
47class vtkPassThrough;
48class vtkPlaneCollection;
49class vtkTriangleFilter;
50
51class VTKViewer_Transform;
52class VTKViewer_TransformFilter;
53class VTKViewer_ExtractUnstructuredGrid;
54class VTKViewer_PolyDataMapper;
55
59
60
62 friend class SMESH_ActorDef;
63
64 public:
66 static SMESH_DeviceActor* New();
67
68 void SetStoreClippingMapping(bool theStoreMapping);
69 void SetStoreGemetryMapping(bool theStoreMapping);
70 void SetStoreIDMapping(bool theStoreMapping);
71
72 virtual vtkIdType GetNodeObjId(vtkIdType theVtkID);
73 virtual double* GetNodeCoord(vtkIdType theObjID);
74 virtual vtkIdType GetNodeVtkId(vtkIdType theObjID);
75
76 virtual vtkIdType GetElemObjId(vtkIdType theVtkID);
77 virtual vtkCell* GetElemCell(vtkIdType theObjID);
78
79 virtual void SetTransform(VTKViewer_Transform* theTransform);
80 virtual vtkMTimeType GetMTime();
81
82 virtual void SetFacesOriented(bool theIsFacesOriented);
83 virtual bool GetFacesOriented() { return myIsFacesOriented; }
84
85 virtual void SetFacesOrientationColor(double r,double g,double b);
86 virtual void GetFacesOrientationColor(double& r,double& g,double& b);
87
88 virtual void SetFacesOrientationScale(double theScale);
89 virtual double GetFacesOrientationScale();
90
91 virtual void SetFacesOrientation3DVectors(bool theState);
92 virtual bool GetFacesOrientation3DVectors();
93
94 //----------------------------------------------------------------------------
96 virtual void SetQuadraticArcMode(bool theFlag);
97 virtual bool GetQuadraticArcMode();
98
99 virtual void SetQuadraticArcAngle(double theMaxAngle);
100 virtual double GetQuadraticArcAngle();
101
102 void UpdateFaceOrientation();
103
104 double GetShrinkFactor();
105 void SetShrinkFactor(double value);
106
107 bool IsShrunkable() { return myIsShrinkable;}
108 bool IsShrunk() { return myIsShrunk;}
109 void SetShrink();
110 void UnShrink();
111
112 enum EReperesent { ePoint, eWireframe, eSurface, eInsideframe, eNoneRepr=-1};
113 EReperesent GetRepresentation(){ return myRepresentation;}
114 void SetRepresentation(EReperesent theMode);
115
116 virtual void SetVisibility(int theMode);
117 virtual int GetVisibility();
118
119 virtual void AddToRender(vtkRenderer* theRenderer);
120 virtual void RemoveFromRender(vtkRenderer* theRenderer);
121
122 VTKViewer_ExtractUnstructuredGrid* GetExtractUnstructuredGrid();
124
125 void SetPlaneCollection( vtkPlaneCollection* theCollection );
126
128 SMESH_ScalarBarActor* theScalarBarActor,
129 vtkLookupTable* theLookupTable);
130 void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
131 SMESH_ScalarBarActor* theScalarBarActor,
132 vtkLookupTable* theLookupTable);
133 void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor);
134
135 bool IsHighlited() { return myIsHighlited;}
136 void SetHighlited(bool theIsHighlited);
137
138 virtual
139 void
140 SetCoincident3DAllowed(bool theIsFeatureEdgesAllowed);
141
142 virtual
143 bool
144 IsCoincident3DAllowed() const;
145
146 virtual void Render(vtkRenderer *, vtkMapper *);
147
148 void SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed);
149 bool IsImplicitFunctionUsed() const{ return myIsImplicitFunctionUsed;}
150
151 void SetMarkerEnabled( bool );
152 void SetBallEnabled( bool );
153 void SetBallScale( double );
154 void SetMarkerStd( VTK::MarkerType, VTK::MarkerScale );
155 void SetMarkerTexture( int, VTK::MarkerTexture );
156 VTK::MarkerType GetMarkerType();
157 VTK::MarkerScale GetMarkerScale();
158 int GetMarkerTexture();
159 double GetBallScale();
160
161 protected:
162 void Init(TVisualObjPtr theVisualObj, vtkImplicitBoolean* theImplicitBoolean);
163 void SetUnstructuredGrid(vtkUnstructuredGrid* theGrid);
164
165 VTKViewer_PolyDataMapper *myMapper;
167
169
170 vtkProperty *myProperty;
172
175
176 vtkMergeFilter* myMergeFilter;
177 VTKViewer_ExtractUnstructuredGrid* myExtractUnstructuredGrid;
178
181 vtkPolyDataMapper* myFaceOrientationDataMapper;
183
185 VTKViewer_GeometryFilter *myGeomFilter;
186 vtkTriangleFilter* myTriangleFilter = nullptr;
187 VTKViewer_TransformFilter *myTransformFilter;
188 std::vector<vtkPassThrough*> myPassFilter;
189
190 vtkShrinkFilter* myShrinkFilter;
193
195
198
199 void
200 SetPolygonOffsetParameters(double factor,
201 double units);
202
203 void
205 double& units)
206 {
207 factor = myPolygonOffsetFactor;
208 units = myPolygonOffsetUnits;
209 }
210
215
216};
217
218
219#endif //SMESH_DEVICE_ACTOR_H
unsigned long int vtkMTimeType
Definition: SMDS_UnstructuredGrid.hxx:53
boost::shared_ptr< SMESH_VisualObj > TVisualObjPtr
Definition: SMESH_Object.h:88
#define SMESHOBJECT_EXPORT
Definition: SMESH_Object.h:38
Definition: SMESH_ActorDef.h:81
virtual void AddToRender(vtkRenderer *theRenderer)
Definition: SMESH_Actor.cxx:1187
virtual double * GetNodeCoord(vtkIdType theObjID)
Definition: SMESH_Actor.cxx:1481
virtual void SetFacesOrientationColor(double r, double g, double b)
Definition: SMESH_Actor.cxx:776
virtual void SetFacesOriented(bool theIsFacesOriented)
Definition: SMESH_Actor.cxx:761
virtual void SetTransform(VTKViewer_Transform *theTransform)
Definition: SMESH_Actor.cxx:1346
virtual void SetShrinkFactor(double theValue)
Definition: SMESH_Actor.cxx:1420
virtual vtkUnstructuredGrid * GetUnstructuredGrid()
Definition: SMESH_Actor.cxx:1391
virtual void RemoveFromRender(vtkRenderer *theRenderer)
Definition: SMESH_Actor.cxx:1216
virtual double GetFacesOrientationScale()
Definition: SMESH_Actor.cxx:793
virtual void SetShrink()
Definition: SMESH_Actor.cxx:1437
virtual vtkIdType GetNodeVtkId(vtkIdType theObjID)
Definition: SMESH_Actor.cxx:1486
virtual void SetMarkerTexture(int, VTK::MarkerTexture)
Definition: SMESH_Actor.cxx:2642
virtual void SetVisibility(int theMode)
Definition: SMESH_Actor.cxx:1502
void SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed)
Definition: SMESH_Actor.cxx:2270
virtual bool GetFacesOrientation3DVectors()
Definition: SMESH_Actor.cxx:804
virtual void SetMarkerStd(VTK::MarkerType, VTK::MarkerScale)
Definition: SMESH_Actor.cxx:2635
virtual void SetFacesOrientationScale(double theScale)
Definition: SMESH_Actor.cxx:787
virtual void UnShrink()
Definition: SMESH_Actor.cxx:1456
bool myIsFacesOriented
Definition: SMESH_ActorDef.h:325
virtual void SetBallScale(double size)
Definition: SMESH_Actor.cxx:2247
virtual vtkIdType GetNodeObjId(vtkIdType theVtkID)
Definition: SMESH_Actor.cxx:1476
virtual void SetRepresentation(int theMode)
Definition: SMESH_Actor.cxx:1695
virtual vtkCell * GetElemCell(vtkIdType theObjID)
Definition: SMESH_Actor.cxx:1496
virtual double GetShrinkFactor()
Definition: SMESH_Actor.cxx:1415
virtual vtkIdType GetElemObjId(vtkIdType theVtkID)
Definition: SMESH_Actor.cxx:1491
virtual void Render(vtkRenderer *ren)
Definition: SMESH_Actor.cxx:1949
bool myIsShrinkable
Definition: SMESH_ActorDef.h:311
virtual void SetFacesOrientation3DVectors(bool theState)
Definition: SMESH_Actor.cxx:798
static SMESH_ActorDef * New()
Definition: SMESH_Actor.cxx:89
virtual void GetFacesOrientationColor(double &r, double &g, double &b)
Definition: SMESH_Actor.cxx:782
virtual double GetBallScale()
Definition: SMESH_Actor.cxx:2242
bool Init(TVisualObjPtr theVisualObj, const char *theEntry, const char *theName, int theIsClear)
Definition: SMESH_Actor.cxx:1243
bool myIsShrunk
Definition: SMESH_ActorDef.h:312
virtual void SetControlMode(eControl theMode)
Definition: SMESH_Actor.cxx:819
EReperesent
Definition: SMESH_Actor.h:104
@ eSurface
Definition: SMESH_Actor.h:104
@ ePoint
Definition: SMESH_Actor.h:104
Definition: SMESH_DeviceActor.h:61
void GetPolygonOffsetParameters(double &factor, double &units)
Definition: SMESH_DeviceActor.h:204
bool IsHighlited()
Definition: SMESH_DeviceActor.h:135
double myPolygonOffsetUnits
Definition: SMESH_DeviceActor.h:197
TVisualObjPtr myVisualObj
Definition: SMESH_DeviceActor.h:166
bool IsShrunk()
Definition: SMESH_DeviceActor.h:108
SMESH_DeviceActor(const SMESH_DeviceActor &)
double myPolygonOffsetFactor
Definition: SMESH_DeviceActor.h:196
bool myStoreClippingMapping
Definition: SMESH_DeviceActor.h:184
bool myIsFacesOriented
Definition: SMESH_DeviceActor.h:179
VTKViewer_ExtractUnstructuredGrid * myExtractUnstructuredGrid
Definition: SMESH_DeviceActor.h:177
EReperesent myRepresentation
Definition: SMESH_DeviceActor.h:171
bool myIsHighlited
Definition: SMESH_DeviceActor.h:194
virtual bool GetFacesOriented()
Definition: SMESH_DeviceActor.h:83
bool IsImplicitFunctionUsed() const
Definition: SMESH_DeviceActor.h:149
vtkSmartPointer< vtkPlaneCollection > myPlaneCollection
Definition: SMESH_DeviceActor.h:168
void operator=(const SMESH_DeviceActor &)
bool myIsShrunk
Definition: SMESH_DeviceActor.h:192
vtkTypeMacro(SMESH_DeviceActor, vtkLODActor) static SMESH_DeviceActor *New()
EReperesent GetRepresentation()
Definition: SMESH_DeviceActor.h:113
vtkActor * myFaceOrientation
Definition: SMESH_DeviceActor.h:182
SMESH_ExtractGeometry * myExtractGeometry
Definition: SMESH_DeviceActor.h:173
bool myIsImplicitFunctionUsed
Definition: SMESH_DeviceActor.h:174
EReperesent
Definition: SMESH_DeviceActor.h:112
@ eInsideframe
Definition: SMESH_DeviceActor.h:112
vtkMergeFilter * myMergeFilter
Definition: SMESH_DeviceActor.h:176
vtkPolyDataMapper * myFaceOrientationDataMapper
Definition: SMESH_DeviceActor.h:181
VTKViewer_GeometryFilter * myGeomFilter
Definition: SMESH_DeviceActor.h:185
bool IsShrunkable()
Definition: SMESH_DeviceActor.h:107
std::vector< vtkPassThrough * > myPassFilter
Definition: SMESH_DeviceActor.h:188
SMESH_FaceOrientationFilter * myFaceOrientationFilter
Definition: SMESH_DeviceActor.h:180
VTKViewer_PolyDataMapper * myMapper
Definition: SMESH_DeviceActor.h:165
vtkProperty * myProperty
Definition: SMESH_DeviceActor.h:170
vtkShrinkFilter * myShrinkFilter
Definition: SMESH_DeviceActor.h:190
bool myIsShrinkable
Definition: SMESH_DeviceActor.h:191
VTKViewer_TransformFilter * myTransformFilter
Definition: SMESH_DeviceActor.h:187
Definition: SMESH_ExtractGeometry.h:33
Passive filter take a polydata as input and create a dataset as output.
Definition: SMESH_FaceOrientationFilter.h:34
Definition: SMESH_ScalarBarActor.h:90
boost::shared_ptr< Functor > FunctorPtr
Definition: SMESH_Controls.hxx:60