Salome HOME
0020855: [CEA] Problem with ijk algo
[modules/smesh.git] / src / OBJECT / SMESH_DeviceActor.h
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  SMESH OBJECT : interactive object for SMESH visualization
23 //  File   : SMESH_DeviceActor.h
24 //  Author : Nicolas REJNERI
25 //  Module : SMESH
26 //  $Header$
27 //
28 #ifndef SMESH_DEVICE_ACTOR_H
29 #define SMESH_DEVICE_ACTOR_H
30
31 #include <VTKViewer_GeometryFilter.h>
32 #include <VTKViewer_MarkerDef.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 vtkUnstructuredGrid;
44 class vtkScalarBarActor;
45 class vtkLookupTable;
46 class vtkImplicitBoolean;
47 class vtkPassThroughFilter;
48
49 class VTKViewer_Transform;
50 class VTKViewer_TransformFilter;
51 class VTKViewer_ExtractUnstructuredGrid;
52 class VTKViewer_PolyDataMapper;
53
54 class SMESH_ExtractGeometry;
55 class SMESH_FaceOrientationFilter;
56
57
58 class SMESHOBJECT_EXPORT SMESH_DeviceActor: public vtkLODActor{
59   friend class SMESH_ActorDef;
60
61  public:
62   vtkTypeMacro(SMESH_DeviceActor,vtkLODActor);
63   static SMESH_DeviceActor* New();
64
65   void SetStoreClippingMapping(bool theStoreMapping);
66   void SetStoreGemetryMapping(bool theStoreMapping);
67   void SetStoreIDMapping(bool theStoreMapping);
68
69   virtual int GetNodeObjId(int theVtkID);
70   virtual vtkFloatingPointType* GetNodeCoord(int theObjID);
71
72   virtual int GetElemObjId(int theVtkID);
73   virtual vtkCell* GetElemCell(int theObjID);
74
75   virtual void SetTransform(VTKViewer_Transform* theTransform); 
76   virtual unsigned long int GetMTime();
77
78   virtual void SetFacesOriented(bool theIsFacesOriented);
79   virtual bool GetFacesOriented() { return myIsFacesOriented; }
80
81   virtual void SetFacesOrientationColor(vtkFloatingPointType theColor[3]);
82   virtual void GetFacesOrientationColor(vtkFloatingPointType theColor[3]);
83
84   virtual void SetFacesOrientationScale(vtkFloatingPointType theScale);
85   virtual vtkFloatingPointType GetFacesOrientationScale();
86
87   virtual void SetFacesOrientation3DVectors(bool theState);
88   virtual bool GetFacesOrientation3DVectors();
89
90   //----------------------------------------------------------------------------
91   //! Setting for displaying quadratic elements
92   virtual void SetQuadraticArcMode(bool theFlag);
93   virtual bool GetQuadraticArcMode();
94   
95   virtual void SetQuadraticArcAngle(vtkFloatingPointType theMaxAngle);
96   virtual vtkFloatingPointType GetQuadraticArcAngle();
97   
98   void UpdateFaceOrientation();
99
100   vtkFloatingPointType GetShrinkFactor();
101   void  SetShrinkFactor(vtkFloatingPointType value);
102
103   bool IsShrunkable() { return myIsShrinkable;}
104   bool IsShrunk() { return myIsShrunk;}
105   void SetShrink(); 
106   void UnShrink(); 
107
108   enum EReperesent { ePoint, eWireframe, eSurface, eInsideframe};
109   EReperesent GetRepresentation(){ return myRepresentation;}
110   void SetRepresentation(EReperesent theMode);
111
112   virtual void SetVisibility(int theMode);
113   virtual int GetVisibility();
114
115   virtual void AddToRender(vtkRenderer* theRenderer); 
116   virtual void RemoveFromRender(vtkRenderer* theRenderer);
117
118   VTKViewer_ExtractUnstructuredGrid* GetExtractUnstructuredGrid();
119   vtkUnstructuredGrid* GetUnstructuredGrid();
120
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);
128
129   bool IsHighlited() { return myIsHighlited;}
130   void SetHighlited(bool theIsHighlited);
131
132   virtual void Render(vtkRenderer *, vtkMapper *);
133
134   void SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed);
135   bool IsImplicitFunctionUsed() const{ return myIsImplicitFunctionUsed;}
136
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();
143
144  protected:
145   void Init(TVisualObjPtr theVisualObj, vtkImplicitBoolean* theImplicitBoolean);
146   void SetUnstructuredGrid(vtkUnstructuredGrid* theGrid);
147
148   VTKViewer_PolyDataMapper *myMapper;
149   TVisualObjPtr myVisualObj;
150
151   vtkProperty *myProperty;
152   EReperesent myRepresentation;
153
154   SMESH_ExtractGeometry* myExtractGeometry;
155   bool myIsImplicitFunctionUsed;
156
157   vtkMergeFilter* myMergeFilter;
158   VTKViewer_ExtractUnstructuredGrid* myExtractUnstructuredGrid;
159
160   bool myIsFacesOriented;
161   SMESH_FaceOrientationFilter* myFaceOrientationFilter;
162   vtkPolyDataMapper* myFaceOrientationDataMapper;
163   vtkActor* myFaceOrientation;
164
165   bool myStoreClippingMapping;
166   VTKViewer_GeometryFilter *myGeomFilter;
167   VTKViewer_TransformFilter *myTransformFilter;
168   std::vector<vtkPassThroughFilter*> myPassFilter;
169
170   vtkShrinkFilter* myShrinkFilter;
171   bool myIsShrinkable;
172   bool myIsShrunk;
173   
174   bool myIsHighlited;
175
176   vtkFloatingPointType myPolygonOffsetFactor;
177   vtkFloatingPointType myPolygonOffsetUnits;
178
179   void
180   SetPolygonOffsetParameters(vtkFloatingPointType factor, 
181                              vtkFloatingPointType units);
182
183   void
184   GetPolygonOffsetParameters(vtkFloatingPointType& factor, 
185                              vtkFloatingPointType& units)
186   {
187     factor = myPolygonOffsetFactor;
188     units = myPolygonOffsetUnits;
189   }
190
191   SMESH_DeviceActor();
192   ~SMESH_DeviceActor();
193   SMESH_DeviceActor(const SMESH_DeviceActor&);
194   void operator=(const SMESH_DeviceActor&);
195
196 };
197
198
199 #endif //SMESH_DEVICE_ACTOR_H