Version: 6.3.1

src/VISU_I/VISU_ClippingPlaneMgr.hxx

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 //  VISU OBJECT : interactive object for VISU entities implementation
00021 //  File   : VISU_ClippingPlaneMgr.hxx
00022 //  Author : VSV
00023 //  Module : VISU
00024 //
00025 #ifndef _VISU_ClippingPlane_H_
00026 #define _VISU_ClippingPlane_H_
00027 
00028 #include "VISU_I.hxx"
00029 #include "VISUConfig.hh"
00030 #include "SALOME_Component_i.hxx"
00031 #include "VISU_ColoredPrs3d_i.hh"
00032 
00033 #include <vtkPlane.h>
00034 #include <string>
00035 
00036 class vtkImplicitFunctionCollection;
00037 
00038 
00039 class VISU_I_EXPORT VISU_CutPlaneFunction: public vtkPlane
00040 {
00041 public:
00042   static VISU_CutPlaneFunction* New();
00043 
00044   vtkTypeMacro(VISU_CutPlaneFunction, vtkPlane);
00045 
00046   virtual double EvaluateFunction(double x[3]);
00047   virtual double EvaluateFunction(double x, double y, double z);
00048 
00049   void setActive(bool theActive);
00050   bool isActive() const { return myIsActive; }
00051 
00052   void setPlaneObject(_PTR(SObject) aSOPlane) { mySObject = aSOPlane; }
00053   _PTR(SObject) getPlaneObject() const { return mySObject; }
00054 
00055   void setName(std::string theName) { myName = theName; }
00056   std::string getName() const { return myName; }
00057   
00058   void setAuto(bool isAuto) { myIsAuto = isAuto; }
00059   bool isAuto() const { return myIsAuto; }
00060 
00061 protected:
00062   VISU_CutPlaneFunction();
00063   ~VISU_CutPlaneFunction();
00064 
00065 private:
00066   bool myIsActive;
00067   _PTR(SObject) mySObject;
00068   std::string myName;
00069   bool myIsAuto;
00070 };
00071 
00072 
00073 
00074 class VISU_I_EXPORT VISU_ClippingPlaneMgr {
00075 public:
00076   VISU_ClippingPlaneMgr();
00077   ~VISU_ClippingPlaneMgr();
00078 
00079   void SetStudy(_PTR(Study) theStudy, bool reinitStudy = false);
00080 
00081 
00082   long CreateClippingPlane(double X,double  Y, double Z, 
00083                            double dX, double dY, double dZ, 
00084                            bool isAuto, const char* name);
00085 
00086   void EditClippingPlane(long id, double X,double  Y, double Z, 
00087                            double dX, double dY, double dZ, 
00088                            bool isAuto, const char* name);
00089 
00090   _PTR(SObject) CreateClippingPlaneObject(double X,double  Y, double Z, 
00091                                           double dX, double dY, double dZ, 
00092                                           bool isAuto, const char* name);
00093   
00094   /* Returns clipping plane by its Id */
00095   VISU_CutPlaneFunction* GetClippingPlane(long id);
00096 
00097   /* Returns -1 if Plane is not exists */
00098   int GetPlaneId(VISU_CutPlaneFunction* thePlane);
00099   
00100   /* Deletes clipping plane by its Id */
00101   bool DeleteClippingPlane(long id);
00102   
00103   /* Applyes a clipping plane with Id to presentation thePrs */
00104   bool ApplyClippingPlane(VISU::Prs3d_i* thePrs, long id);
00105 
00106   bool DetachClippingPlane(VISU::Prs3d_i* thePrs, long id);
00107   
00108   /* Get number of clipping planes */
00109   long GetClippingPlanesNb();
00110 
00111   _PTR(SObject) GetClippingPlanesFolder(bool toCreate);
00112 
00113   static bool ContainsPlane(VISU::Prs3d_ptr thePrs, VISU_CutPlaneFunction* thePlane);
00114   static bool ContainsPlane(VISU::Prs3d_i* thePrs, VISU_CutPlaneFunction* thePlane);
00115 
00116   vtkImplicitFunctionCollection* GetPlanesList() const { return myPlanes; }
00117 
00118 
00119 private:
00120   void applyPlaneToAll(VISU_CutPlaneFunction* thePlane);
00121 
00122 
00123   _PTR(Study) myStudy;
00124 
00125   vtkImplicitFunctionCollection* myPlanes;
00126 };
00127 
00128 #endif
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS