1 // VISU OBJECT : interactive object for VISU entities implementation
3 // Copyright (C) 2003 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
24 // File: VISU_GaussPointsPL.hxx
28 #ifndef VISU_GaussPointsPL_HeaderFile
29 #define VISU_GaussPointsPL_HeaderFile
31 #include "VISU_ScalarMapPL.hxx"
32 #include "VISU_Convertor.hxx"
36 class VTKViewer_PassThroughFilter;
37 class VISU_OpenGLPointSpriteMapper;
39 class vtkGeometryFilter;
41 class vtkSphereSource;
46 class vtkCellDataToPointData;
48 class SALOME_Transform;
50 //! Pipeline for the Gauss Points presentation.
52 * This class uses the special mapper (VISU_OpenGLPointSpriteMapper)
53 * for rendering the Gauss Points as Point Sprites.
55 class VISU_GaussPointsPL : public VISU_ScalarMapPL
61 ~VISU_GaussPointsPL();
64 vtkTypeMacro(VISU_GaussPointsPL,VISU_ScalarMapPL);
67 VISU_GaussPointsPL* New();
71 ShallowCopy(VISU_PipeLine *thePipeLine);
73 //! Get the native mapper.
78 //! Get the internal #VISU_OpenGLPointSpriteMapper.
79 VISU_OpenGLPointSpriteMapper*
82 //! Get an intermediate dataset that can be picked
86 //! Redefined method for initialization of the pipeline.
91 //! Redefined method for building the pipeline.
96 //! Redefined method for updating the pipeline.
107 GetObjID(vtkIdType theID) const;
110 vtkFloatingPointType*
111 GetNodeCoord(vtkIdType theObjID);
114 SetGaussPtsIDMapper(const VISU::PGaussPtsIDMapper& theGaussPtsIDMapper);
116 const VISU::PGaussPtsIDMapper&
117 GetGaussPtsIDMapper() const;
120 GetParentMesh() const;
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);
144 //! Set type of the primitives.
146 SetPrimitiveType(int thePrimitiveType);
148 //! Get type of the primitives.
152 //! Get the maximum Point Sprite size, which is supported by hardware.
154 GetMaximumSupportedSize();
156 //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteClamp.
158 SetClamp(vtkFloatingPointType theClamp);
160 //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteClamp, vtkFloatingPointType).
164 //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteSize.
166 SetSize(vtkFloatingPointType theSize);
168 //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteSize, vtkFloatingPointType).
172 //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteMinSize.
174 SetMinSize(vtkFloatingPointType theMinSize);
176 //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteMinSize, vtkFloatingPointType).
180 //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteMinSize.
182 SetMaxSize(vtkFloatingPointType theMaxSize);
184 //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteMaxSize, vtkFloatingPointType).
188 //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteMagnification.
190 SetMagnification(vtkFloatingPointType theMagnification);
192 //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteMagnification, vtkFloatingPointType).
196 //! Set the increment of changing Magnification parameter.
198 SetMagnificationIncrement(vtkFloatingPointType theIncrement);
200 //! Get the increment of changing Magnification parameter.
202 GetMagnificationIncrement() { return myMagnificationIncrement; }
204 //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteAlphaThreshold.
206 SetAlphaThreshold(vtkFloatingPointType theAlphaThreshold);
208 //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteAlphaThreshold, vtkFloatingPointType).
212 //! Set resolution of the Geometrical Sphere.
214 SetResolution(int theResolution);
216 //! Get resolution of the Geometrical Sphere.
218 GetResolution() { return myResolution; }
220 //! Method for changing the Magnification parameter.
222 ChangeMagnification( bool up );
224 //! Get the maximum size of Point Sprites in the presentation.
228 //! Get point size by element's Id.
230 GetPointSize(vtkIdType theID);
232 //! Get point size by element's Id using the specified scalar array.
234 GetPointSize(vtkIdType theID, vtkDataArray* theScalarArray);
236 //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkSetMacro(AverageCellSize, vtkFloatingPointType).
238 SetAverageCellSize(vtkFloatingPointType AverageCellSize);
240 //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(AverageCellSize, vtkFloatingPointType).
242 GetAverageCellSize();
244 //! Set image data for the Point Sprite texture.
246 SetImageData(vtkImageData* theImageData);
248 //! Make the image data for Point Sprite texture.
250 * First parameter - texture for shape.
251 * Second parameter - texture for alpha mask.
254 vtkSmartPointer<vtkImageData>
255 MakeTexture( const char* theMainTexture,
256 const char* theAlphaTexture );
259 virtual void SetIsDeformed( bool theIsDeformed );
260 virtual bool GetIsDeformed() const;
262 virtual void SetScale( vtkFloatingPointType theScale );
263 virtual vtkFloatingPointType GetScale();
264 virtual void SetMapScale( vtkFloatingPointType theMapScale = 1.0 );
268 vtkFloatingPointType myScaleFactor;
269 vtkWarpVector *myWarpVector;
270 vtkCellDataToPointData* myCellDataToPointData;
271 std::vector<VTKViewer_PassThroughFilter*> myPassFilter;
274 vtkSphereSource* mySphereSource;
278 VISU_OpenGLPointSpriteMapper* myPSMapper;
279 VISU::PGaussPtsIDMapper myGaussPtsIDMapper;
281 vtkGeometryFilter* myGeomFilter;
283 vtkDataArray *myScalarArray;
284 vtkFloatingPointType mySourceScalarRange[2];
285 vtkFloatingPointType myDeltaScalarRange;
288 vtkFloatingPointType myMagnificationIncrement;