1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // VISU OBJECT : interactive object for VISU entities implementation
23 // File: VISU_GaussPointsPL.hxx
27 #ifndef VISU_GaussPointsPL_HeaderFile
28 #define VISU_GaussPointsPL_HeaderFile
30 #include "VISUPipeline.hxx"
31 #include "VISU_MergedPL.hxx"
32 #include "VISU_ColoredPL.hxx"
36 class VISU_OpenGLPointSpriteMapper;
37 class VISU_PointSpriteMapperHolder;
39 class vtkGeometryFilter;
41 class vtkSphereSource;
45 class vtkPassThroughFilter;
49 class SALOME_Transform;
51 class VISU_AppendFilter;
52 class VISU_GaussMergeFilter;
54 //----------------------------------------------------------------------------
55 //! Pipeline for the Gauss Points presentation.
57 * This class uses the special mapper (VISU_OpenGLPointSpriteMapper)
58 * for rendering the Gauss Points as Point Sprites.
60 class VISU_PIPELINE_EXPORT VISU_GaussPointsPL : public VISU_MergedPL,
64 //----------------------------------------------------------------------------
65 vtkTypeMacro(VISU_GaussPointsPL, VISU_ColoredPL);
75 //----------------------------------------------------------------------------
77 SetGaussPtsIDMapper(const VISU::PGaussPtsIDMapper& theGaussPtsIDMapper);
79 const VISU::PGaussPtsIDMapper&
80 GetGaussPtsIDMapper();
82 VISU_PointSpriteMapperHolder*
83 GetPointSpriteMapperHolder();
85 //! Get the internal #VISU_OpenGLPointSpriteMapper.
86 VISU_OpenGLPointSpriteMapper*
87 GetPointSpriteMapper();
92 //! Get an intermediate dataset that can be picked
96 //----------------------------------------------------------------------------
97 //! Redefined method for initialization of the pipeline.
102 //! Redefined method for updating the pipeline.
107 //! Gets memory size used by the instance (bytes).
112 //----------------------------------------------------------------------------
119 GetObjID(vtkIdType theID);
121 //! Set the Bicolor mode.
123 * When the Bicolor parameter is set to true, scalar bars are
124 * drawing with two colors : red color correspoonds to positive
125 * scalar values, blue color - to negative values.
128 SetBicolor(bool theBicolor);
130 //! Get the Bicolor mode.
134 //! Set the Multicolored mode.
136 * This parameter is using to switch between Results and Geometry
137 * modes. Multiple colors are using when the presentation is
138 * drawing in the Results mode, one color - in the Geometry mode.
141 SetIsColored(bool theIsColored);
146 //! Set type of the primitives.
148 SetPrimitiveType(int thePrimitiveType);
150 //! Get type of the primitives.
154 //! Get the maximum Point Sprite size, which is supported by hardware.
156 GetMaximumSupportedSize();
158 //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteClamp.
160 SetClamp(vtkFloatingPointType theClamp);
162 //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteClamp, vtkFloatingPointType).
166 //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteSize.
168 SetSize(vtkFloatingPointType theSize);
170 //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteSize, vtkFloatingPointType).
174 //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteMinSize.
176 SetMinSize(vtkFloatingPointType theMinSize);
178 //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteMinSize, vtkFloatingPointType).
182 //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteMinSize.
184 SetMaxSize(vtkFloatingPointType theMaxSize);
186 //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteMaxSize, vtkFloatingPointType).
190 //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteMagnification.
192 SetMagnification(vtkFloatingPointType theMagnification);
194 //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteMagnification, vtkFloatingPointType).
198 //! Set the increment of changing Magnification parameter.
200 SetMagnificationIncrement(vtkFloatingPointType theIncrement);
202 //! Get the increment of changing Magnification parameter.
204 GetMagnificationIncrement() { return myMagnificationIncrement; }
206 //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteAlphaThreshold.
208 SetAlphaThreshold(vtkFloatingPointType theAlphaThreshold);
210 //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteAlphaThreshold, vtkFloatingPointType).
214 //! Set resolution of the Geometrical Sphere.
216 SetResolution(int theResolution);
218 //! Get resolution of the Geometrical Sphere.
222 //! Method for changing the Magnification parameter.
224 ChangeMagnification( bool up );
226 //! Get the maximum size of Point Sprites in the presentation.
230 //! Get point size by element's Id.
232 GetPointSize(vtkIdType theID);
234 //! Get point size by element's Id using the specified scalar array.
236 GetPointSize(vtkIdType theID, vtkDataArray* theScalarArray);
238 //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkSetMacro(AverageCellSize, vtkFloatingPointType).
240 SetAverageCellSize(vtkFloatingPointType AverageCellSize);
242 //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(AverageCellSize, vtkFloatingPointType).
244 GetAverageCellSize();
246 //! Set image data for the Point Sprite texture.
248 SetImageData(vtkImageData* theImageData);
250 //! Make the image data for Point Sprite texture.
252 * First parameter - texture for shape.
253 * Second parameter - texture for alpha mask.
256 vtkSmartPointer<vtkImageData>
257 MakeTexture( const char* theMainTexture,
258 const char* theAlphaTexture );
261 //----------------------------------------------------------------------------
264 SetIsDeformed( bool theIsDeformed );
272 SetScale( vtkFloatingPointType theScale );
280 SetMapScale( vtkFloatingPointType theMapScale = 1.0 );
290 AddGeometry(vtkDataSet* theGeometry);
294 GetGeometry(int theGeomNumber);
298 GetNumberOfGeometry();
302 IsExternalGeometryUsed();
313 //----------------------------------------------------------------------------
314 VISU_GaussPointsPL();
317 ~VISU_GaussPointsPL();
321 OnCreateMapperHolder();
333 DoShallowCopy(VISU_PipeLine *thePipeLine,
334 bool theIsCopyInput);
337 //----------------------------------------------------------------------------
338 vtkFloatingPointType myScaleFactor;
339 vtkWarpVector *myWarpVector;
340 std::vector<vtkPassThroughFilter*> myPassFilter;
341 vtkSmartPointer<VISU_PointSpriteMapperHolder> myPointSpriteMapperHolder;
344 vtkSphereSource* mySphereSource;
346 vtkFloatingPointType myMagnificationIncrement;
350 vtkSmartPointer<VISU_AppendFilter> myAppendFilter;
351 vtkSmartPointer<VISU_GaussMergeFilter> myMergeFilter;
354 VISU_GaussPointsPL(const VISU_GaussPointsPL&); // Not implemented.
355 void operator=(const VISU_GaussPointsPL&); // Not implemented.