]> SALOME platform Git repositories - modules/visu.git/blob - src/PIPELINE/VISU_GaussPointsPL.hxx
Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/visu.git] / src / PIPELINE / VISU_GaussPointsPL.hxx
1 //  VISU OBJECT : interactive object for VISU entities implementation
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:    VISU_GaussPointsPL.hxx
25 // Author:  
26 // Module : VISU
27
28 #ifndef VISU_GaussPointsPL_HeaderFile
29 #define VISU_GaussPointsPL_HeaderFile
30
31 #include "VISUPipeline.hxx"
32 #include "VISU_ColoredPL.hxx"
33
34 #include <vector>
35
36 class VISU_OpenGLPointSpriteMapper;
37 class VISU_PointSpriteMapperHolder;
38
39 class vtkGeometryFilter;
40 class vtkGlyph3D;
41 class vtkSphereSource;
42 class vtkDataArray;
43 class vtkImageData;
44 class vtkPointSet;
45 class vtkPassThroughFilter;
46 class vtkDataSet;
47
48 class vtkWarpVector;
49 class SALOME_Transform;
50
51 class VISU_AppendFilter;
52 class VISU_GaussMergeFilter;
53
54 //----------------------------------------------------------------------------
55 //! Pipeline for the Gauss Points presentation.
56 /*!
57  * This class uses the special mapper (VISU_OpenGLPointSpriteMapper)
58  * for rendering the Gauss Points as Point Sprites.
59  */
60 class VISU_PIPELINE_EXPORT VISU_GaussPointsPL : public VISU_ColoredPL
61 {
62 public:
63   //----------------------------------------------------------------------------
64   vtkTypeMacro(VISU_GaussPointsPL, VISU_ColoredPL);
65
66   static 
67   VISU_GaussPointsPL* 
68   New();
69   
70   virtual
71   unsigned long int 
72   GetMTime();
73
74   //----------------------------------------------------------------------------
75   void 
76   SetGaussPtsIDMapper(const VISU::PGaussPtsIDMapper& theGaussPtsIDMapper);
77
78   const VISU::PGaussPtsIDMapper&  
79   GetGaussPtsIDMapper();
80
81   VISU_PointSpriteMapperHolder*
82   GetPointSpriteMapperHolder();
83
84   //! Get the internal #VISU_OpenGLPointSpriteMapper.
85   VISU_OpenGLPointSpriteMapper*
86   GetPointSpriteMapper();
87
88   vtkDataSet*  
89   GetParentMesh();
90
91   //! Get an intermediate dataset that can be picked  
92   vtkPolyData*
93   GetPickableDataSet();
94
95   //----------------------------------------------------------------------------
96   //! Redefined method for initialization of the pipeline.
97   virtual
98   void
99   Init();
100
101   //! Redefined method for updating the pipeline.
102   virtual
103   void
104   Update();
105
106   //! Gets memory size used by the instance (bytes).
107   virtual
108   unsigned long int
109   GetMemorySize();
110
111   //----------------------------------------------------------------------------
112   //! Update glyph.
113   void
114   UpdateGlyph();
115
116   virtual 
117   VISU::TGaussPointID 
118   GetObjID(vtkIdType theID);
119
120   //! Set the Bicolor mode.
121   /*!
122    * When the Bicolor parameter is set to true, scalar bars are
123    * drawing with two colors : red color correspoonds to positive
124    * scalar values, blue color - to negative values.
125    */
126   void
127   SetBicolor(bool theBicolor);
128
129   //! Get the Bicolor mode.
130   bool
131   GetBicolor();
132
133   //! Set the Multicolored mode.
134   /*!
135    * This parameter is using to switch between Results and Geometry
136    * modes. Multiple colors are using when the presentation is
137    * drawing in the Results mode, one color - in the Geometry mode.
138    */
139   void
140   SetIsColored(bool theIsColored);
141
142   bool 
143   GetIsColored();
144
145   //! Set type of the primitives.
146   void
147   SetPrimitiveType(int thePrimitiveType);
148
149   //! Get type of the primitives.
150   int
151   GetPrimitiveType();
152
153   //! Get the maximum Point Sprite size, which is supported by hardware.
154   vtkFloatingPointType 
155   GetMaximumSupportedSize();
156
157   //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteClamp.
158   void
159   SetClamp(vtkFloatingPointType theClamp);
160
161   //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteClamp, vtkFloatingPointType).
162   vtkFloatingPointType
163   GetClamp();
164
165   //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteSize.
166   void
167   SetSize(vtkFloatingPointType theSize);
168
169   //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteSize, vtkFloatingPointType).
170   vtkFloatingPointType 
171   GetSize();
172
173   //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteMinSize.
174   void
175   SetMinSize(vtkFloatingPointType theMinSize);
176
177   //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteMinSize, vtkFloatingPointType).
178   vtkFloatingPointType 
179   GetMinSize();
180
181   //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteMinSize.
182   void
183   SetMaxSize(vtkFloatingPointType theMaxSize);
184
185   //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteMaxSize, vtkFloatingPointType).
186   vtkFloatingPointType 
187   GetMaxSize();
188
189   //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteMagnification.
190   void
191   SetMagnification(vtkFloatingPointType theMagnification);
192
193   //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteMagnification, vtkFloatingPointType).
194   vtkFloatingPointType
195   GetMagnification();
196
197   //! Set the increment of changing Magnification parameter.
198   void
199   SetMagnificationIncrement(vtkFloatingPointType theIncrement);
200
201   //! Get the increment of changing Magnification parameter.
202   vtkFloatingPointType
203   GetMagnificationIncrement() { return myMagnificationIncrement; }
204
205   //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteAlphaThreshold.
206   void
207   SetAlphaThreshold(vtkFloatingPointType theAlphaThreshold);
208
209   //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteAlphaThreshold, vtkFloatingPointType).
210   vtkFloatingPointType
211   GetAlphaThreshold();
212
213   //! Set resolution of the Geometrical Sphere.
214   void
215   SetResolution(int theResolution);
216
217   //! Get resolution of the Geometrical Sphere.
218   int
219   GetResolution();
220
221   //! Method for changing the Magnification parameter.
222   void
223   ChangeMagnification( bool up );
224
225   //! Get the maximum size of Point Sprites in the presentation.
226   vtkFloatingPointType
227   GetMaxPointSize();
228
229   //! Get point size by element's Id.
230   vtkFloatingPointType
231   GetPointSize(vtkIdType theID);
232
233   //! Get point size by element's Id using the specified scalar array.
234   vtkFloatingPointType
235   GetPointSize(vtkIdType theID, vtkDataArray* theScalarArray);
236
237   //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkSetMacro(AverageCellSize, vtkFloatingPointType).
238   void
239   SetAverageCellSize(vtkFloatingPointType AverageCellSize);
240
241   //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(AverageCellSize, vtkFloatingPointType).
242   vtkFloatingPointType
243   GetAverageCellSize();
244
245   //! Set image data for the Point Sprite texture.
246   void
247   SetImageData(vtkImageData* theImageData);
248
249   //! Make the image data for Point Sprite texture.
250   /*!
251    * First parameter - texture for shape.
252    * Second parameter - texture for alpha mask.
253    */
254   static
255   vtkSmartPointer<vtkImageData>
256   MakeTexture( const char* theMainTexture,
257                const char* theAlphaTexture );
258
259 public:
260   //----------------------------------------------------------------------------
261   virtual 
262   void
263   SetIsDeformed( bool theIsDeformed );
264
265   virtual
266   bool
267   GetIsDeformed();
268
269   virtual
270   void
271   SetScale( vtkFloatingPointType theScale );
272
273   virtual
274   vtkFloatingPointType 
275   GetScale();
276
277   virtual
278   void
279   SetMapScale( vtkFloatingPointType theMapScale = 1.0 );
280
281 public:
282
283   virtual  
284   void  
285   SetSourceGeometry();
286
287   virtual
288   int
289   AddGeometry(vtkDataSet* theGeometry);
290
291   virtual
292   vtkDataSet*
293   GetGeometry(int theGeomNumber);
294
295   virtual
296   int
297   GetNumberOfGeometry();
298
299   virtual
300   bool 
301   IsExternalGeometryUsed();
302
303   virtual
304   void
305   ClearGeometry();
306
307   virtual 
308   vtkPointSet* 
309   GetMergedInput();
310
311 protected:
312   //----------------------------------------------------------------------------
313   VISU_GaussPointsPL();
314
315   virtual
316   ~VISU_GaussPointsPL();
317
318   virtual
319   void
320   OnCreateMapperHolder();
321
322   virtual
323   void
324   Build();
325
326   virtual
327   vtkDataSet* 
328   InsertCustomPL();
329
330   virtual
331   void
332   DoShallowCopy(VISU_PipeLine *thePipeLine,
333                 bool theIsCopyInput);
334
335 private:
336   //----------------------------------------------------------------------------
337   vtkFloatingPointType myScaleFactor;
338   vtkWarpVector *myWarpVector;
339   std::vector<vtkPassThroughFilter*> myPassFilter;
340   vtkSmartPointer<VISU_PointSpriteMapperHolder> myPointSpriteMapperHolder;
341   
342   vtkGlyph3D* myGlyph;
343   vtkSphereSource* mySphereSource;
344
345   vtkFloatingPointType myMagnificationIncrement;
346
347   int myPrimitiveType;
348
349   vtkSmartPointer<VISU_AppendFilter>      myAppendFilter;
350   vtkSmartPointer<VISU_GaussMergeFilter>  myMergeFilter;
351
352 private:
353   VISU_GaussPointsPL(const VISU_GaussPointsPL&);  // Not implemented.
354   void operator=(const VISU_GaussPointsPL&);  // Not implemented.
355 };
356   
357 #endif