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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
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;
49 class VTKViewer_Transform;
50 class VTKViewer_TransformFilter;
51 class VTKViewer_PassThroughFilter;
52 class VTKViewer_ExtractUnstructuredGrid;
54 class SMESH_ExtractGeometry;
57 class 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 float* 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 float GetShrinkFactor();
78 void SetShrinkFactor(float value);
80 bool IsShrunkable() { return myIsShrinkable;}
81 bool IsShrunk() { return myIsShrunk;}
85 enum EReperesent { ePoint, eWireframe, eSurface, eInsideframe};
86 EReperesent GetRepresentation(){ return myRepresentation;}
87 void SetRepresentation(EReperesent theMode);
89 virtual void SetVisibility(int theMode);
90 virtual int GetVisibility();
92 VTKViewer_ExtractUnstructuredGrid* GetExtractUnstructuredGrid();
93 vtkUnstructuredGrid* GetUnstructuredGrid();
95 void SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
96 vtkScalarBarActor* theScalarBarActor,
97 vtkLookupTable* theLookupTable);
98 void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
99 vtkScalarBarActor* theScalarBarActor,
100 vtkLookupTable* theLookupTable);
101 void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor);
103 bool IsHighlited() { return myIsHighlited;}
104 void SetHighlited(bool theIsHighlited);
106 virtual void Render(vtkRenderer *, vtkMapper *);
108 void SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed);
109 bool IsImplicitFunctionUsed() const{ return myIsImplicitFunctionUsed;}
112 void Init(TVisualObjPtr theVisualObj, vtkImplicitBoolean* theImplicitBoolean);
113 void SetUnstructuredGrid(vtkUnstructuredGrid* theGrid);
115 vtkPolyDataMapper *myMapper;
116 TVisualObjPtr myVisualObj;
118 vtkProperty *myProperty;
119 EReperesent myRepresentation;
121 SMESH_ExtractGeometry* myExtractGeometry;
122 bool myIsImplicitFunctionUsed;
124 vtkMergeFilter* myMergeFilter;
125 VTKViewer_ExtractUnstructuredGrid* myExtractUnstructuredGrid;
127 bool myStoreClippingMapping;
128 VTKViewer_GeometryFilter *myGeomFilter;
129 VTKViewer_TransformFilter *myTransformFilter;
130 std::vector<VTKViewer_PassThroughFilter*> myPassFilter;
132 vtkShrinkFilter* myShrinkFilter;
138 float myPolygonOffsetFactor;
139 float myPolygonOffsetUnits;
141 void SetPolygonOffsetParameters(float factor, float units);
142 void GetPolygonOffsetParameters(float& factor, float& units){
143 factor = myPolygonOffsetFactor;
144 units = myPolygonOffsetUnits;
148 ~SMESH_DeviceActor();
149 SMESH_DeviceActor(const SMESH_DeviceActor&);
150 void operator=(const SMESH_DeviceActor&);
155 #endif //SMESH_DEVICE_ACTOR_H