1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // VISU OBJECT : interactive object for VISU entities implementation
21 // File : VISU_ClippingPlaneMgr.hxx
25 #ifndef _VISU_ClippingPlane_H_
26 #define _VISU_ClippingPlane_H_
29 #include "VISUConfig.hh"
30 #include "SALOME_Component_i.hxx"
31 #include "VISU_ColoredPrs3d_i.hh"
36 class vtkImplicitFunctionCollection;
39 class VISU_I_EXPORT VISU_CutPlaneFunction: public vtkPlane
42 static VISU_CutPlaneFunction* New();
44 vtkTypeMacro(VISU_CutPlaneFunction, vtkPlane);
46 virtual double EvaluateFunction(double x[3]);
47 virtual double EvaluateFunction(double x, double y, double z);
49 void setActive(bool theActive);
50 bool isActive() const { return myIsActive; }
52 void setPlaneObject(_PTR(SObject) aSOPlane) { mySObject = aSOPlane; }
53 _PTR(SObject) getPlaneObject() const { return mySObject; }
55 void setName(std::string theName) { myName = theName; }
56 std::string getName() const { return myName; }
58 void setAuto(bool isAuto) { myIsAuto = isAuto; }
59 bool isAuto() const { return myIsAuto; }
62 VISU_CutPlaneFunction();
63 ~VISU_CutPlaneFunction();
67 _PTR(SObject) mySObject;
74 class VISU_I_EXPORT VISU_ClippingPlaneMgr {
76 VISU_ClippingPlaneMgr();
77 ~VISU_ClippingPlaneMgr();
79 void SetStudy(_PTR(Study) theStudy, bool reinitStudy = false);
82 long CreateClippingPlane(double X,double Y, double Z,
83 double dX, double dY, double dZ,
84 bool isAuto, const char* name);
86 void EditClippingPlane(long id, double X,double Y, double Z,
87 double dX, double dY, double dZ,
88 bool isAuto, const char* name);
90 _PTR(SObject) CreateClippingPlaneObject(double X,double Y, double Z,
91 double dX, double dY, double dZ,
92 bool isAuto, const char* name);
94 /* Returns clipping plane by its Id */
95 VISU_CutPlaneFunction* GetClippingPlane(long id);
97 /* Returns -1 if Plane is not exists */
98 int GetPlaneId(VISU_CutPlaneFunction* thePlane);
100 /* Deletes clipping plane by its Id */
101 bool DeleteClippingPlane(long id);
103 /* Applyes a clipping plane with Id to presentation thePrs */
104 bool ApplyClippingPlane(VISU::Prs3d_i* thePrs, long id);
106 bool DetachClippingPlane(VISU::Prs3d_i* thePrs, long id);
108 /* Get number of clipping planes */
109 long GetClippingPlanesNb();
111 _PTR(SObject) GetClippingPlanesFolder(bool toCreate);
113 static bool ContainsPlane(VISU::Prs3d_ptr thePrs, VISU_CutPlaneFunction* thePlane);
114 static bool ContainsPlane(VISU::Prs3d_i* thePrs, VISU_CutPlaneFunction* thePlane);
116 vtkImplicitFunctionCollection* GetPlanesList() const { return myPlanes; }
120 void applyPlaneToAll(VISU_CutPlaneFunction* thePlane);
125 vtkImplicitFunctionCollection* myPlanes;