Salome HOME
Fix for Bug IPAL8945
[modules/visu.git] / src / PIPELINE / VISU_PipeLine.hxx
index 21a8b24d4b2ecb8e39f69f528b87e8f685d5914f..5e2a1ed8bf8bb85694140c757ef8ffdb2845a112 100644 (file)
@@ -1,23 +1,23 @@
 //  VISU OBJECT : interactive object for VISU entities implementation
 //
 //  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 // File:    VISU_PipeLine.hxx
 #ifndef VISU_PipeLine_HeaderFile
 #define VISU_PipeLine_HeaderFile
 
-#include <string>
-#include <algorithm>
+#include <vector>
 #include <vtkObject.h>
-#include <vtkProperty.h>
+#include <vtkSmartPointer.h>
+
+#include "VISU_IDMapper.hxx"
+
+class vtkCell;
+class vtkDataSet;
+class vtkImplicitFunction;
+
+template <class T>
+class TVTKSmartPtr: public vtkSmartPointer<T>
+{
+public:
+  TVTKSmartPtr()
+  {}
+
+  TVTKSmartPtr(T* r, bool theIsOwner = false): vtkSmartPointer<T>(r) 
+  {
+    if(r && theIsOwner)
+      r->Delete();
+  }
+
+  TVTKSmartPtr& operator()(T* r, bool theIsOwner = false)
+  {
+    vtkSmartPointer<T>::operator=(r);
+    if(r && theIsOwner)
+      r->Delete();
+    return *this;
+  }
+
+  TVTKSmartPtr& operator=(T* r)
+  {
+    vtkSmartPointer<T>::operator=(r);
+    return *this;
+  }
 
+  operator T* () const 
+  {
+    return vtkSmartPointer<T>::GetPointer();
+  }
+};
+
+class vtkMapper;
 class vtkDataSetMapper;
 class vtkUnstructuredGrid;
+class vtkExtractGeometry;
+class vtkImplicitBoolean;
+class vtkPlane;
+
+class SALOME_ExtractGeometry;
+
+typedef VISU::TVTKOutput TInput;
 
 class VISU_PipeLine : public vtkObject{
-protected:
-  VISU_PipeLine();
-  VISU_PipeLine(const VISU_PipeLine&);
 public:
   vtkTypeMacro(VISU_PipeLine,vtkObject);
-  virtual ~VISU_PipeLine();
-  virtual void ShallowCopy(VISU_PipeLine *thePipeLine);
+  virtual
+  ~VISU_PipeLine();
 
-public:  
-  typedef vtkUnstructuredGrid TInput;
-  virtual void SetInput(TInput* theInput);
-  virtual TInput* GetInput() { return myInput;}
+  virtual
+  void
+  DebugOn();
 
-  typedef vtkDataSetMapper TMapper;
-  virtual TMapper* GetMapper();
+  virtual
+  void
+  DebugOff();
 
-  virtual void Init() = 0;
-  virtual void Update();
+  virtual
+  void
+  ShallowCopy(VISU_PipeLine *thePipeLine);
 
-  static size_t CheckAvailableMemory(const size_t& theSize);
-  static size_t GetAvailableMemory(size_t theSize = 16*1024*1024, 
-                                  size_t theMinSize = 1024*1024);
-protected:
-  virtual void Build() = 0;
+  virtual
+  void
+  SameAs(VISU_PipeLine *thePipeLine);
+
+public:
+  virtual
+  void
+  SetInput(TInput* theInput);
+
+  virtual
+  TInput* 
+  GetInput() const;
+
+  virtual
+  vtkDataSet* 
+  GetOutput();
+
+  bool
+  IsPlanarInput() const;
+
+  typedef vtkMapper TMapper;
+
+  virtual 
+  TMapper* 
+  GetMapper();
+
+  virtual
+  void
+  Init() = 0;
+
+  virtual
+  void
+  Update();
+
+  static
+  int
+  CheckAvailableMemory(const float& theSize);
   
-  TInput *myInput;
-  TMapper *myMapper;
+  static
+  float
+  GetAvailableMemory(float theSize = 16*1024*1024.0,
+                    float theMinSize = 1024*1024.0);
+
+  // Clipping planes
+  void 
+  RemoveAllClippingPlanes();
+
+  vtkIdType
+  GetNumberOfClippingPlanes() const;
+
+  bool
+  AddClippingPlane(vtkPlane* thePlane);
+
+  vtkPlane* 
+  GetClippingPlane(vtkIdType theID) const;
+
+  void
+  SetPlaneParam(float theDir[3], 
+               float theDist, 
+               vtkPlane* thePlane);
+
+  void
+  GetPlaneParam(float theDir[3], 
+               float& theDist, 
+               vtkPlane* thePlane);
+
+  bool 
+  IsShrinkable() { return myIsShrinkable; }
+
+  virtual
+  vtkIdType
+  GetNodeObjID(vtkIdType theID);
+
+  virtual
+  vtkIdType
+  GetNodeVTKID(vtkIdType theID);
+
+  virtual
+  float* 
+  GetNodeCoord(vtkIdType theObjID);
+
+  virtual
+  vtkIdType
+  GetElemObjID(vtkIdType theID);
+
+  virtual
+  vtkIdType
+  GetElemVTKID(vtkIdType theID);
+
+  virtual
+  vtkCell*
+  GetElemCell(vtkIdType theObjID);
+
+  void 
+  SetIDMapper(const VISU::PIDMapper& theIDMapper);
+
+  const VISU::PIDMapper&  
+  GetIDMapper()const;
+
+  void
+  SetImplicitFunction(vtkImplicitFunction *theFunction);
+
+  vtkImplicitFunction* 
+  GetImplicitFunction();
+
+  SALOME_ExtractGeometry*
+  GetExtractGeometryFilter();
+
+protected:
+  VISU_PipeLine();
+  VISU_PipeLine(const VISU_PipeLine&);
+
+  virtual 
+  TInput* 
+  GetInput2() const;
+
+  virtual
+  void
+  Build() = 0;
+
+  bool myIsShrinkable;
+
+  TVTKSmartPtr<TInput> myInput;
+  VISU::PIDMapper myIDMapper;
+  TVTKSmartPtr<vtkDataSetMapper> myMapper;
+
+  // Clipping planes
+  TVTKSmartPtr<SALOME_ExtractGeometry> myExtractGeometry;
 };
 
 #endif