X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFeaturesPlugin%2FFeaturesPlugin_BooleanCommon.cpp;h=1afe60e8bf1c214270da3ba81fc7f26905463ca3;hb=c6071088b2f55168f5706ce97802095af868b5e3;hp=af2d556f18afdd568e4375bac1c22b7cf6850ffe;hpb=05e6e5cea2a02ae15a2d254a355b08fad114a970;p=modules%2Fshaper.git diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.cpp b/src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.cpp index af2d556f1..1afe60e8b 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.cpp @@ -20,9 +20,12 @@ #include "FeaturesPlugin_BooleanCommon.h" #include +#include #include #include +#include #include +#include #include #include @@ -35,7 +38,6 @@ #include #include - //================================================================================================== FeaturesPlugin_BooleanCommon::FeaturesPlugin_BooleanCommon() : FeaturesPlugin_Boolean(FeaturesPlugin_Boolean::BOOL_COMMON) @@ -49,6 +51,8 @@ void FeaturesPlugin_BooleanCommon::initAttributes() data()->addAttribute(OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); data()->addAttribute(TOOL_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); + + initVersion(THE_VERSION_1, selectionList(OBJECT_LIST_ID()), selectionList(TOOL_LIST_ID())); } //================================================================================================== @@ -82,7 +86,12 @@ void FeaturesPlugin_BooleanCommon::execute() return; } + // version of COMMON feature + int aCommonVersion = version(); + int aResultIndex = 0; + GeomShapePtr aResultCompound; + std::string anError; std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeList()); std::vector aResultBaseAlgoList; @@ -106,6 +115,12 @@ void FeaturesPlugin_BooleanCommon::execute() aMakeShapeList->appendAlgo(aCommonAlgo); } + if (aCommonVersion == THE_VERSION_1) { + // merge hierarchies of compounds containing objects and tools + // and append the result of the FUSE operation + aShape = keepUnusedSubsOfCompound(aShape, anObjects, aTools, aMakeShapeList); + } + GeomAPI_ShapeIterator aShapeIt(aShape); if (aShapeIt.more() || aShape->shapeType() == GeomAPI_Shape::VERTEX) { std::shared_ptr aResultBody = @@ -132,6 +147,12 @@ void FeaturesPlugin_BooleanCommon::execute() aResultShapesList.push_back(aShape); } } else { + if (aCommonVersion == THE_VERSION_1) { + // merge hierarchies of compounds containing objects and tools + aResultCompound = + keepUnusedSubsOfCompound(GeomShapePtr(), anObjects, aTools, aMakeShapeList); + } + bool isOk = true; for (ObjectHierarchy::Iterator anObjectsIt = anObjects.Begin(); anObjectsIt != anObjects.End() && isOk; @@ -146,29 +167,36 @@ void FeaturesPlugin_BooleanCommon::execute() // Compound handling isOk = processCompound(GeomAlgoAPI_Tools::BOOL_COMMON, anObjects, aParent, aTools.Objects(), - aResultIndex, aResultBaseAlgoList, aResultShapesList); + aResultIndex, aResultBaseAlgoList, aResultShapesList, + aResultCompound); } else if (aShapeType == GeomAPI_Shape::COMPSOLID) { // Compsolid handling isOk = processCompsolid(GeomAlgoAPI_Tools::BOOL_COMMON, anObjects, aParent, aTools.Objects(), ListOfShape(), - aResultIndex, aResultBaseAlgoList, aResultShapesList); + aResultIndex, aResultBaseAlgoList, aResultShapesList, + aResultCompound); } } else { // process object as is isOk = processObject(GeomAlgoAPI_Tools::BOOL_COMMON, anObject, aTools.Objects(), aPlanes, - aResultIndex, aResultBaseAlgoList, aResultShapesList); + aResultIndex, aResultBaseAlgoList, aResultShapesList, + aResultCompound); } } + + storeResult(anObjects.Objects(), aTools.Objects(), aResultCompound, aResultIndex, + aMakeShapeList, aResultBaseAlgoList); } // Store deleted shapes after all results has been proceeded. This is to avoid issue when in one // result shape has been deleted, but in another it was modified or stayed. - GeomShapePtr aResultShapesCompound = GeomAlgoAPI_CompoundBuilder::compound(aResultShapesList); + if (!aResultCompound) + aResultCompound = GeomAlgoAPI_CompoundBuilder::compound(aResultShapesList); FeaturesPlugin_Tools::loadDeletedShapes(aResultBaseAlgoList, aTools.Objects(), - aResultShapesCompound); + aResultCompound); // remove the rest results if there were produced in the previous pass removeResults(aResultIndex);