Salome HOME
0021711: [CEA 579] Simplify Properties dialog accordingly to dimension of mesh
[modules/visu.git] / src / PIPELINE / VISU_GaussPointsPL.hxx
index 4acd793f6214ab69dfa52ca95ce17036879b7a06..b29100d9416cdd7dbbaa6bba4cb8b3832cb829a2 100644 (file)
@@ -1,40 +1,41 @@
-//  VISU OBJECT : interactive object for VISU entities implementation
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
 //
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+//  VISU OBJECT : interactive object for VISU entities implementation
 // File:    VISU_GaussPointsPL.hxx
 // Author:  
 // Module : VISU
-
+//
 #ifndef VISU_GaussPointsPL_HeaderFile
 #define VISU_GaussPointsPL_HeaderFile
 
-#include "VISU_ScalarMapPL.hxx"
-#include "VISU_Convertor.hxx"
+#include "VISUPipeline.hxx"
+#include "VISU_MergedPL.hxx"
+#include "VISU_ColoredPL.hxx"
 
 #include <vector>
 
-class VTKViewer_PassThroughFilter;
 class VISU_OpenGLPointSpriteMapper;
+class VISU_PointSpriteMapperHolder;
 
 class vtkGeometryFilter;
 class vtkGlyph3D;
@@ -42,82 +43,81 @@ class vtkSphereSource;
 class vtkDataArray;
 class vtkImageData;
 class vtkPointSet;
+class vtkPassThroughFilter;
+class vtkDataSet;
 
-class vtkCellDataToPointData;
 class vtkWarpVector;
 class SALOME_Transform;
 
+class VISU_AppendFilter;
+class VISU_GaussMergeFilter;
+
+//----------------------------------------------------------------------------
 //! Pipeline for the Gauss Points presentation.
 /*!
  * This class uses the special mapper (VISU_OpenGLPointSpriteMapper)
  * for rendering the Gauss Points as Point Sprites.
  */
