1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File: GEOMAlgo_ClsfSolid.cxx
23 // Created: Mon Jan 29 10:35:46 2007
24 // Author: Peter KURNEV
27 #include <GEOMAlgo_ClsfSolid.ixx>
29 #include <TopAbs_ShapeEnum.hxx>
31 #include <TopoDS_Solid.hxx>
32 #include <BRep_Builder.hxx>
33 #include <BRepClass3d_SolidClassifier.hxx>
35 //=======================================================================
38 //=======================================================================
39 GEOMAlgo_ClsfSolid::GEOMAlgo_ClsfSolid()
45 //=======================================================================
48 //=======================================================================
49 GEOMAlgo_ClsfSolid::~GEOMAlgo_ClsfSolid()
52 BRepClass3d_SolidClassifier* pSC;
54 pSC=(BRepClass3d_SolidClassifier*)myPClsf;
58 //=======================================================================
61 //=======================================================================
62 void GEOMAlgo_ClsfSolid::SetShape(const TopoDS_Shape& aS)
66 //=======================================================================
69 //=======================================================================
70 const TopoDS_Shape& GEOMAlgo_ClsfSolid::Shape()const
74 //=======================================================================
75 //function : CheckData
77 //=======================================================================
78 void GEOMAlgo_ClsfSolid::CheckData()
82 BRepClass3d_SolidClassifier* pSC;
83 TopAbs_ShapeEnum aType;
87 if (myShape.IsNull()) {
88 myErrorStatus=10; // mySolid=NULL
92 aType=myShape.ShapeType();
93 if (!(aType==TopAbs_SOLID || aType==TopAbs_SHELL)) {
99 if (aType==TopAbs_SOLID) {
100 aS=TopoDS::Solid(myShape);
104 aBB.Add(aS, myShape);
108 pSC=(BRepClass3d_SolidClassifier*)myPClsf;
112 pSC=new BRepClass3d_SolidClassifier(aS);
115 //=======================================================================
118 //=======================================================================
119 void GEOMAlgo_ClsfSolid::Perform()
128 BRepClass3d_SolidClassifier* pSC;
130 pSC=(BRepClass3d_SolidClassifier*)myPClsf;
131 pSC->Perform(myPnt, myTolerance);
132 myState=pSC->State();
139 // 12 - unallowed type of myShape