Version: 9.12.0
SMESH_DeviceActor.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2023 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 
40 class vtkCell;
41 class vtkProperty;
42 class vtkMergeFilter;
43 class vtkShrinkFilter;
45 class vtkLookupTable;
46 class vtkImplicitBoolean;
47 class vtkPassThrough;
48 class vtkPlaneCollection;
49 
50 class VTKViewer_Transform;
51 class VTKViewer_TransformFilter;
52 class VTKViewer_ExtractUnstructuredGrid;
53 class VTKViewer_PolyDataMapper;
54 
58 
59 
61  friend class SMESH_ActorDef;
62 
63  public:
65  static SMESH_DeviceActor* New();
66 
67  void SetStoreClippingMapping(bool theStoreMapping);
68  void SetStoreGemetryMapping(bool theStoreMapping);
69  void SetStoreIDMapping(bool theStoreMapping);
70 
71  virtual vtkIdType GetNodeObjId(vtkIdType theVtkID);
72  virtual double* GetNodeCoord(vtkIdType theObjID);
73  virtual vtkIdType GetNodeVtkId(vtkIdType theObjID);
74 
75  virtual vtkIdType GetElemObjId(vtkIdType theVtkID);
76  virtual vtkCell* GetElemCell(vtkIdType theObjID);
77 
78  virtual void SetTransform(VTKViewer_Transform* theTransform);
79  virtual vtkMTimeType GetMTime();
80 
81  virtual void SetFacesOriented(bool theIsFacesOriented);
82  virtual bool GetFacesOriented() { return myIsFacesOriented; }
83 
84  virtual void SetFacesOrientationColor(double r,double g,double b);
85  virtual void GetFacesOrientationColor(double& r,double& g,double& b);
86 
87  virtual void SetFacesOrientationScale(double theScale);
88  virtual double GetFacesOrientationScale();
89 
90  virtual void SetFacesOrientation3DVectors(bool theState);
91  virtual bool GetFacesOrientation3DVectors();
92 
93  //----------------------------------------------------------------------------
95  virtual void SetQuadraticArcMode(bool theFlag);
96  virtual bool GetQuadraticArcMode();
97 
98  virtual void SetQuadraticArcAngle(double theMaxAngle);
99  virtual double GetQuadraticArcAngle();
100 
101  void UpdateFaceOrientation();
102 
103  double GetShrinkFactor();
104  void SetShrinkFactor(double value);
105 
106  bool IsShrunkable() { return myIsShrinkable;}
107  bool IsShrunk() { return myIsShrunk;}
108  void SetShrink();
109  void UnShrink();
110 
111  enum EReperesent { ePoint, eWireframe, eSurface, eInsideframe, eNoneRepr=-1};
112  EReperesent GetRepresentation(){ return myRepresentation;}
113  void SetRepresentation(EReperesent theMode);
114 
115  virtual void SetVisibility(int theMode);
116  virtual int GetVisibility();
117 
118  virtual void AddToRender(vtkRenderer* theRenderer);
119  virtual void RemoveFromRender(vtkRenderer* theRenderer);
120 
121  VTKViewer_ExtractUnstructuredGrid* GetExtractUnstructuredGrid();
123 
124  void SetPlaneCollection( vtkPlaneCollection* theCollection );
125 
127  SMESH_ScalarBarActor* theScalarBarActor,
128  vtkLookupTable* theLookupTable);
129  void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
130  SMESH_ScalarBarActor* theScalarBarActor,
131  vtkLookupTable* theLookupTable);
132  void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor);
133 
134  bool IsHighlited() { return myIsHighlited;}
135  void SetHighlited(bool theIsHighlited);
136 
137  virtual
138  void
139  SetCoincident3DAllowed(bool theIsFeatureEdgesAllowed);
140 
141  virtual
142  bool
143  IsCoincident3DAllowed() const;
144 
145  virtual void Render(vtkRenderer *, vtkMapper *);
146 
147  void SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed);
148  bool IsImplicitFunctionUsed() const{ return myIsImplicitFunctionUsed;}
149 
150  void SetMarkerEnabled( bool );
151  void SetBallEnabled( bool );
152  void SetBallScale( double );
153  void SetMarkerStd( VTK::MarkerType, VTK::MarkerScale );
154  void SetMarkerTexture( int, VTK::MarkerTexture );
155  VTK::MarkerType GetMarkerType();
156  VTK::MarkerScale GetMarkerScale();
157  int GetMarkerTexture();
158  double GetBallScale();
159 
160  protected:
161  void Init(TVisualObjPtr theVisualObj, vtkImplicitBoolean* theImplicitBoolean);
162  void SetUnstructuredGrid(vtkUnstructuredGrid* theGrid);
163 
164  VTKViewer_PolyDataMapper *myMapper;
166 
168 
169  vtkProperty *myProperty;
171 
174 
175  vtkMergeFilter* myMergeFilter;
176  VTKViewer_ExtractUnstructuredGrid* myExtractUnstructuredGrid;
177 
180  vtkPolyDataMapper* myFaceOrientationDataMapper;
181  vtkActor* myFaceOrientation;
182 
184  VTKViewer_GeometryFilter *myGeomFilter;
185  VTKViewer_TransformFilter *myTransformFilter;
186  std::vector<vtkPassThrough*> myPassFilter;
187 
188  vtkShrinkFilter* myShrinkFilter;
191 
193 
196 
197  void
198  SetPolygonOffsetParameters(double factor,
199  double units);
200 
201  void
202  GetPolygonOffsetParameters(double& factor,
203  double& units)
204  {
205  factor = myPolygonOffsetFactor;
206  units = myPolygonOffsetUnits;
207  }
208 
213 
214 };
215 
216 
217 #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:1175
virtual double * GetNodeCoord(vtkIdType theObjID)
Definition: SMESH_Actor.cxx:1469
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:1334
virtual void SetShrinkFactor(double theValue)
Definition: SMESH_Actor.cxx:1408
virtual vtkUnstructuredGrid * GetUnstructuredGrid()
Definition: SMESH_Actor.cxx:1379
virtual void RemoveFromRender(vtkRenderer *theRenderer)
Definition: SMESH_Actor.cxx:1204
virtual double GetFacesOrientationScale()
Definition: SMESH_Actor.cxx:793
virtual void SetShrink()
Definition: SMESH_Actor.cxx:1425
virtual vtkIdType GetNodeVtkId(vtkIdType theObjID)
Definition: SMESH_Actor.cxx:1474
virtual void SetMarkerTexture(int, VTK::MarkerTexture)
Definition: SMESH_Actor.cxx:2606
virtual void SetVisibility(int theMode)
Definition: SMESH_Actor.cxx:1490
void SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed)
Definition: SMESH_Actor.cxx:2256
virtual bool GetFacesOrientation3DVectors()
Definition: SMESH_Actor.cxx:804
virtual void SetMarkerStd(VTK::MarkerType, VTK::MarkerScale)
Definition: SMESH_Actor.cxx:2599
virtual void SetFacesOrientationScale(double theScale)
Definition: SMESH_Actor.cxx:787
virtual void UnShrink()
Definition: SMESH_Actor.cxx:1444
bool myIsFacesOriented
Definition: SMESH_ActorDef.h:324
virtual void SetBallScale(double size)
Definition: SMESH_Actor.cxx:2233
virtual vtkIdType GetNodeObjId(vtkIdType theVtkID)
Definition: SMESH_Actor.cxx:1464
virtual void SetRepresentation(int theMode)
Definition: SMESH_Actor.cxx:1681
virtual vtkCell * GetElemCell(vtkIdType theObjID)
Definition: SMESH_Actor.cxx:1484
virtual double GetShrinkFactor()
Definition: SMESH_Actor.cxx:1403
virtual vtkIdType GetElemObjId(vtkIdType theVtkID)
Definition: SMESH_Actor.cxx:1479
virtual void Render(vtkRenderer *ren)
Definition: SMESH_Actor.cxx:1935
bool myIsShrinkable
Definition: SMESH_ActorDef.h:310
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:2228
bool Init(TVisualObjPtr theVisualObj, const char *theEntry, const char *theName, int theIsClear)
Definition: SMESH_Actor.cxx:1231
bool myIsShrunk
Definition: SMESH_ActorDef.h:311
virtual void SetControlMode(eControl theMode)
Definition: SMESH_Actor.cxx:819
EReperesent
Definition: SMESH_Actor.h:103
@ eSurface
Definition: SMESH_Actor.h:103
@ ePoint
Definition: SMESH_Actor.h:103
Definition: SMESH_DeviceActor.h:60
void GetPolygonOffsetParameters(double &factor, double &units)
Definition: SMESH_DeviceActor.h:202
bool IsHighlited()
Definition: SMESH_DeviceActor.h:134
double myPolygonOffsetUnits
Definition: SMESH_DeviceActor.h:195
TVisualObjPtr myVisualObj
Definition: SMESH_DeviceActor.h:165
bool IsShrunk()
Definition: SMESH_DeviceActor.h:107
SMESH_DeviceActor(const SMESH_DeviceActor &)
double myPolygonOffsetFactor
Definition: SMESH_DeviceActor.h:194
bool myStoreClippingMapping
Definition: SMESH_DeviceActor.h:183
bool myIsFacesOriented
Definition: SMESH_DeviceActor.h:178
VTKViewer_ExtractUnstructuredGrid * myExtractUnstructuredGrid
Definition: SMESH_DeviceActor.h:176
EReperesent myRepresentation
Definition: SMESH_DeviceActor.h:170
bool myIsHighlited
Definition: SMESH_DeviceActor.h:192
virtual bool GetFacesOriented()
Definition: SMESH_DeviceActor.h:82
bool IsImplicitFunctionUsed() const
Definition: SMESH_DeviceActor.h:148
vtkSmartPointer< vtkPlaneCollection > myPlaneCollection
Definition: SMESH_DeviceActor.h:167
void operator=(const SMESH_DeviceActor &)
bool myIsShrunk
Definition: SMESH_DeviceActor.h:190
vtkTypeMacro(SMESH_DeviceActor, vtkLODActor) static SMESH_DeviceActor *New()
EReperesent GetRepresentation()
Definition: SMESH_DeviceActor.h:112
vtkActor * myFaceOrientation
Definition: SMESH_DeviceActor.h:181
SMESH_ExtractGeometry * myExtractGeometry
Definition: SMESH_DeviceActor.h:172
bool myIsImplicitFunctionUsed
Definition: SMESH_DeviceActor.h:173
EReperesent
Definition: SMESH_DeviceActor.h:111
@ eInsideframe
Definition: SMESH_DeviceActor.h:111
vtkMergeFilter * myMergeFilter
Definition: SMESH_DeviceActor.h:175
vtkPolyDataMapper * myFaceOrientationDataMapper
Definition: SMESH_DeviceActor.h:180
VTKViewer_GeometryFilter * myGeomFilter
Definition: SMESH_DeviceActor.h:184
bool IsShrunkable()
Definition: SMESH_DeviceActor.h:106
std::vector< vtkPassThrough * > myPassFilter
Definition: SMESH_DeviceActor.h:186
SMESH_FaceOrientationFilter * myFaceOrientationFilter
Definition: SMESH_DeviceActor.h:179
VTKViewer_PolyDataMapper * myMapper
Definition: SMESH_DeviceActor.h:164
vtkProperty * myProperty
Definition: SMESH_DeviceActor.h:169
vtkShrinkFilter * myShrinkFilter
Definition: SMESH_DeviceActor.h:188
bool myIsShrinkable
Definition: SMESH_DeviceActor.h:189
VTKViewer_TransformFilter * myTransformFilter
Definition: SMESH_DeviceActor.h:185
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