1 // Copyright (C) 2007-2011 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 vtkFloatingPointType* 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(vtkFloatingPointType theColor[3]);
83 virtual void GetFacesOrientationColor(vtkFloatingPointType theColor[3]);
85 virtual void SetFacesOrientationScale(vtkFloatingPointType theScale);
86 virtual vtkFloatingPointType 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(vtkFloatingPointType theMaxAngle);
97 virtual vtkFloatingPointType GetQuadraticArcAngle();
99 void UpdateFaceOrientation();
101 vtkFloatingPointType GetShrinkFactor();
102 void SetShrinkFactor(vtkFloatingPointType 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);
133 virtual void Render(vtkRenderer *, vtkMapper *);
135 void SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed);
136 bool IsImplicitFunctionUsed() const{ return myIsImplicitFunctionUsed;}
138 void SetMarkerEnabled( bool );
139 void SetMarkerStd( VTK::MarkerType, VTK::MarkerScale );
140 void SetMarkerTexture( int, VTK::MarkerTexture );
141 VTK::MarkerType GetMarkerType();
142 VTK::MarkerScale GetMarkerScale();
143 int GetMarkerTexture();
146 void Init(TVisualObjPtr theVisualObj, vtkImplicitBoolean* theImplicitBoolean);
147 void SetUnstructuredGrid(vtkUnstructuredGrid* theGrid);
149 VTKViewer_PolyDataMapper *myMapper;
150 TVisualObjPtr myVisualObj;
152 vtkProperty *myProperty;
153 EReperesent myRepresentation;
155 SMESH_ExtractGeometry* myExtractGeometry;
156 bool myIsImplicitFunctionUsed;
158 vtkMergeFilter* myMergeFilter;
159 VTKViewer_ExtractUnstructuredGrid* myExtractUnstructuredGrid;
161 bool myIsFacesOriented;
162 SMESH_FaceOrientationFilter* myFaceOrientationFilter;
163 vtkPolyDataMapper* myFaceOrientationDataMapper;
164 vtkActor* myFaceOrientation;
166 bool myStoreClippingMapping;
167 VTKViewer_GeometryFilter *myGeomFilter;
168 VTKViewer_TransformFilter *myTransformFilter;
169 std::vector<vtkPassThroughFilter*> myPassFilter;
171 vtkShrinkFilter* myShrinkFilter;
177 vtkFloatingPointType myPolygonOffsetFactor;
178 vtkFloatingPointType myPolygonOffsetUnits;
181 SetPolygonOffsetParameters(vtkFloatingPointType factor,
182 vtkFloatingPointType units);
185 GetPolygonOffsetParameters(vtkFloatingPointType& factor,
186 vtkFloatingPointType& units)
188 factor = myPolygonOffsetFactor;
189 units = myPolygonOffsetUnits;
193 ~SMESH_DeviceActor();
194 SMESH_DeviceActor(const SMESH_DeviceActor&);
195 void operator=(const SMESH_DeviceActor&);
200 #endif //SMESH_DEVICE_ACTOR_H