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 //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteOpacity.
216 SetOpacity(vtkFloatingPointType theOpacity);
218 //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteOpacity, vtkFloatingPointType).
222 //! Set resolution of the Geometrical Sphere.
224 SetResolution(int theResolution);
226 //! Get resolution of the Geometrical Sphere.
230 //! Method for changing the Magnification parameter.
232 ChangeMagnification( bool up );
234 //! Get the maximum size of Point Sprites in the presentation.
238 //! Get point size by element's Id.
240 GetPointSize(vtkIdType theID);
242 //! Get point size by element's Id using the specified scalar array.
244 GetPointSize(vtkIdType theID, vtkDataArray* theScalarArray);
246 //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkSetMacro(AverageCellSize, vtkFloatingPointType).
248 SetAverageCellSize(vtkFloatingPointType AverageCellSize);
250 //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(AverageCellSize, vtkFloatingPointType).
252 GetAverageCellSize();
254 //! Set image data for the Point Sprite texture.
256 SetImageData(vtkImageData* theImageData);
258 //! Make the image data for Point Sprite texture.
260 * First parameter - texture for shape.
261 * Second parameter - texture for alpha mask.
264 vtkSmartPointer<vtkImageData>
265 MakeTexture( const char* theMainTexture,
266 const char* theAlphaTexture );
269 //----------------------------------------------------------------------------
272 SetIsDeformed( bool theIsDeformed );
280 SetScale( vtkFloatingPointType theScale );
288 SetMapScale( vtkFloatingPointType theMapScale = 1.0 );
298 AddGeometry(vtkDataSet* theGeometry, const VISU::TName& theGeomName);
302 GetGeometry(int theGeomNumber, VISU::TName& theGeomName);
306 GetNumberOfGeometry();
310 IsExternalGeometryUsed();
318 GetSourceRange(vtkFloatingPointType theRange[2]);
325 //----------------------------------------------------------------------------
326 VISU_GaussPointsPL();
329 ~VISU_GaussPointsPL();
333 OnCreateMapperHolder();
345 DoShallowCopy(VISU_PipeLine *thePipeLine,
346 bool theIsCopyInput);
349 //----------------------------------------------------------------------------
350 vtkFloatingPointType myScaleFactor;
351 vtkWarpVector *myWarpVector;
352 std::vector<vtkPassThroughFilter*> myPassFilter;
353 vtkSmartPointer<VISU_PointSpriteMapperHolder> myPointSpriteMapperHolder;
356 vtkSphereSource* mySphereSource;
358 vtkFloatingPointType myMagnificationIncrement;
362 vtkSmartPointer<VISU_AppendFilter> myAppendFilter;
363 vtkSmartPointer<VISU_GaussMergeFilter> myMergeFilter;
366 VISU_GaussPointsPL(const VISU_GaussPointsPL&); // Not implemented.
367 void operator=(const VISU_GaussPointsPL&); // Not implemented.