Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[modules/gui.git] / src / SVTK / SVTK_DeviceActor.h
1 //  SVTK OBJECT : interactive object for SVTK 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //
23 //
24 //  File   : SVTK_DeviceActor.h
25 //  Author : 
26 //  Module : 
27 //  $Header$
28
29 #ifndef SVTK_DEVICE_ACTOR_H
30 #define SVTK_DEVICE_ACTOR_H
31
32 #include "SVTK.h"
33 #include "VTKViewer.h"
34
35 #include <vector>
36
37 #include <vtkLODActor.h>
38 #include <vtkProperty.h>
39
40 class VTKViewer_Transform;
41 class VTKViewer_TransformFilter;
42 class VTKViewer_PassThroughFilter;
43 class VTKViewer_GeometryFilter;
44
45 class vtkCell;
46 class vtkDataSet;
47 class vtkShrinkFilter;
48 class vtkDataSetMapper;
49
50 namespace SVTK
51 {
52   namespace Representation
53   {
54     typedef int Type;
55     const Type Points = VTK_POINTS;
56     const Type Wireframe = VTK_WIREFRAME;
57     const Type Surface = VTK_SURFACE;
58     const Type Insideframe = Surface + 1;
59   }
60 }
61
62
63 class SVTK_EXPORT SVTK_DeviceActor: public vtkLODActor
64 {
65  public:
66   vtkTypeMacro(SVTK_DeviceActor,vtkLODActor);
67
68   static
69   SVTK_DeviceActor* 
70   New();
71
72   //! Apply a view transformation
73   virtual
74   void
75   SetTransform(VTKViewer_Transform* theTransform); 
76
77   //! To insert some additional filters and then sets the given #vtkMapper
78   virtual
79   void
80   SetMapper(vtkMapper* theMapper); 
81
82   //! Allows to get initial #vtkDataSet
83   virtual
84   vtkDataSet* 
85   GetInput(); 
86
87   //! Allows to set initial #vtkDataSet
88   virtual
89   void
90   SetInput(vtkDataSet* theDataSet); 
91
92   /** @name For selection mapping purpose */
93   //@{
94   virtual
95   int
96   GetNodeObjId(int theVtkID);
97
98   virtual
99   vtkFloatingPointType* 
100   GetNodeCoord(int theObjID);
101
102   virtual
103   int
104   GetElemObjId(int theVtkID);
105
106   virtual
107   vtkCell* 
108   GetElemCell(int theObjID);
109
110   //! To provide VTK to Object and backward mapping
111   virtual 
112   void
113   SetStoreMapping(bool theStoreMapping);
114   //@}
115
116   virtual 
117   unsigned long int 
118   GetMTime();
119
120   /** @name For shrink mamnagement purpose */
121   //@{
122   vtkFloatingPointType
123   GetShrinkFactor();
124
125   virtual 
126   void  
127   SetShrinkFactor(vtkFloatingPointType value);
128
129   virtual
130   void
131   SetShrinkable(bool theIsShrinkable);
132
133   bool
134   IsShrunkable();
135
136   bool
137   IsShrunk();
138
139   virtual
140   void
141   SetShrink(); 
142
143   virtual
144   void
145   UnShrink(); 
146   //@}
147
148   /** @name For representation mamnagement purpose */
149   virtual
150   void 
151   SetRepresentation(SVTK::Representation::Type theMode);
152
153   SVTK::Representation::Type 
154   GetRepresentation();
155
156   virtual
157   vtkFloatingPointType
158   GetDefaultPointSize();
159
160   virtual
161   vtkFloatingPointType
162   GetDefaultLineWidth();
163
164   bool
165   IsShaded();
166
167   void
168   SetShaded(bool theShaded);
169   //@}
170
171   virtual
172   void
173   Render(vtkRenderer *, vtkMapper *);
174
175  protected:
176   SVTK::Representation::Type myRepresentation;
177   vtkProperty *myProperty;
178   bool myIsShaded;
179
180   //! To initialize internal pipeline
181   void
182   InitPipeLine(vtkMapper* theMapper); 
183
184   VTKViewer_GeometryFilter *myGeomFilter;
185   VTKViewer_TransformFilter *myTransformFilter;
186   std::vector<VTKViewer_PassThroughFilter*> myPassFilter;
187   vtkShrinkFilter* myShrinkFilter;
188   vtkDataSetMapper* myMapper;
189
190   bool myIsShrinkable;
191   bool myIsShrunk;
192   
193   bool myIsResolveCoincidentTopology;
194   vtkFloatingPointType myPolygonOffsetFactor;
195   vtkFloatingPointType myPolygonOffsetUnits;
196
197   void SetPolygonOffsetParameters(vtkFloatingPointType factor, 
198                                   vtkFloatingPointType units);
199   void GetPolygonOffsetParameters(vtkFloatingPointType& factor, 
200                                   vtkFloatingPointType& units);
201
202   SVTK_DeviceActor();
203   ~SVTK_DeviceActor();
204
205  private:
206   SVTK_DeviceActor(const SVTK_DeviceActor&); // Not implemented
207   void operator=(const SVTK_DeviceActor&); // Not implemented
208
209 };
210
211
212 #endif //SVTK_DEVICE_ACTOR_H