X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_ResultGroup.cpp;fp=src%2FModel%2FModel_ResultGroup.cpp;h=c40c90738ed8feac8e7c1d91c34d6a1476fb4d77;hb=2cb970b90fe02f7254a376a3c35fd6e2d739284f;hp=87d1620f6b3644f3525ac35273734dda34f595b8;hpb=5c5f84231a62cf183b4bdbcc3030003a0ac6bdc5;p=modules%2Fshaper.git diff --git a/src/Model/Model_ResultGroup.cpp b/src/Model/Model_ResultGroup.cpp index 87d1620f6..c40c90738 100644 --- a/src/Model/Model_ResultGroup.cpp +++ b/src/Model/Model_ResultGroup.cpp @@ -22,6 +22,7 @@ #include #include +#include #include @@ -68,11 +69,33 @@ std::shared_ptr Model_ResultGroup::shape() if (!aResult && myOwnerData) { AttributeSelectionListPtr aList = myOwnerData->selectionList("group_list"); if (aList) { + GeomAPI_DataMapOfShapeShape aShapesMap; // to avoid shapes duplication std::list > aSubs; for(int a = aList->size() - 1; a >= 0; a--) { std::shared_ptr aSelection = aList->value(a)->value(); - if (aSelection && !aSelection->isNull()) { - aSubs.push_back(aSelection); + if (aList->isWholeResultAllowed()) { // whole result selection, explode to sub-shapes + if (!aSelection.get() || aSelection->isNull()) { + ResultPtr aContext = aList->value(a)->context(); + if (aContext) + aSelection = aContext->shape(); + } + if (aSelection && !aSelection->isNull()) { + GeomAPI_Shape::ShapeType aType = GeomAPI_Shape::shapeTypeByStr(aList->selectionType()); + if (aType == aSelection->shapeType()) { + if (aShapesMap.bind(aSelection, aSelection)) + aSubs.push_back(aSelection); + } else { + for(GeomAPI_ShapeExplorer anExp(aSelection, aType); anExp.more(); anExp.next()) { + if (aShapesMap.bind(anExp.current(), anExp.current())) + aSubs.push_back(anExp.current()); + } + } + } + } else { // take selection as it is + if (aSelection && !aSelection->isNull()) { + if (aShapesMap.bind(aSelection, aSelection)) + aSubs.push_back(aSelection); + } } } if (!aSubs.empty()) {