1 // Copyright (C) 2007-2008 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
22 // SMESH OBJECT : interactive object for SMESH visualization
23 // File : SMESH_DeviceActor.h
24 // Author : Nicolas REJNERI
28 #ifndef SMESH_DEVICE_ACTOR_H
29 #define SMESH_DEVICE_ACTOR_H
31 #include <VTKViewer_GeometryFilter.h>
32 #include "SMESH_Controls.hxx"
33 #include "SMESH_Object.h"
35 #include <vtkLODActor.h>
36 #include <vtkSmartPointer.h>
41 class vtkShrinkFilter;
42 class vtkPolyDataMapper;
43 class vtkUnstructuredGrid;
44 class vtkScalarBarActor;
46 class vtkImplicitBoolean;
47 class vtkPassThroughFilter;
49 class VTKViewer_Transform;
50 class VTKViewer_TransformFilter;
51 class VTKViewer_ExtractUnstructuredGrid;
53 class SMESH_ExtractGeometry;
54 class SMESH_FaceOrientationFilter;
57 class SMESHOBJECT_EXPORT SMESH_DeviceActor: public vtkLODActor{
58 friend class SMESH_ActorDef;
61 vtkTypeMacro(SMESH_DeviceActor,vtkLODActor);
62 static SMESH_DeviceActor* New();
64 void SetStoreClippingMapping(bool theStoreMapping);
65 void SetStoreGemetryMapping(bool theStoreMapping);
66 void SetStoreIDMapping(bool theStoreMapping);
68 virtual int GetNodeObjId(int theVtkID);
69 virtual vtkFloatingPointType* GetNodeCoord(int theObjID);
71 virtual int GetElemObjId(int theVtkID);
72 virtual vtkCell* GetElemCell(int theObjID);
74 virtual void SetTransform(VTKViewer_Transform* theTransform);
75 virtual unsigned long int GetMTime();
77 virtual void SetFacesOriented(bool theIsFacesOriented);
78 virtual bool GetFacesOriented() { return myIsFacesOriented; }
80 virtual void SetFacesOrientationColor(vtkFloatingPointType theColor[3]);
81 virtual void GetFacesOrientationColor(vtkFloatingPointType theColor[3]);
83 virtual void SetFacesOrientationScale(vtkFloatingPointType theScale);
84 virtual vtkFloatingPointType GetFacesOrientationScale();
86 virtual void SetFacesOrientation3DVectors(bool theState);
87 virtual bool GetFacesOrientation3DVectors();
89 //----------------------------------------------------------------------------
90 //! Setting for displaying quadratic elements
91 virtual void SetQuadraticArcMode(bool theFlag);
92 virtual bool GetQuadraticArcMode();
94 virtual void SetQuadraticArcAngle(vtkFloatingPointType theMaxAngle);
95 virtual vtkFloatingPointType GetQuadraticArcAngle();
97 void UpdateFaceOrientation();
99 vtkFloatingPointType GetShrinkFactor();
100 void SetShrinkFactor(vtkFloatingPointType value);
102 bool IsShrunkable() { return myIsShrinkable;}
103 bool IsShrunk() { return myIsShrunk;}
107 enum EReperesent { ePoint, eWireframe, eSurface, eInsideframe};
108 EReperesent GetRepresentation(){ return myRepresentation;}
109 void SetRepresentation(EReperesent theMode);
111 virtual void SetVisibility(int theMode);
112 virtual int GetVisibility();
114 virtual void AddToRender(vtkRenderer* theRenderer);
115 virtual void RemoveFromRender(vtkRenderer* theRenderer);
117 VTKViewer_ExtractUnstructuredGrid* GetExtractUnstructuredGrid();
118 vtkUnstructuredGrid* GetUnstructuredGrid();
120 void SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
121 vtkScalarBarActor* theScalarBarActor,
122 vtkLookupTable* theLookupTable);
123 void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
124 vtkScalarBarActor* theScalarBarActor,
125 vtkLookupTable* theLookupTable);
126 void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor);
128 bool IsHighlited() { return myIsHighlited;}
129 void SetHighlited(bool theIsHighlited);
131 virtual void Render(vtkRenderer *, vtkMapper *);
133 void SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed);
134 bool IsImplicitFunctionUsed() const{ return myIsImplicitFunctionUsed;}
137 void Init(TVisualObjPtr theVisualObj, vtkImplicitBoolean* theImplicitBoolean);
138 void SetUnstructuredGrid(vtkUnstructuredGrid* theGrid);
140 vtkPolyDataMapper *myMapper;
141 TVisualObjPtr myVisualObj;
143 vtkProperty *myProperty;
144 EReperesent myRepresentation;
146 SMESH_ExtractGeometry* myExtractGeometry;
147 bool myIsImplicitFunctionUsed;
149 vtkMergeFilter* myMergeFilter;
150 VTKViewer_ExtractUnstructuredGrid* myExtractUnstructuredGrid;
152 bool myIsFacesOriented;
153 SMESH_FaceOrientationFilter* myFaceOrientationFilter;
154 vtkPolyDataMapper* myFaceOrientationDataMapper;
155 vtkActor* myFaceOrientation;
157 bool myStoreClippingMapping;
158 VTKViewer_GeometryFilter *myGeomFilter;
159 VTKViewer_TransformFilter *myTransformFilter;
160 std::vector<vtkPassThroughFilter*> myPassFilter;
162 vtkShrinkFilter* myShrinkFilter;
168 vtkFloatingPointType myPolygonOffsetFactor;
169 vtkFloatingPointType myPolygonOffsetUnits;
172 SetPolygonOffsetParameters(vtkFloatingPointType factor,
173 vtkFloatingPointType units);
176 GetPolygonOffsetParameters(vtkFloatingPointType& factor,
177 vtkFloatingPointType& units)
179 factor = myPolygonOffsetFactor;
180 units = myPolygonOffsetUnits;
184 ~SMESH_DeviceActor();
185 SMESH_DeviceActor(const SMESH_DeviceActor&);
186 void operator=(const SMESH_DeviceActor&);
191 #endif //SMESH_DEVICE_ACTOR_H