Salome HOME
SALOME PAL V1_4_1
[modules/smesh.git] / src / OBJECT / SMESH_DeviceActor.h
1 //  SMESH OBJECT : interactive object for SMESH visualization
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
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. 
10 // 
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. 
15 // 
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 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : SMESH_Actor.h
25 //  Author : Nicolas REJNERI
26 //  Module : SMESH
27 //  $Header$
28
29 #ifndef SMESH_DEVICE_ACTOR_H
30 #define SMESH_DEVICE_ACTOR_H
31
32 #include "SALOME_GeometryFilter.h"
33 #include "SMESH_Object.h"
34
35 #include <vtkLODActor.h>
36
37 class vtkProperty;
38 class vtkMergeFilter;
39 class vtkShrinkFilter;
40 class vtkPolyDataMapper;
41 class vtkUnstructuredGrid;
42
43 class SALOME_Transform;
44 class SALOME_TransformFilter;
45 class SALOME_PassThroughFilter;
46 class SALOME_ExtractUnstructuredGrid;
47
48
49 class SMESH_DeviceActor: public vtkLODActor{
50   friend class SMESH_Actor;
51
52  public:
53   vtkTypeMacro(SMESH_DeviceActor,vtkLODActor);
54   static SMESH_DeviceActor* New();
55
56   void SetStoreMapping(int theStoreMapping);
57   int GetStoreMapping(){ return myStoreMapping;}
58
59   typedef SALOME_GeometryFilter::TVectorId TVectorId;
60   int GetObjId(int theVtkID);
61   TVectorId GetVtkId(int theObjID);
62
63   int GetNodeObjId(int theVtkID);
64   TVectorId GetNodeVtkId(int theObjID);
65
66   int GetElemObjId(int theVtkID);
67   TVectorId GetElemVtkId(int theObjID);
68
69   vtkPolyData* GetPolyDataInput(); 
70
71   virtual void SetTransform(SALOME_Transform* theTransform); 
72   virtual unsigned long int GetMTime();
73
74   float GetShrinkFactor();
75   void  SetShrinkFactor(float value);
76
77   bool IsShrunkable() { return myIsShrinkable;}
78   bool IsShrunk() { return myIsShrunk;}
79   void SetShrink(); 
80   void UnShrink(); 
81
82   enum EReperesent { ePoint, eWireframe, eSurface, eInsideframe};
83   EReperesent GetRepresentation(){ return myRepresentation;}
84   void SetRepresentation(EReperesent theMode);
85
86   virtual void SetVisibility(int theMode);
87   virtual int GetVisibility();
88
89   SALOME_ExtractUnstructuredGrid* GetExtractUnstructuredGrid();
90   vtkUnstructuredGrid* GetUnstructuredGrid();
91   vtkMergeFilter* GetMergeFilter();
92
93   virtual void Render(vtkRenderer *, vtkMapper *);
94
95  protected:
96   void SetUnstructuredGrid(vtkUnstructuredGrid* theGrid);
97
98   vtkPolyDataMapper *myMapper;
99   TVisualObjPtr myVisualObj;
100
101   vtkProperty *myProperty;
102   EReperesent myRepresentation;
103
104   vtkMergeFilter* myMergeFilter;
105   SALOME_ExtractUnstructuredGrid* myExtractUnstructuredGrid;
106
107   bool myStoreMapping;
108   SALOME_GeometryFilter *myGeomFilter;
109   SALOME_TransformFilter *myTransformFilter;
110   std::vector<SALOME_PassThroughFilter*> myPassFilter;
111
112   vtkShrinkFilter* myShrinkFilter;
113   bool myIsShrinkable;
114   bool myIsShrunk;
115   
116   float myPolygonOffsetFactor;
117   float myPolygonOffsetUnits;
118
119   void SetPolygonOffsetParameters(float factor, float units);
120   void GetPolygonOffsetParameters(float& factor, float& units){
121     factor = myPolygonOffsetFactor;
122     units = myPolygonOffsetUnits;
123   }
124
125   SMESH_DeviceActor();
126   ~SMESH_DeviceActor();
127   SMESH_DeviceActor(const SMESH_DeviceActor&) {};
128   void operator=(const SMESH_DeviceActor&) {};
129
130 };
131
132
133 #endif //SMESH_ACTOR_H