Salome HOME
Merge with version on tag OCC-V2_1_0d
[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_Controls.hxx"
34 #include "SMESH_Object.h"
35
36 #include <vtkLODActor.h>
37 #include <vtkSmartPointer.h>
38
39 class vtkCell;
40 class vtkProperty;
41 class vtkMergeFilter;
42 class vtkShrinkFilter;
43 class vtkPolyDataMapper;
44 class vtkUnstructuredGrid;
45 class vtkScalarBarActor;
46 class vtkLookupTable;
47 class vtkImplicitBoolean;
48
49 class SALOME_Transform;
50 class SALOME_TransformFilter;
51 class SALOME_PassThroughFilter;
52 class SALOME_ExtractUnstructuredGrid;
53
54 class SMESH_ExtractGeometry;
55
56
57 class SMESH_DeviceActor: public vtkLODActor{
58   friend class SMESH_Actor;
59
60  public:
61   vtkTypeMacro(SMESH_DeviceActor,vtkLODActor);
62   static SMESH_DeviceActor* New();
63
64   void SetStoreMapping(int theStoreMapping);
65   int GetStoreMapping(){ return myStoreMapping;}
66
67   virtual int GetNodeObjId(int theVtkID);
68   virtual float* GetNodeCoord(int theObjID);
69
70   virtual int GetElemObjId(int theVtkID);
71   virtual vtkCell* GetElemCell(int theObjID);
72
73   virtual void SetTransform(SALOME_Transform* theTransform); 
74   virtual unsigned long int GetMTime();
75
76   float GetShrinkFactor();
77   void  SetShrinkFactor(float value);
78
79   bool IsShrunkable() { return myIsShrinkable;}
80   bool IsShrunk() { return myIsShrunk;}
81   void SetShrink(); 
82   void UnShrink(); 
83
84   enum EReperesent { ePoint, eWireframe, eSurface, eInsideframe};
85   EReperesent GetRepresentation(){ return myRepresentation;}
86   void SetRepresentation(EReperesent theMode);
87
88   virtual void SetVisibility(int theMode);
89   virtual int GetVisibility();
90
91   SALOME_ExtractUnstructuredGrid* GetExtractUnstructuredGrid();
92   vtkUnstructuredGrid* GetUnstructuredGrid();
93
94   void SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
95                       vtkScalarBarActor* theScalarBarActor,
96                       vtkLookupTable* theLookupTable);
97   void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
98                          SMESH_DeviceActor* theDeviceActor);
99
100   bool IsHighlited() { return myIsHighlited;}
101   void SetHighlited(bool theIsHighlited);
102
103   virtual void Render(vtkRenderer *, vtkMapper *);
104
105  protected:
106   void Init(TVisualObjPtr theVisualObj, vtkImplicitBoolean* theImplicitBoolean);
107   void SetUnstructuredGrid(vtkUnstructuredGrid* theGrid);
108
109   vtkPolyDataMapper *myMapper;
110   TVisualObjPtr myVisualObj;
111
112   vtkProperty *myProperty;
113   EReperesent myRepresentation;
114
115   SMESH_ExtractGeometry* myExtractGeometry;
116
117   vtkMergeFilter* myMergeFilter;
118   SALOME_ExtractUnstructuredGrid* myExtractUnstructuredGrid;
119
120   bool myStoreMapping;
121   SALOME_GeometryFilter *myGeomFilter;
122   SALOME_TransformFilter *myTransformFilter;
123   std::vector<SALOME_PassThroughFilter*> myPassFilter;
124
125   vtkShrinkFilter* myShrinkFilter;
126   bool myIsShrinkable;
127   bool myIsShrunk;
128   
129   bool myIsHighlited;
130
131   float myPolygonOffsetFactor;
132   float myPolygonOffsetUnits;
133
134   void SetPolygonOffsetParameters(float factor, float units);
135   void GetPolygonOffsetParameters(float& factor, float& units){
136     factor = myPolygonOffsetFactor;
137     units = myPolygonOffsetUnits;
138   }
139
140   SMESH_DeviceActor();
141   ~SMESH_DeviceActor();
142   SMESH_DeviceActor(const SMESH_DeviceActor&);
143   void operator=(const SMESH_DeviceActor&);
144
145 };
146
147
148 #endif //SMESH_ACTOR_H