Salome HOME
Update Help for VISU module.
[modules/visu.git] / src / PIPELINE / VISU_PipeLine.hxx
index 21a8b24d4b2ecb8e39f69f528b87e8f685d5914f..4dd6db6ea26d3770e796b46295a50c63775051a8 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 <vtkObject.h>
-#include <vtkProperty.h>
+#include <vtkSmartPointer.h>
+
+#include <vector>
+
+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 vtkDataSetMapper;
 class vtkUnstructuredGrid;
+class vtkExtractGeometry;
+class vtkImplicitBoolean;
+class vtkPlane;
+
+class SALOME_ExtractGeometry;
+
+typedef vtkUnstructuredGrid 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 void SameAs(VISU_PipeLine *thePipeLine);
 
-public:  
-  typedef vtkUnstructuredGrid TInput;
+public:
   virtual void SetInput(TInput* theInput);
-  virtual TInput* GetInput() { return myInput;}
+  virtual TInput* GetInput() const;
+
+  bool IsPlanarInput() const;
 
   typedef vtkDataSetMapper TMapper;
   virtual TMapper* GetMapper();
@@ -55,14 +86,35 @@ public:
   virtual void Init() = 0;
   virtual void Update();
 
-  static size_t CheckAvailableMemory(const size_t& theSize);
-  static size_t GetAvailableMemory(size_t theSize = 16*1024*1024, 
-                                  size_t theMinSize = 1024*1024);
+  static int CheckAvailableMemory(const float& theSize);
+  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; }
+
 protected:
+  VISU_PipeLine();
+  VISU_PipeLine(const VISU_PipeLine&);
+
+  virtual TInput* GetInput2() const;
   virtual void Build() = 0;
-  
-  TInput *myInput;
+
+  bool myIsShrinkable;
+
+  TInput  *myInput;
   TMapper *myMapper;
+
+  // Clipping planes
+  TVTKSmartPtr<SALOME_ExtractGeometry> myExtractGeometry;
 };
 
 #endif