1 // SMESH OBJECT : interactive object for SMESH visualization
3 // Copyright (C) 2003 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
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 "SMESH_Controls.hxx"
34 #include "SMESH_Object.h"
36 #include <vtkLODActor.h>
37 #include <vtkSmartPointer.h>
42 class vtkShrinkFilter;
43 class vtkPolyDataMapper;
44 class vtkUnstructuredGrid;
45 class vtkScalarBarActor;
47 class vtkImplicitBoolean;
48 class vtkPassThroughFilter;
50 class VTKViewer_Transform;
51 class VTKViewer_TransformFilter;
52 class VTKViewer_ExtractUnstructuredGrid;
54 class SMESH_ExtractGeometry;
55 class SMESH_FaceOrientationFilter;
58 class SMESHOBJECT_EXPORT SMESH_DeviceActor: public vtkLODActor{
59 friend class SMESH_ActorDef;
62 vtkTypeMacro(SMESH_DeviceActor,vtkLODActor);
63 static SMESH_DeviceActor* New();
65 void SetStoreClippingMapping(bool theStoreMapping);
66 void SetStoreGemetryMapping(bool theStoreMapping);
67 void SetStoreIDMapping(bool theStoreMapping);
69 virtual int GetNodeObjId(int theVtkID);
70 virtual vtkFloatingPointType* GetNodeCoord(int theObjID);
72 virtual int GetElemObjId(int theVtkID);
73 virtual vtkCell* GetElemCell(int theObjID);
75 virtual void SetTransform(VTKViewer_Transform* theTransform);
76 virtual unsigned long int GetMTime();
78 virtual void SetFacesOriented(bool theIsFacesOriented);
79 virtual bool GetFacesOriented() { return myIsFacesOriented; }
81 void UpdateFaceOrientation();
83 vtkFloatingPointType GetShrinkFactor();
84 void SetShrinkFactor(vtkFloatingPointType value);
86 bool IsShrunkable() { return myIsShrinkable;}
87 bool IsShrunk() { return myIsShrunk;}
91 enum EReperesent { ePoint, eWireframe, eSurface, eInsideframe};
92 EReperesent GetRepresentation(){ return myRepresentation;}
93 void SetRepresentation(EReperesent theMode);
95 virtual void SetVisibility(int theMode);
96 virtual int GetVisibility();
98 virtual void AddToRender(vtkRenderer* theRenderer);
99 virtual void RemoveFromRender(vtkRenderer* theRenderer);
101 VTKViewer_ExtractUnstructuredGrid* GetExtractUnstructuredGrid();
102 vtkUnstructuredGrid* GetUnstructuredGrid();
104 void SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
105 vtkScalarBarActor* theScalarBarActor,
106 vtkLookupTable* theLookupTable);
107 void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
108 vtkScalarBarActor* theScalarBarActor,
109 vtkLookupTable* theLookupTable);
110 void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor);
112 bool IsHighlited() { return myIsHighlited;}
113 void SetHighlited(bool theIsHighlited);
115 virtual void Render(vtkRenderer *, vtkMapper *);
117 void SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed);
118 bool IsImplicitFunctionUsed() const{ return myIsImplicitFunctionUsed;}
121 void Init(TVisualObjPtr theVisualObj, vtkImplicitBoolean* theImplicitBoolean);
122 void SetUnstructuredGrid(vtkUnstructuredGrid* theGrid);
124 vtkPolyDataMapper *myMapper;
125 TVisualObjPtr myVisualObj;
127 vtkProperty *myProperty;
128 EReperesent myRepresentation;
130 SMESH_ExtractGeometry* myExtractGeometry;
131 bool myIsImplicitFunctionUsed;
133 vtkMergeFilter* myMergeFilter;
134 VTKViewer_ExtractUnstructuredGrid* myExtractUnstructuredGrid;
136 bool myIsFacesOriented;
137 SMESH_FaceOrientationFilter* myFaceOrientationFilter;
138 vtkPolyDataMapper* myFaceOrientationDataMapper;
139 vtkActor* myFaceOrientation;
141 bool myStoreClippingMapping;
142 VTKViewer_GeometryFilter *myGeomFilter;
143 VTKViewer_TransformFilter *myTransformFilter;
144 std::vector<vtkPassThroughFilter*> myPassFilter;
146 vtkShrinkFilter* myShrinkFilter;
152 vtkFloatingPointType myPolygonOffsetFactor;
153 vtkFloatingPointType myPolygonOffsetUnits;
156 SetPolygonOffsetParameters(vtkFloatingPointType factor,
157 vtkFloatingPointType units);
160 GetPolygonOffsetParameters(vtkFloatingPointType& factor,
161 vtkFloatingPointType& units)
163 factor = myPolygonOffsetFactor;
164 units = myPolygonOffsetUnits;
168 ~SMESH_DeviceActor();
169 SMESH_DeviceActor(const SMESH_DeviceActor&);
170 void operator=(const SMESH_DeviceActor&);
175 #endif //SMESH_DEVICE_ACTOR_H