1 // Copyright (C) 2007-2013 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.
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;
49 class VTKViewer_Transform;
50 class VTKViewer_TransformFilter;
51 class VTKViewer_ExtractUnstructuredGrid;
52 class VTKViewer_PolyDataMapper;
54 class SMESH_ExtractGeometry;
55 class SMESH_FaceOrientationFilter;
56 class SMESH_ScalarBarActor;
59 class SMESHOBJECT_EXPORT SMESH_DeviceActor: public vtkLODActor{
60 friend class SMESH_ActorDef;
63 vtkTypeMacro(SMESH_DeviceActor,vtkLODActor);
64 static SMESH_DeviceActor* New();
66 void SetStoreClippingMapping(bool theStoreMapping);
67 void SetStoreGemetryMapping(bool theStoreMapping);
68 void SetStoreIDMapping(bool theStoreMapping);
70 virtual int GetNodeObjId(int theVtkID);
71 virtual double* GetNodeCoord(int theObjID);
73 virtual int GetElemObjId(int theVtkID);
74 virtual vtkCell* GetElemCell(int theObjID);
76 virtual void SetTransform(VTKViewer_Transform* theTransform);
77 virtual unsigned long int GetMTime();
79 virtual void SetFacesOriented(bool theIsFacesOriented);
80 virtual bool GetFacesOriented() { return myIsFacesOriented; }
82 virtual void SetFacesOrientationColor(double r,double g,double b);
83 virtual void GetFacesOrientationColor(double& r,double& g,double& b);
85 virtual void SetFacesOrientationScale(double theScale);
86 virtual double GetFacesOrientationScale();
88 virtual void SetFacesOrientation3DVectors(bool theState);
89 virtual bool GetFacesOrientation3DVectors();
91 //----------------------------------------------------------------------------
92 //! Setting for displaying quadratic elements
93 virtual void SetQuadraticArcMode(bool theFlag);
94 virtual bool GetQuadraticArcMode();
96 virtual void SetQuadraticArcAngle(double theMaxAngle);
97 virtual double GetQuadraticArcAngle();
99 void UpdateFaceOrientation();
101 double GetShrinkFactor();
102 void SetShrinkFactor(double value);
104 bool IsShrunkable() { return myIsShrinkable;}
105 bool IsShrunk() { return myIsShrunk;}
109 enum EReperesent { ePoint, eWireframe, eSurface, eInsideframe};
110 EReperesent GetRepresentation(){ return myRepresentation;}
111 void SetRepresentation(EReperesent theMode);
113 virtual void SetVisibility(int theMode);
114 virtual int GetVisibility();
116 virtual void AddToRender(vtkRenderer* theRenderer);
117 virtual void RemoveFromRender(vtkRenderer* theRenderer);
119 VTKViewer_ExtractUnstructuredGrid* GetExtractUnstructuredGrid();
120 vtkUnstructuredGrid* GetUnstructuredGrid();
122 void SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
123 SMESH_ScalarBarActor* theScalarBarActor,
124 vtkLookupTable* theLookupTable);
125 void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
126 SMESH_ScalarBarActor* theScalarBarActor,
127 vtkLookupTable* theLookupTable);
128 void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor);
130 bool IsHighlited() { return myIsHighlited;}
131 void SetHighlited(bool theIsHighlited);
135 SetCoincident3DAllowed(bool theIsFeatureEdgesAllowed);
139 IsCoincident3DAllowed() const;
141 virtual void Render(vtkRenderer *, vtkMapper *);
143 void SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed);
144 bool IsImplicitFunctionUsed() const{ return myIsImplicitFunctionUsed;}
146 void SetMarkerEnabled( bool );
147 void SetMarkerStd( VTK::MarkerType, VTK::MarkerScale );
148 void SetMarkerTexture( int, VTK::MarkerTexture );
149 VTK::MarkerType GetMarkerType();
150 VTK::MarkerScale GetMarkerScale();
151 int GetMarkerTexture();
154 void Init(TVisualObjPtr theVisualObj, vtkImplicitBoolean* theImplicitBoolean);
155 void SetUnstructuredGrid(vtkUnstructuredGrid* theGrid);
157 VTKViewer_PolyDataMapper *myMapper;
158 TVisualObjPtr myVisualObj;
160 vtkProperty *myProperty;
161 EReperesent myRepresentation;
163 SMESH_ExtractGeometry* myExtractGeometry;
164 bool myIsImplicitFunctionUsed;
166 vtkMergeFilter* myMergeFilter;
167 VTKViewer_ExtractUnstructuredGrid* myExtractUnstructuredGrid;
169 bool myIsFacesOriented;
170 SMESH_FaceOrientationFilter* myFaceOrientationFilter;
171 vtkPolyDataMapper* myFaceOrientationDataMapper;
172 vtkActor* myFaceOrientation;
174 bool myStoreClippingMapping;
175 VTKViewer_GeometryFilter *myGeomFilter;
176 VTKViewer_TransformFilter *myTransformFilter;
177 std::vector<vtkPassThroughFilter*> myPassFilter;
179 vtkShrinkFilter* myShrinkFilter;
185 double myPolygonOffsetFactor;
186 double myPolygonOffsetUnits;
189 SetPolygonOffsetParameters(double factor,
193 GetPolygonOffsetParameters(double& factor,
196 factor = myPolygonOffsetFactor;
197 units = myPolygonOffsetUnits;
201 ~SMESH_DeviceActor();
202 SMESH_DeviceActor(const SMESH_DeviceActor&);
203 void operator=(const SMESH_DeviceActor&);
208 #endif //SMESH_DEVICE_ACTOR_H