1 // Copyright (C) 2007-2016 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, or (at your option) any later version.
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 // File: GEOMAlgo_ClsfSolid.cxx
21 // Created: Mon Jan 29 10:35:46 2007
22 // Author: Peter KURNEV
25 #include <GEOMAlgo_ClsfSolid.hxx>
27 #include <TopAbs_ShapeEnum.hxx>
30 #include <TopoDS_Solid.hxx>
32 #include <BRep_Builder.hxx>
33 #include <BRepClass3d_SolidClassifier.hxx>
35 IMPLEMENT_STANDARD_RTTIEXT(GEOMAlgo_ClsfSolid, GEOMAlgo_Clsf)
37 //=======================================================================
40 //=======================================================================
41 GEOMAlgo_ClsfSolid::GEOMAlgo_ClsfSolid()
47 //=======================================================================
50 //=======================================================================
51 GEOMAlgo_ClsfSolid::~GEOMAlgo_ClsfSolid()
54 BRepClass3d_SolidClassifier* pSC;
56 pSC=(BRepClass3d_SolidClassifier*)myPClsf;
60 //=======================================================================
63 //=======================================================================
64 void GEOMAlgo_ClsfSolid::SetShape(const TopoDS_Shape& aS)
68 //=======================================================================
71 //=======================================================================
72 const TopoDS_Shape& GEOMAlgo_ClsfSolid::Shape()const
76 //=======================================================================
77 //function : CheckData
79 //=======================================================================
80 void GEOMAlgo_ClsfSolid::CheckData()
84 BRepClass3d_SolidClassifier* pSC;
85 TopAbs_ShapeEnum aType;
89 if (myShape.IsNull()) {
90 myErrorStatus=10; // mySolid=NULL
94 aType=myShape.ShapeType();
95 if (!(aType==TopAbs_SOLID || aType==TopAbs_SHELL)) {
101 if (aType==TopAbs_SOLID) {
102 aS=TopoDS::Solid(myShape);
106 aBB.Add(aS, myShape);
110 pSC=(BRepClass3d_SolidClassifier*)myPClsf;
114 pSC=new BRepClass3d_SolidClassifier(aS);
117 //=======================================================================
120 //=======================================================================
121 void GEOMAlgo_ClsfSolid::Perform()
130 BRepClass3d_SolidClassifier* pSC;
132 pSC=(BRepClass3d_SolidClassifier*)myPClsf;
133 pSC->Perform(myPnt, myTolerance);
134 myState=pSC->State();
141 // 12 - unallowed type of myShape