X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_Boolean.cpp;h=9d3a05873507cc28a76d59a47d59f0ace60616cc;hb=38afbd899a8645c83e17f2c24a17a2b7414911b4;hp=e75205a02d34d3b7b903636d97f0dc99a91fe6f9;hpb=8c99e5e8dd74d99dfbf534bd66b32b70ca134aa7;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp index e75205a02..9d3a05873 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + // File: GeomAlgoAPI_Boolean.cpp // Created: 02 Sept 2014 // Author: Vitaly Smetannikov @@ -11,62 +13,59 @@ #include #include -#define FUSE 0 -#define CUT 1 -#define COMMON 2 -boost::shared_ptr GeomAlgoAPI_Boolean::makeCut( - boost::shared_ptr theShape, - boost::shared_ptr theTool) +std::shared_ptr GeomAlgoAPI_Boolean::makeCut( + std::shared_ptr theShape, + std::shared_ptr theTool) { const TopoDS_Shape& aShape = theShape->impl(); const TopoDS_Shape& aTool = theTool->impl(); BRepAlgoAPI_Cut aCut(aShape, aTool); if (aCut.IsDone()) { - boost::shared_ptr aResult(new GeomAPI_Shape()); + std::shared_ptr aResult(new GeomAPI_Shape()); aResult->setImpl(new TopoDS_Shape(aCut.Shape())); return aResult; } - return boost::shared_ptr(); + return std::shared_ptr(); } -boost::shared_ptr GeomAlgoAPI_Boolean::makeFuse( - boost::shared_ptr theShape, - boost::shared_ptr theTool) +std::shared_ptr GeomAlgoAPI_Boolean::makeFuse( + std::shared_ptr theShape, + std::shared_ptr theTool) { const TopoDS_Shape& aShape = theShape->impl(); const TopoDS_Shape& aTool = theTool->impl(); BRepAlgoAPI_Fuse aFuse(aShape, aTool); if (aFuse.IsDone()) { - boost::shared_ptr aResult(new GeomAPI_Shape()); + std::shared_ptr aResult(new GeomAPI_Shape()); aResult->setImpl(new TopoDS_Shape(aFuse.Shape())); return aResult; } - return boost::shared_ptr(); + return std::shared_ptr(); } -boost::shared_ptr GeomAlgoAPI_Boolean::makeCommon( - boost::shared_ptr theShape, - boost::shared_ptr theTool) +std::shared_ptr GeomAlgoAPI_Boolean::makeCommon( + std::shared_ptr theShape, + std::shared_ptr theTool) { const TopoDS_Shape& aShape = theShape->impl(); const TopoDS_Shape& aTool = theTool->impl(); BRepAlgoAPI_Common aCommon(aShape, aTool); if (aCommon.IsDone()) { - boost::shared_ptr aResult(new GeomAPI_Shape()); + std::shared_ptr aResult(new GeomAPI_Shape()); aResult->setImpl(new TopoDS_Shape(aCommon.Shape())); return aResult; } - return boost::shared_ptr(); + return std::shared_ptr(); } //============================================================================ -GeomAlgoAPI_Boolean::GeomAlgoAPI_Boolean(boost::shared_ptr theObject, - boost::shared_ptr theTool, +GeomAlgoAPI_Boolean::GeomAlgoAPI_Boolean(std::shared_ptr theObject, + std::shared_ptr theTool, int theType) : myOperation(theType), myDone(false), myShape(new GeomAPI_Shape()) { @@ -75,8 +74,8 @@ GeomAlgoAPI_Boolean::GeomAlgoAPI_Boolean(boost::shared_ptr theObj //============================================================================ -void GeomAlgoAPI_Boolean::build(boost::shared_ptr theObject, - boost::shared_ptr theTool) +void GeomAlgoAPI_Boolean::build(std::shared_ptr theObject, + std::shared_ptr theTool) { const TopoDS_Shape& anObject = theObject->impl(); const TopoDS_Shape& aTool = theTool->impl(); @@ -91,6 +90,7 @@ void GeomAlgoAPI_Boolean::build(boost::shared_ptr theObject, myMkShape = new GeomAlgoAPI_MakeShape (mkFuse); aResult = mkFuse->Shape();//GeomAlgoAPI_DFLoader::refineResult(aFuse->Shape()); } + break; } case BOOL_CUT: { @@ -101,6 +101,7 @@ void GeomAlgoAPI_Boolean::build(boost::shared_ptr theObject, myMkShape = new GeomAlgoAPI_MakeShape (mkCut); aResult = mkCut->Shape(); } + break; } case BOOL_COMMON: { @@ -111,18 +112,19 @@ void GeomAlgoAPI_Boolean::build(boost::shared_ptr theObject, myMkShape = new GeomAlgoAPI_MakeShape (mkCom); aResult = mkCom->Shape(); } + break; } } if(myDone) { if(aResult.ShapeType() == TopAbs_COMPOUND) aResult = GeomAlgoAPI_DFLoader::refineResult(aResult); myShape->setImpl(new TopoDS_Shape(aResult)); - boost::shared_ptr aGeomResult(new GeomAPI_Shape()); + std::shared_ptr aGeomResult(new GeomAPI_Shape()); aGeomResult->setImpl(new TopoDS_Shape(aResult)); // fill data map to keep correct orientation of sub-shapes for (TopExp_Explorer Exp(aResult,TopAbs_FACE); Exp.More(); Exp.Next()) { - boost::shared_ptr aCurrentShape(new GeomAPI_Shape()); + std::shared_ptr aCurrentShape(new GeomAPI_Shape()); aCurrentShape->setImpl(new TopoDS_Shape(Exp.Current())); myMap.bind(aCurrentShape, aCurrentShape); } @@ -142,7 +144,7 @@ const bool GeomAlgoAPI_Boolean::isValid() const } //============================================================================ -const boost::shared_ptr& GeomAlgoAPI_Boolean::shape () const +const std::shared_ptr& GeomAlgoAPI_Boolean::shape () const { return myShape; }