1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File: GEOMAlgo_ClsfSolid.cxx
21 // Created: Mon Jan 29 10:35:46 2007
22 // Author: Peter KURNEV
26 #include <GEOMAlgo_ClsfSolid.ixx>
28 #include <TopAbs_ShapeEnum.hxx>
30 #include <TopoDS_Solid.hxx>
31 #include <BRep_Builder.hxx>
32 #include <BRepClass3d_SolidClassifier.hxx>
34 //=======================================================================
37 //=======================================================================
38 GEOMAlgo_ClsfSolid::GEOMAlgo_ClsfSolid()
44 //=======================================================================
47 //=======================================================================
48 GEOMAlgo_ClsfSolid::~GEOMAlgo_ClsfSolid()
51 BRepClass3d_SolidClassifier* pSC;
53 pSC=(BRepClass3d_SolidClassifier*)myPClsf;
57 //=======================================================================
60 //=======================================================================
61 void GEOMAlgo_ClsfSolid::SetShape(const TopoDS_Shape& aS)
65 //=======================================================================
68 //=======================================================================
69 const TopoDS_Shape& GEOMAlgo_ClsfSolid::Shape()const
73 //=======================================================================
74 //function : CheckData
76 //=======================================================================
77 void GEOMAlgo_ClsfSolid::CheckData()
81 BRepClass3d_SolidClassifier* pSC;
82 TopAbs_ShapeEnum aType;
86 if (myShape.IsNull()) {
87 myErrorStatus=10; // mySolid=NULL
91 aType=myShape.ShapeType();
92 if (!(aType==TopAbs_SOLID || aType==TopAbs_SHELL)) {
98 if (aType==TopAbs_SOLID) {
99 aS=TopoDS::Solid(myShape);
103 aBB.Add(aS, myShape);
107 pSC=(BRepClass3d_SolidClassifier*)myPClsf;
111 pSC=new BRepClass3d_SolidClassifier(aS);
114 //=======================================================================
117 //=======================================================================
118 void GEOMAlgo_ClsfSolid::Perform()
127 BRepClass3d_SolidClassifier* pSC;
129 pSC=(BRepClass3d_SolidClassifier*)myPClsf;
130 pSC->Perform(myPnt, myTolerance);
131 myState=pSC->State();
138 // 12 - unallowed type of myShape