1 // Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SMESH OBJECT : interactive object for SMESH visualization
24 // File : SMESH_DeviceActor.h
25 // Author : Nicolas REJNERI
29 #ifndef SMESH_DEVICE_ACTOR_H
30 #define SMESH_DEVICE_ACTOR_H
32 #include <VTKViewer_GeometryFilter.h>
33 #include <VTKViewer_MarkerDef.h>
34 #include "SMESH_Controls.hxx"
35 #include "SMESH_Object.h"
37 #include <vtkLODActor.h>
38 #include <vtkSmartPointer.h>
43 class vtkShrinkFilter;
44 class vtkUnstructuredGrid;
46 class vtkImplicitBoolean;
47 class vtkPassThroughFilter;
48 class vtkPlaneCollection;
50 class VTKViewer_Transform;
51 class VTKViewer_TransformFilter;
52 class VTKViewer_ExtractUnstructuredGrid;
53 class VTKViewer_PolyDataMapper;
55 class SMESH_ExtractGeometry;
56 class SMESH_FaceOrientationFilter;
57 class SMESH_ScalarBarActor;
60 class SMESHOBJECT_EXPORT SMESH_DeviceActor: public vtkLODActor{
61 friend class SMESH_ActorDef;
64 vtkTypeMacro(SMESH_DeviceActor,vtkLODActor);
65 static SMESH_DeviceActor* New();
67 void SetStoreClippingMapping(bool theStoreMapping);
68 void SetStoreGemetryMapping(bool theStoreMapping);
69 void SetStoreIDMapping(bool theStoreMapping);
71 virtual int GetNodeObjId(int theVtkID);
72 virtual double* GetNodeCoord(int theObjID);
73 virtual int GetNodeVtkId(int theObjID);
75 virtual int GetElemObjId(int theVtkID);
76 virtual vtkCell* GetElemCell(int theObjID);
78 virtual void SetTransform(VTKViewer_Transform* theTransform);
79 virtual vtkMTimeType GetMTime();
81 virtual void SetFacesOriented(bool theIsFacesOriented);
82 virtual bool GetFacesOriented() { return myIsFacesOriented; }
84 virtual void SetFacesOrientationColor(double r,double g,double b);
85 virtual void GetFacesOrientationColor(double& r,double& g,double& b);
87 virtual void SetFacesOrientationScale(double theScale);
88 virtual double GetFacesOrientationScale();
90 virtual void SetFacesOrientation3DVectors(bool theState);
91 virtual bool GetFacesOrientation3DVectors();
93 //----------------------------------------------------------------------------
94 //! Setting for displaying quadratic elements
95 virtual void SetQuadraticArcMode(bool theFlag);
96 virtual bool GetQuadraticArcMode();
98 virtual void SetQuadraticArcAngle(double theMaxAngle);
99 virtual double GetQuadraticArcAngle();
101 void UpdateFaceOrientation();
103 double GetShrinkFactor();
104 void SetShrinkFactor(double value);
106 bool IsShrunkable() { return myIsShrinkable;}
107 bool IsShrunk() { return myIsShrunk;}
111 enum EReperesent { ePoint, eWireframe, eSurface, eInsideframe};
112 EReperesent GetRepresentation(){ return myRepresentation;}
113 void SetRepresentation(EReperesent theMode);
115 virtual void SetVisibility(int theMode);
116 virtual int GetVisibility();
118 virtual void AddToRender(vtkRenderer* theRenderer);
119 virtual void RemoveFromRender(vtkRenderer* theRenderer);
121 VTKViewer_ExtractUnstructuredGrid* GetExtractUnstructuredGrid();
122 vtkUnstructuredGrid* GetUnstructuredGrid();
124 void SetPlaneCollection( vtkPlaneCollection* theCollection );
126 void SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
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);
134 bool IsHighlited() { return myIsHighlited;}
135 void SetHighlited(bool theIsHighlited);
139 SetCoincident3DAllowed(bool theIsFeatureEdgesAllowed);
143 IsCoincident3DAllowed() const;
145 virtual void Render(vtkRenderer *, vtkMapper *);
147 void SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed);
148 bool IsImplicitFunctionUsed() const{ return myIsImplicitFunctionUsed;}
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();
161 void Init(TVisualObjPtr theVisualObj, vtkImplicitBoolean* theImplicitBoolean);
162 void SetUnstructuredGrid(vtkUnstructuredGrid* theGrid);
164 VTKViewer_PolyDataMapper *myMapper;
165 TVisualObjPtr myVisualObj;
167 vtkSmartPointer<vtkPlaneCollection> myPlaneCollection;
169 vtkProperty *myProperty;
170 EReperesent myRepresentation;
172 SMESH_ExtractGeometry* myExtractGeometry;
173 bool myIsImplicitFunctionUsed;
175 vtkMergeFilter* myMergeFilter;
176 VTKViewer_ExtractUnstructuredGrid* myExtractUnstructuredGrid;
178 bool myIsFacesOriented;
179 SMESH_FaceOrientationFilter* myFaceOrientationFilter;
180 vtkPolyDataMapper* myFaceOrientationDataMapper;
181 vtkActor* myFaceOrientation;
183 bool myStoreClippingMapping;
184 VTKViewer_GeometryFilter *myGeomFilter;
185 VTKViewer_TransformFilter *myTransformFilter;
186 std::vector<vtkPassThroughFilter*> myPassFilter;
188 vtkShrinkFilter* myShrinkFilter;
194 double myPolygonOffsetFactor;
195 double myPolygonOffsetUnits;
198 SetPolygonOffsetParameters(double factor,
202 GetPolygonOffsetParameters(double& factor,
205 factor = myPolygonOffsetFactor;
206 units = myPolygonOffsetUnits;
210 ~SMESH_DeviceActor();
211 SMESH_DeviceActor(const SMESH_DeviceActor&);
212 void operator=(const SMESH_DeviceActor&);
217 #endif //SMESH_DEVICE_ACTOR_H