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 <VTKViewer_MarkerDef.h>
33 #include "SMESH_Controls.hxx"
34 #include "SMESH_Object.h"
36 #include <vtkLODActor.h>
37 #include <vtkSmartPointer.h>
42 class vtkShrinkFilter;
43 class vtkUnstructuredGrid;
44 class vtkScalarBarActor;
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;
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 virtual void SetFacesOrientationColor(vtkFloatingPointType theColor[3]);
82 virtual void GetFacesOrientationColor(vtkFloatingPointType theColor[3]);
84 virtual void SetFacesOrientationScale(vtkFloatingPointType theScale);
85 virtual vtkFloatingPointType GetFacesOrientationScale();
87 virtual void SetFacesOrientation3DVectors(bool theState);
88 virtual bool GetFacesOrientation3DVectors();
90 //----------------------------------------------------------------------------
91 //! Setting for displaying quadratic elements
92 virtual void SetQuadraticArcMode(bool theFlag);
93 virtual bool GetQuadraticArcMode();
95 virtual void SetQuadraticArcAngle(vtkFloatingPointType theMaxAngle);
96 virtual vtkFloatingPointType GetQuadraticArcAngle();
98 void UpdateFaceOrientation();
100 vtkFloatingPointType GetShrinkFactor();
101 void SetShrinkFactor(vtkFloatingPointType value);
103 bool IsShrunkable() { return myIsShrinkable;}
104 bool IsShrunk() { return myIsShrunk;}
108 enum EReperesent { ePoint, eWireframe, eSurface, eInsideframe};
109 EReperesent GetRepresentation(){ return myRepresentation;}
110 void SetRepresentation(EReperesent theMode);
112 virtual void SetVisibility(int theMode);
113 virtual int GetVisibility();
115 virtual void AddToRender(vtkRenderer* theRenderer);
116 virtual void RemoveFromRender(vtkRenderer* theRenderer);
118 VTKViewer_ExtractUnstructuredGrid* GetExtractUnstructuredGrid();
119 vtkUnstructuredGrid* GetUnstructuredGrid();
121 void SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
122 vtkScalarBarActor* theScalarBarActor,
123 vtkLookupTable* theLookupTable);
124 void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
125 vtkScalarBarActor* theScalarBarActor,
126 vtkLookupTable* theLookupTable);
127 void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor);
129 bool IsHighlited() { return myIsHighlited;}
130 void SetHighlited(bool theIsHighlited);
132 virtual void Render(vtkRenderer *, vtkMapper *);
134 void SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed);
135 bool IsImplicitFunctionUsed() const{ return myIsImplicitFunctionUsed;}
137 void SetMarkerEnabled( bool );
138 void SetMarkerStd( VTK::MarkerType, VTK::MarkerScale );
139 void SetMarkerTexture( int, VTK::MarkerTexture );
140 VTK::MarkerType GetMarkerType();
141 VTK::MarkerScale GetMarkerScale();
142 int GetMarkerTexture();
145 void Init(TVisualObjPtr theVisualObj, vtkImplicitBoolean* theImplicitBoolean);
146 void SetUnstructuredGrid(vtkUnstructuredGrid* theGrid);
148 VTKViewer_PolyDataMapper *myMapper;
149 TVisualObjPtr myVisualObj;
151 vtkProperty *myProperty;
152 EReperesent myRepresentation;
154 SMESH_ExtractGeometry* myExtractGeometry;
155 bool myIsImplicitFunctionUsed;
157 vtkMergeFilter* myMergeFilter;
158 VTKViewer_ExtractUnstructuredGrid* myExtractUnstructuredGrid;
160 bool myIsFacesOriented;
161 SMESH_FaceOrientationFilter* myFaceOrientationFilter;
162 vtkPolyDataMapper* myFaceOrientationDataMapper;
163 vtkActor* myFaceOrientation;
165 bool myStoreClippingMapping;
166 VTKViewer_GeometryFilter *myGeomFilter;
167 VTKViewer_TransformFilter *myTransformFilter;
168 std::vector<vtkPassThroughFilter*> myPassFilter;
170 vtkShrinkFilter* myShrinkFilter;
176 vtkFloatingPointType myPolygonOffsetFactor;
177 vtkFloatingPointType myPolygonOffsetUnits;
180 SetPolygonOffsetParameters(vtkFloatingPointType factor,
181 vtkFloatingPointType units);
184 GetPolygonOffsetParameters(vtkFloatingPointType& factor,
185 vtkFloatingPointType& units)
187 factor = myPolygonOffsetFactor;
188 units = myPolygonOffsetUnits;
192 ~SMESH_DeviceActor();
193 SMESH_DeviceActor(const SMESH_DeviceActor&);
194 void operator=(const SMESH_DeviceActor&);
199 #endif //SMESH_DEVICE_ACTOR_H