-class VISU_GaussPointsPL : public VISU_ScalarMapPL
+class VISU_PIPELINE_EXPORT VISU_GaussPointsPL : public VISU_MergedPL,
+                                                public VISU_ColoredPL
 {
-protected:
-  VISU_GaussPointsPL();
-
-  virtual
-  ~VISU_GaussPointsPL();
-
 public:
-  vtkTypeMacro(VISU_GaussPointsPL,VISU_ScalarMapPL);
+  //----------------------------------------------------------------------------
+  vtkTypeMacro(VISU_GaussPointsPL, VISU_ColoredPL);
 
   static 
-  VISU_GaussPointsPL* New();
+  VISU_GaussPointsPL* 
+  New();
   
   virtual
-  void
-  ShallowCopy(VISU_PipeLine *thePipeLine);
+  unsigned long int 
+  GetMTime();
 
-  //! Get the native mapper.
-  virtual
-  TMapper* 
-  GetMapper();
+  //----------------------------------------------------------------------------
+  void 
+  SetGaussPtsIDMapper(const VISU::PGaussPtsIDMapper& theGaussPtsIDMapper);
+
+  const VISU::PGaussPtsIDMapper&  
+  GetGaussPtsIDMapper();
+
+  VISU_PointSpriteMapperHolder*
+  GetPointSpriteMapperHolder();
 
   //! Get the internal #VISU_OpenGLPointSpriteMapper.
   VISU_OpenGLPointSpriteMapper*
-  GetPSMapper();
+  GetPointSpriteMapper();
+
+  vtkDataSet*  
+  GetParentMesh();
 
   //! Get an intermediate dataset that can be picked  
-  vtkDataSet*
+  vtkPolyData*
   GetPickableDataSet();
 
+  //----------------------------------------------------------------------------
   //! Redefined method for initialization of the pipeline.
   virtual
   void
   Init();
 
-  //! Redefined method for building the pipeline.
-  virtual
-  void
-  Build();
-
   //! Redefined method for updating the pipeline.
   virtual
   void
   Update();
 
+  //! Gets memory size used by the instance (bytes).
+  virtual
+  unsigned long int
+  GetMemorySize();
+
+  //----------------------------------------------------------------------------
   //! Update glyph.
   void
   UpdateGlyph();
 
   virtual 
   VISU::TGaussPointID 
-  GetObjID(vtkIdType theID) const;
-
-  virtual
-  vtkFloatingPointType* 
-  GetNodeCoord(vtkIdType theObjID);
-
-  void 
-  SetGaussPtsIDMapper(const VISU::PGaussPtsIDMapper& theGaussPtsIDMapper);
-
-  const VISU::PGaussPtsIDMapper&  
-  GetGaussPtsIDMapper() const;
-
-  VISU::TVTKOutput*  
-  GetParentMesh() const;
+  GetObjID(vtkIdType theID);
 
   //! Set the Bicolor mode.
   /*!
@@ -141,6 +141,9 @@ public:
   void
   SetIsColored(bool theIsColored);
 
+  bool 
+  GetIsColored();
+
   //! Set type of the primitives.
   void
   SetPrimitiveType(int thePrimitiveType);
@@ -209,13 +212,21 @@ public:
   vtkFloatingPointType
   GetAlphaThreshold();
 
+  //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteOpacity.
+  void
+  SetOpacity(vtkFloatingPointType theOpacity);
+
+  //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteOpacity, vtkFloatingPointType).
+  vtkFloatingPointType
+  GetOpacity();
+
   //! Set resolution of the Geometrical Sphere.
   void
   SetResolution(int theResolution);
 
   //! Get resolution of the Geometrical Sphere.
   int
-  GetResolution() { return myResolution; }
+  GetResolution();
 
   //! Method for changing the Magnification parameter.
   void
@@ -253,39 +264,108 @@ public:
   static
   vtkSmartPointer<vtkImageData>
   MakeTexture( const char* theMainTexture,
-              const char* theAlphaTexture );
+               const char* theAlphaTexture );
 
 public:
-  virtual void  SetIsDeformed( bool theIsDeformed );
-  virtual bool  GetIsDeformed() const;
+  //----------------------------------------------------------------------------
+  virtual 
+  void
+  SetIsDeformed( bool theIsDeformed );
 
-  virtual void  SetScale( vtkFloatingPointType theScale );
-  virtual vtkFloatingPointType GetScale();
-  virtual void  SetMapScale( vtkFloatingPointType theMapScale = 1.0 );
+  virtual
+  bool
+  GetIsDeformed();
+
+  virtual
+  void
+  SetScale( vtkFloatingPointType theScale );
+
+  virtual
+  vtkFloatingPointType 
+  GetScale();
+
+  virtual
+  void
+  SetMapScale( vtkFloatingPointType theMapScale = 1.0 );
+
+public:
+
+  virtual  
+  void  
+  SetSourceGeometry();
+
+  virtual
+  int
+  AddGeometry(vtkDataSet* theGeometry, const VISU::TName& theGeomName);
+
+  virtual
+  vtkDataSet*
+  GetGeometry(int theGeomNumber, VISU::TName& theGeomName);
+
+  virtual
+  int
+  GetNumberOfGeometry();
+
+  virtual
+  bool 
+  IsExternalGeometryUsed();
+
+  virtual
+  void
+  ClearGeometry();
+
+  virtual
+  void
+  GetSourceRange(vtkFloatingPointType theRange[2]);
+
+  virtual 
+  vtkPointSet* 
+  GetMergedInput();
 
 protected:
-  bool myIsDeformed;
+  //----------------------------------------------------------------------------
+  VISU_GaussPointsPL();
+
+  virtual
+  ~VISU_GaussPointsPL();
+
+  virtual
+  void
+  OnCreateMapperHolder();
+
+  virtual
+  void
+  Build();
+
+  virtual
+  vtkDataSet* 
+  InsertCustomPL();
+
+  virtual
+  void
+  DoShallowCopy(VISU_PipeLine *thePipeLine,
+                bool theIsCopyInput);
+
+private:
+  //----------------------------------------------------------------------------
   vtkFloatingPointType myScaleFactor;
   vtkWarpVector *myWarpVector;
-  vtkCellDataToPointData* myCellDataToPointData;
-  std::vector<VTKViewer_PassThroughFilter*> myPassFilter;
+  std::vector<vtkPassThroughFilter*> myPassFilter;
+  vtkSmartPointer<VISU_PointSpriteMapperHolder> myPointSpriteMapperHolder;
   
   vtkGlyph3D* myGlyph;
   vtkSphereSource* mySphereSource;
-  int myResolution;
 
-protected:
-  VISU_OpenGLPointSpriteMapper* myPSMapper;
-  VISU::PGaussPtsIDMapper myGaussPtsIDMapper;
+  vtkFloatingPointType myMagnificationIncrement;
 
-  vtkGeometryFilter* myGeomFilter;
+  int myPrimitiveType;
 
-  vtkDataArray *myScalarArray;
-  vtkFloatingPointType mySourceScalarRange[2];
-  vtkFloatingPointType myDeltaScalarRange;
+  vtkSmartPointer<VISU_AppendFilter>      myAppendFilter;
+  vtkSmartPointer<VISU_GaussMergeFilter>  myMergeFilter;
 
-  int   myPrimitiveType;
-  vtkFloatingPointType myMagnificationIncrement;
+private:
+  VISU_GaussPointsPL(const VISU_GaussPointsPL&);  // Not implemented.
+  void operator=(const VISU_GaussPointsPL&);  // Not implemented.
 };
   
 #endif