Salome HOME
Updated copyright comment
[modules/gui.git] / src / SVTK / SVTK_DeviceActor.h
1 // Copyright (C) 2007-2024  CEA, EDF, 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, or (at your option) any later version.
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 //  SVTK OBJECT : interactive object for SVTK visualization
24 //  File   : SVTK_DeviceActor.h
25 //  Author : 
26
27 #ifndef SVTK_DEVICE_ACTOR_H
28 #define SVTK_DEVICE_ACTOR_H
29
30 #include "SVTK.h"
31 #include "VTKViewer.h"
32 #include "VTKViewer_Actor.h"
33 #include "VTKViewer_MarkerDef.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_GeometryFilter;
43
44 class vtkCell;
45 class vtkDataSet;
46 class vtkShrinkFilter;
47 class vtkFeatureEdges;
48 class VTKViewer_DataSetMapper;
49 class vtkPassThrough;
50 class vtkAlgorithmOutput;
51
52 #ifdef WIN32
53 #pragma warning ( disable:4251 )
54 #endif
55
56 class SVTK_EXPORT SVTK_DeviceActor: public vtkLODActor
57 {
58  public:
59   vtkTypeMacro(SVTK_DeviceActor,vtkLODActor)
60
61   static
62   SVTK_DeviceActor* 
63   New();
64
65   //! Apply a view transformation
66   virtual
67   void
68   SetTransform(VTKViewer_Transform* theTransform); 
69
70   //! To insert some additional filters and then sets the given #vtkMapper
71   virtual
72   void
73   SetMapper(vtkMapper* theMapper); 
74
75   //! Allows to get initial #vtkDataSet
76   virtual
77   vtkDataSet* 
78   GetInput(); 
79
80   //! Allows to set initial #vtkDataSet
81   virtual
82   void
83   SetInputData(vtkDataSet* theDataSet); 
84
85   //! Allows to set initial #vtkAlgorithmOutput
86   virtual
87   void
88   SetInputConnection(vtkAlgorithmOutput* theAlgorithmOutput); 
89
90   /** @name For selection mapping purpose */
91   //@{
92   virtual
93   vtkIdType
94   GetNodeObjId(vtkIdType theVtkID);
95
96   virtual
97   double* 
98   GetNodeCoord(vtkIdType theObjID);
99
100   virtual
101   vtkIdType
102   GetElemObjId(vtkIdType theVtkID);
103
104   virtual
105   vtkCell* 
106   GetElemCell(vtkIdType theObjID);
107
108   //! To provide VTK to Object and backward mapping
109   virtual 
110   void
111   SetStoreMapping(bool theStoreMapping);
112   //@}
113
114   virtual 
115   vtkMTimeType
116   GetMTime();
117
118   /** @name For shrink mamnagement purpose */
119   //@{
120   double
121   GetShrinkFactor();
122
123   virtual 
124   void  
125   SetShrinkFactor(double value);
126
127   virtual
128   void
129   SetShrinkable(bool theIsShrinkable);
130
131   bool
132   IsShrunkable();
133
134   bool
135   IsShrunk();
136
137   virtual
138   void
139   SetShrink(); 
140
141   virtual
142   void
143   UnShrink(); 
144   //@}
145
146   /** @name For feature edges management purpose */
147   //@{
148   virtual
149   bool
150   IsFeatureEdgesAllowed();
151
152   virtual
153   void
154   SetFeatureEdgesAllowed(bool theIsFeatureEdgesAllowed);
155
156   virtual
157   bool
158   IsFeatureEdgesEnabled();
159
160   virtual
161   void
162   SetFeatureEdgesEnabled(bool theIsFeatureEdgesEnabled);
163
164   virtual
165   double
166   GetFeatureEdgesAngle();
167
168   virtual
169   void
170   SetFeatureEdgesAngle(double theAngle); 
171
172   virtual
173   void
174   GetFeatureEdgesFlags(bool& theIsFeatureEdges,
175                        bool& theIsBoundaryEdges,
176                        bool& theIsManifoldEdges,
177                        bool& theIsNonManifoldEdges);
178   virtual
179   void
180   SetFeatureEdgesFlags(bool theIsFeatureEdges,
181                        bool theIsBoundaryEdges,
182                        bool theIsManifoldEdges,
183                        bool theIsNonManifoldEdges);
184
185   virtual
186   bool
187   GetFeatureEdgesColoring();
188
189   virtual
190   void
191   SetFeatureEdgesColoring(bool theIsColoring);
192   //@}
193
194   /** @name For representation mamnagement purpose */
195   virtual
196   void 
197     SetRepresentation(VTKViewer::Representation::Type theMode);
198
199   VTKViewer::Representation::Type 
200   GetRepresentation();
201
202   virtual
203   double
204   GetDefaultPointSize();
205
206   virtual
207   double
208   GetDefaultLineWidth();
209
210   bool
211   IsShaded();
212
213   void
214   SetShaded(bool theShaded);
215   //@}
216
217   /** @name For ball marker management purpose */
218   void 
219   SetBallEnabled( bool );
220
221   /** @name For marker management purpose */
222   void
223   SetMarkerEnabled( bool );
224
225   void
226   SetBallScale( double );
227
228   void
229   SetMarkerStd( VTK::MarkerType, VTK::MarkerScale );
230
231   void
232   SetMarkerTexture( int, VTK::MarkerTexture );
233
234   VTK::MarkerType
235   GetMarkerType();
236
237   VTK::MarkerScale
238   GetMarkerScale();
239
240   int
241   GetMarkerTexture();
242   //@}
243
244   virtual
245   void
246   Render(vtkRenderer *, vtkMapper *);
247
248   VTKViewer_DataSetMapper* GetDataSetMapper();
249
250   //----------------------------------------------------------------------------
251   //! Setting for displaying quadratic elements
252   virtual void SetQuadraticArcMode(bool theFlag);
253   virtual bool GetQuadraticArcMode();
254
255   virtual void SetQuadraticArcAngle(double theMaxAngle);
256   virtual double GetQuadraticArcAngle();
257
258   virtual
259   void
260   SetCoincident3DAllowed(bool theIsFeatureEdgesAllowed);
261
262   virtual
263   bool 
264   IsCoincident3DAllowed() const;
265   
266   void
267   SetResolveCoincidentTopology(bool theIsResolve);
268     
269
270
271  protected:
272   VTKViewer::Representation::Type myRepresentation;
273   vtkProperty *myProperty;
274   bool myIsShaded;
275
276   //! To initialize internal pipeline
277   void
278   InitPipeLine(vtkMapper* theMapper); 
279
280   VTKViewer_GeometryFilter *myGeomFilter;
281   VTKViewer_TransformFilter *myTransformFilter;
282   std::vector<vtkPassThrough*> myPassFilter;
283   vtkShrinkFilter* myShrinkFilter;
284   vtkFeatureEdges* myFeatureEdges;
285   VTKViewer_DataSetMapper* myMapper;
286
287   bool myIsShrinkable;
288   bool myIsShrunk;
289   
290   bool myIsFeatureEdgesAllowed;
291   bool myIsFeatureEdgesEnabled;
292
293   bool myIsResolveCoincidentTopology;
294   double myPolygonOffsetFactor;
295   double myPolygonOffsetUnits;
296
297   void SetPolygonOffsetParameters(double factor, 
298                                   double units);
299   void GetPolygonOffsetParameters(double& factor, 
300                                   double& units);
301
302   SVTK_DeviceActor();
303   ~SVTK_DeviceActor();
304
305  private:
306   SVTK_DeviceActor(const SVTK_DeviceActor&); // Not implemented
307   void operator=(const SVTK_DeviceActor&); // Not implemented
308
309 };
310
311 #ifdef WIN32
312 #pragma warning ( default:4251 )
313 #endif
314
315 #endif //SVTK_DEVICE_ACTOR_H