1 // Copyright (C) 2007-2010 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
23 // VISU OBJECT : interactive object for VISU entities implementation
24 // File: VISU_GaussPointsPL.hxx
28 #ifndef VISU_GaussPointsPL_HeaderFile
29 #define VISU_GaussPointsPL_HeaderFile
31 #include "VISUPipeline.hxx"
32 #include "VISU_MergedPL.hxx"
33 #include "VISU_ColoredPL.hxx"
37 class VISU_OpenGLPointSpriteMapper;
38 class VISU_PointSpriteMapperHolder;
40 class vtkGeometryFilter;
42 class vtkSphereSource;
46 class vtkPassThroughFilter;
50 class SALOME_Transform;
52 class VISU_AppendFilter;
53 class VISU_GaussMergeFilter;
55 //----------------------------------------------------------------------------
56 //! Pipeline for the Gauss Points presentation.
58 * This class uses the special mapper (VISU_OpenGLPointSpriteMapper)
59 * for rendering the Gauss Points as Point Sprites.
61 class VISU_PIPELINE_EXPORT VISU_GaussPointsPL : public VISU_MergedPL,
65 //----------------------------------------------------------------------------
66 vtkTypeMacro(VISU_GaussPointsPL, VISU_ColoredPL);
76 //----------------------------------------------------------------------------
78 SetGaussPtsIDMapper(const VISU::PGaussPtsIDMapper& theGaussPtsIDMapper);
80 const VISU::PGaussPtsIDMapper&
81 GetGaussPtsIDMapper();
83 VISU_PointSpriteMapperHolder*
84 GetPointSpriteMapperHolder();
86 //! Get the internal #VISU_OpenGLPointSpriteMapper.
87 VISU_OpenGLPointSpriteMapper*
88 GetPointSpriteMapper();
93 //! Get an intermediate dataset that can be picked
97 //----------------------------------------------------------------------------
98 //! Redefined method for initialization of the pipeline.
103 //! Redefined method for updating the pipeline.
108 //! Gets memory size used by the instance (bytes).
113 //----------------------------------------------------------------------------
120 GetObjID(vtkIdType theID);
122 //! Set the Bicolor mode.
124 * When the Bicolor parameter is set to true, scalar bars are
125 * drawing with two colors : red color correspoonds to positive
126 * scalar values, blue color - to negative values.
129 SetBicolor(bool theBicolor);
131 //! Get the Bicolor mode.
135 //! Set the Multicolored mode.
137 * This parameter is using to switch between Results and Geometry
138 * modes. Multiple colors are using when the presentation is
139 * drawing in the Results mode, one color - in the Geometry mode.
142 SetIsColored(bool theIsColored);
147 //! Set type of the primitives.
149 SetPrimitiveType(int thePrimitiveType);
151 //! Get type of the primitives.
155 //! Get the maximum Point Sprite size, which is supported by hardware.
157 GetMaximumSupportedSize();
159 //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteClamp.
161 SetClamp(vtkFloatingPointType theClamp);
163 //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteClamp, vtkFloatingPointType).
167 //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteSize.
169 SetSize(vtkFloatingPointType theSize);
171 //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteSize, vtkFloatingPointType).
175 //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteMinSize.
177 SetMinSize(vtkFloatingPointType theMinSize);
179 //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteMinSize, vtkFloatingPointType).
183 //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteMinSize.
185 SetMaxSize(vtkFloatingPointType theMaxSize);
187 //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteMaxSize, vtkFloatingPointType).
191 //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteMagnification.
193 SetMagnification(vtkFloatingPointType theMagnification);
195 //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteMagnification, vtkFloatingPointType).
199 //! Set the increment of changing Magnification parameter.
201 SetMagnificationIncrement(vtkFloatingPointType theIncrement);
203 //! Get the increment of changing Magnification parameter.
205 GetMagnificationIncrement() { return myMagnificationIncrement; }
207 //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteAlphaThreshold.
209 SetAlphaThreshold(vtkFloatingPointType theAlphaThreshold);
211 //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteAlphaThreshold, vtkFloatingPointType).
215 //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteOpacity.
217 SetOpacity(vtkFloatingPointType theOpacity);
219 //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteOpacity, vtkFloatingPointType).
223 //! Set resolution of the Geometrical Sphere.
225 SetResolution(int theResolution);
227 //! Get resolution of the Geometrical Sphere.
231 //! Method for changing the Magnification parameter.
233 ChangeMagnification( bool up );
235 //! Get the maximum size of Point Sprites in the presentation.
239 //! Get point size by element's Id.
241 GetPointSize(vtkIdType theID);
243 //! Get point size by element's Id using the specified scalar array.
245 GetPointSize(vtkIdType theID, vtkDataArray* theScalarArray);
247 //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkSetMacro(AverageCellSize, vtkFloatingPointType).
249 SetAverageCellSize(vtkFloatingPointType AverageCellSize);
251 //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(AverageCellSize, vtkFloatingPointType).
253 GetAverageCellSize();
255 //! Set image data for the Point Sprite texture.
257 SetImageData(vtkImageData* theImageData);
259 //! Make the image data for Point Sprite texture.
261 * First parameter - texture for shape.
262 * Second parameter - texture for alpha mask.
265 vtkSmartPointer<vtkImageData>
266 MakeTexture( const char* theMainTexture,
267 const char* theAlphaTexture );
270 //----------------------------------------------------------------------------
273 SetIsDeformed( bool theIsDeformed );
281 SetScale( vtkFloatingPointType theScale );
289 SetMapScale( vtkFloatingPointType theMapScale = 1.0 );
299 AddGeometry(vtkDataSet* theGeometry, const VISU::TName& theGeomName);
303 GetGeometry(int theGeomNumber, VISU::TName& theGeomName);
307 GetNumberOfGeometry();
311 IsExternalGeometryUsed();
319 GetSourceRange(vtkFloatingPointType theRange[2]);
326 //----------------------------------------------------------------------------
327 VISU_GaussPointsPL();
330 ~VISU_GaussPointsPL();
334 OnCreateMapperHolder();
346 DoShallowCopy(VISU_PipeLine *thePipeLine,
347 bool theIsCopyInput);
350 //----------------------------------------------------------------------------
351 vtkFloatingPointType myScaleFactor;
352 vtkWarpVector *myWarpVector;
353 std::vector<vtkPassThroughFilter*> myPassFilter;
354 vtkSmartPointer<VISU_PointSpriteMapperHolder> myPointSpriteMapperHolder;
357 vtkSphereSource* mySphereSource;
359 vtkFloatingPointType myMagnificationIncrement;
363 vtkSmartPointer<VISU_AppendFilter> myAppendFilter;
364 vtkSmartPointer<VISU_GaussMergeFilter> myMergeFilter;
367 VISU_GaussPointsPL(const VISU_GaussPointsPL&); // Not implemented.
368 void operator=(const VISU_GaussPointsPL&); // Not implemented.