X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFeaturesPlugin%2FFeaturesPlugin_BooleanFill.cpp;h=7d8d3f471603b87be7ad13ff4f921408f43bd2ba;hb=ea593bc59e7e9461f6c4e2afd3f24d621edb1011;hp=a907823addc16bb4173a6e1982dfd4722f82f9e4;hpb=1ca6bc647dcecfbd22beb5c8991f06545bf7614e;p=modules%2Fshaper.git diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanFill.cpp b/src/FeaturesPlugin/FeaturesPlugin_BooleanFill.cpp index a907823ad..7d8d3f471 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanFill.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanFill.cpp @@ -40,12 +40,21 @@ #include #include +static const int THE_SPLIT_VERSION_1 = 20190506; + //================================================================================================= FeaturesPlugin_BooleanFill::FeaturesPlugin_BooleanFill() : FeaturesPlugin_Boolean(FeaturesPlugin_Boolean::BOOL_FILL) { } +//================================================================================================= +void FeaturesPlugin_BooleanFill::initAttributes() +{ + FeaturesPlugin_Boolean::initAttributes(); + initVersion(THE_SPLIT_VERSION_1, selectionList(OBJECT_LIST_ID()), selectionList(TOOL_LIST_ID())); +} + //================================================================================================= void FeaturesPlugin_BooleanFill::execute() { @@ -71,9 +80,21 @@ void FeaturesPlugin_BooleanFill::execute() return; } + // version of Split feature + int aSplitVersion = version(); + std::vector aResultBaseAlgoList; ListOfShape aResultShapesList; + std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeList()); + + GeomShapePtr aResultCompound; + if (aSplitVersion == THE_SPLIT_VERSION_1) { + // merge hierarchies of compounds containing objects and tools + aResultCompound = + keepUnusedSubsOfCompound(GeomShapePtr(), anObjects, aTools, aMakeShapeList); + } + // For solids cut each object with all tools. bool isOk = true; for (ObjectHierarchy::Iterator anObjectsIt = anObjects.Begin(); @@ -88,21 +109,27 @@ void FeaturesPlugin_BooleanFill::execute() // compsolid handling isOk = processCompsolid(GeomAlgoAPI_Tools::BOOL_PARTITION, anObjects, aParent, aTools.Objects(), aPlanes, - aResultIndex, aResultBaseAlgoList, aResultShapesList); + aResultIndex, aResultBaseAlgoList, aResultShapesList, + aResultCompound); } else { // process object as is isOk = processObject(GeomAlgoAPI_Tools::BOOL_PARTITION, 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);