-//============================================================================
-GeomAlgoAPI_Boolean::GeomAlgoAPI_Boolean(boost::shared_ptr<GeomAPI_Shape> theObject,
- boost::shared_ptr<GeomAPI_Shape> theTool,
- int theType)
-: myOperation(theType), myDone(false), myShape(new GeomAPI_Shape())
-{
- build(theObject, theTool);
-}
-
-
-//============================================================================
-void GeomAlgoAPI_Boolean::build(boost::shared_ptr<GeomAPI_Shape> theObject,
- boost::shared_ptr<GeomAPI_Shape> theTool)
-{
- const TopoDS_Shape& anObject = theObject->impl<TopoDS_Shape>();
- const TopoDS_Shape& aTool = theTool->impl<TopoDS_Shape>();
- TopoDS_Shape aResult;
- switch (myOperation) {
- case BOOL_FUSE:
- {
- BRepAlgoAPI_Fuse* mkFuse = new BRepAlgoAPI_Fuse(anObject, aTool);
- if (mkFuse && mkFuse->IsDone()) {
- setImpl(mkFuse);
- myDone = mkFuse->IsDone() == Standard_True;
- myMkShape = new GeomAlgoAPI_MakeShape (mkFuse);
- aResult = mkFuse->Shape();//GeomAlgoAPI_DFLoader::refineResult(aFuse->Shape());
- }
- break;
- }
- case BOOL_CUT:
- {
- BRepAlgoAPI_Cut* mkCut = new BRepAlgoAPI_Cut(anObject, aTool);
- if (mkCut && mkCut->IsDone()) {
- setImpl(mkCut);
- myDone = mkCut->IsDone() == Standard_True;
- myMkShape = new GeomAlgoAPI_MakeShape (mkCut);
- aResult = mkCut->Shape();
- }
- break;
- }
- case BOOL_COMMON:
- {
- BRepAlgoAPI_Common* mkCom = new BRepAlgoAPI_Common(anObject, aTool);
- if (mkCom && mkCom->IsDone()) {
- setImpl(mkCom);
- myDone = mkCom->IsDone() == Standard_True;
- myMkShape = new GeomAlgoAPI_MakeShape (mkCom);
- aResult = mkCom->Shape();
- }
- break;
- }