X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFeaturesPlugin%2FFeaturesPlugin_CompositeBoolean.cpp;h=de5a25f859071ac85ae8afbad5a5dee41da75238;hb=21a0c85b52bb93f94680e2342370764e6510e387;hp=507cd2da4f7479b556e98867c088088828bd098d;hpb=e0571928a6d6450b3f97020e296ec97f47289420;p=modules%2Fshaper.git diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp index 507cd2da4..de5a25f85 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp @@ -7,6 +7,7 @@ #include "FeaturesPlugin_CompositeBoolean.h" #include +#include #include #include @@ -36,7 +37,8 @@ void FeaturesPlugin_CompositeBoolean::executeCompositeBoolean() // Getting tools. ListOfShape aTools; - for(ListOfMakeShape::const_iterator anIt = aGenMakeShapes.cbegin(); anIt != aGenMakeShapes.cend(); ++anIt) { + for(ListOfMakeShape::const_iterator + anIt = aGenMakeShapes.cbegin(); anIt != aGenMakeShapes.cend(); ++anIt) { aTools.push_back((*anIt)->shape()); } @@ -132,13 +134,14 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean(const ListOfShape& theTools, } // For solids cut each object with all tools. - for(ListOfShape::const_iterator anIt = anObjects.cbegin(); anIt != anObjects.cend(); ++anIt) { + for(ListOfShape::const_iterator + anIt = anObjects.cbegin(); anIt != anObjects.cend(); ++anIt) { GeomShapePtr anObject = *anIt; ListOfShape aListWithObject; aListWithObject.push_back(anObject); std::shared_ptr aBoolAlgo(new GeomAlgoAPI_Boolean(aListWithObject, - theTools, - GeomAlgoAPI_Boolean::BOOL_CUT)); + theTools, + GeomAlgoAPI_Boolean::BOOL_CUT)); // Checking that the algorithm worked properly. if(!aBoolAlgo->isDone() || aBoolAlgo->shape()->isNull() || !aBoolAlgo->isValid()) { @@ -160,7 +163,8 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean(const ListOfShape& theTools, // Collecting solids from compsolids which will not be modified in boolean operation. ListOfShape aShapesToAdd; - for(GeomAPI_ShapeExplorer anExp(aCompSolid, GeomAPI_Shape::SOLID); anExp.more(); anExp.next()) { + for(GeomAPI_ShapeExplorer + anExp(aCompSolid, GeomAPI_Shape::SOLID); anExp.more(); anExp.next()) { GeomShapePtr aSolidInCompSolid = anExp.current(); ListOfShape::const_iterator aUsedShapesIt = aUsedShapes.cbegin(); for(; aUsedShapesIt != aUsedShapes.cend(); ++aUsedShapesIt) { @@ -174,8 +178,8 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean(const ListOfShape& theTools, } std::shared_ptr aBoolAlgo(new GeomAlgoAPI_Boolean(aUsedShapes, - theTools, - GeomAlgoAPI_Boolean::BOOL_CUT)); + theTools, + GeomAlgoAPI_Boolean::BOOL_CUT)); // Checking that the algorithm worked properly. if(!aBoolAlgo->isDone() || aBoolAlgo->shape()->isNull() || !aBoolAlgo->isValid()) { @@ -188,7 +192,8 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean(const ListOfShape& theTools, // Add result to not used solids from compsolid. aShapesToAdd.push_back(aBoolAlgo->shape()); - std::shared_ptr aFillerAlgo(new GeomAlgoAPI_PaveFiller(aShapesToAdd, true)); + std::shared_ptr aFillerAlgo( + new GeomAlgoAPI_PaveFiller(aShapesToAdd, true)); if(!aFillerAlgo->isDone() || aFillerAlgo->shape()->isNull() || !aFillerAlgo->isValid()) { myFeature->setError("Error: PaveFiller algorithm failed."); return false; @@ -220,7 +225,8 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean(const ListOfShape& theTools, } } - if((anObjects.size() + aTools.size() + aCompSolidsObjects.size() + anEdgesAndFaces.size()) < 2) { + if((anObjects.size() + aTools.size() + + aCompSolidsObjects.size() + anEdgesAndFaces.size()) < 2) { myFeature->setError("Error: Not enough objects for boolean operation."); return false; } @@ -230,7 +236,8 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean(const ListOfShape& theTools, aSolidsToFuse.insert(aSolidsToFuse.end(), anObjects.begin(), anObjects.end()); aSolidsToFuse.insert(aSolidsToFuse.end(), aTools.begin(), aTools.end()); - // Collecting solids from compsolids which will not be modified in boolean operation and will be added to result. + // Collecting solids from compsolids which will not be + // modified in boolean operation and will be added to result. ListOfShape aShapesToAdd; for(std::map::iterator anIt = aCompSolidsObjects.begin(); anIt != aCompSolidsObjects.end(); anIt++) { @@ -239,7 +246,8 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean(const ListOfShape& theTools, aSolidsToFuse.insert(aSolidsToFuse.end(), aUsedShapes.begin(), aUsedShapes.end()); // Collect solids from compsolid which will not be modified in boolean operation. - for(GeomAPI_ShapeExplorer anExp(aCompSolid, GeomAPI_Shape::SOLID); anExp.more(); anExp.next()) { + for(GeomAPI_ShapeExplorer + anExp(aCompSolid, GeomAPI_Shape::SOLID); anExp.more(); anExp.next()) { GeomShapePtr aSolidInCompSolid = anExp.current(); ListOfShape::iterator anIt = aUsedShapes.begin(); for(; anIt != aUsedShapes.end(); anIt++) { @@ -262,8 +270,8 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean(const ListOfShape& theTools, std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeList()); if(!anEdgesAndFaces.empty() && !aCutTools.empty()) { std::shared_ptr aCutAlgo(new GeomAlgoAPI_Boolean(anEdgesAndFaces, - aCutTools, - GeomAlgoAPI_Boolean::BOOL_CUT)); + aCutTools, + GeomAlgoAPI_Boolean::BOOL_CUT)); if(aCutAlgo->isDone() && !aCutAlgo->shape()->isNull() && aCutAlgo->isValid()) { anEdgesAndFaces.clear(); anEdgesAndFaces.push_back(aCutAlgo->shape()); @@ -274,8 +282,8 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean(const ListOfShape& theTools, // If we have compsolids then cut with not used solids all others. if(!aShapesToAdd.empty()) { std::shared_ptr aCutAlgo(new GeomAlgoAPI_Boolean(aSolidsToFuse, - aShapesToAdd, - GeomAlgoAPI_Boolean::BOOL_CUT)); + aShapesToAdd, + GeomAlgoAPI_Boolean::BOOL_CUT)); if(aCutAlgo->isDone() && GeomAlgoAPI_ShapeTools::volume(aCutAlgo->shape()) > 1.e-27) { aSolidsToFuse.clear(); aSolidsToFuse.push_back(aCutAlgo->shape()); @@ -294,8 +302,8 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean(const ListOfShape& theTools, aTools = aSolidsToFuse; std::shared_ptr aFuseAlgo(new GeomAlgoAPI_Boolean(anObjects, - aTools, - GeomAlgoAPI_Boolean::BOOL_FUSE)); + aTools, + GeomAlgoAPI_Boolean::BOOL_FUSE)); // Checking that the algorithm worked properly. if(!aFuseAlgo->isDone() || aFuseAlgo->shape()->isNull() || !aFuseAlgo->isValid()) { @@ -314,7 +322,8 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean(const ListOfShape& theTools, aShapesToAdd.push_back(aFusedShape); } - std::shared_ptr aFillerAlgo(new GeomAlgoAPI_PaveFiller(aShapesToAdd, true)); + std::shared_ptr aFillerAlgo( + new GeomAlgoAPI_PaveFiller(aShapesToAdd, true)); if(!aFillerAlgo->isDone() || aFillerAlgo->shape()->isNull() || !aFillerAlgo->isValid()) { myFeature->setError("Error: PaveFiller algorithm failed."); return false; @@ -364,8 +373,9 @@ void FeaturesPlugin_CompositeBoolean::storeModificationHistory(ResultBodyPtr the aTag = aModTag; aName = aModName; } - theResultBody->loadAndOrientModifiedShapes(theMakeShape.get(), *anIt, (*anIt)->shapeType() == GeomAPI_Shape::EDGE ? - GeomAPI_Shape::EDGE : GeomAPI_Shape::FACE, aTag, aName, *aMap.get()); + theResultBody->loadAndOrientModifiedShapes(theMakeShape.get(), *anIt, + (*anIt)->shapeType() == GeomAPI_Shape::EDGE ? + GeomAPI_Shape::EDGE : GeomAPI_Shape::FACE, aTag, aName, *aMap.get()); theResultBody->loadDeletedShapes(theMakeShape.get(), *anIt, GeomAPI_Shape::FACE, aDelTag); } }