From: vsv Date: Tue, 28 Aug 2018 11:27:23 +0000 (+0300) Subject: Fix for synchronization of selection in object Browser and multi-selector (Example... X-Git-Tag: SHAPER_V9_1_0RC1~13 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=de6235cd9c5f361e4b1b5294722689ec036717f8;p=modules%2Fshaper.git Fix for synchronization of selection in object Browser and multi-selector (Example: Partition of features) --- diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index c3ced396b..f5f693274 100755 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@ -222,7 +222,7 @@ bool ModuleBase_WidgetMultiSelector::storeValueCustom() std::string aType = anAttribute->attributeType(); if (aType == ModelAPI_AttributeSelectionList::typeId()) { AttributeSelectionListPtr aSelectionListAttr = myFeature->data()->selectionList(attributeID()); - + int aa = aSelectionListAttr->size(); std::string aMode = myTypeCtrl->textValue().toStdString(); if (myTypeCtrl->isVisible() && myIsFirst && (!myDefMode.empty())) aMode = myDefMode; @@ -787,7 +787,7 @@ void ModuleBase_WidgetMultiSelector::convertIndicesToViewerSelection(std::setvalue(i); - ResultPtr anObject = anAttr->context(); + ObjectPtr anObject = anAttr->contextObject(); if (anObject.get()) theValues.append(std::shared_ptr( new ModuleBase_ViewerPrs(anObject, anAttr->value(), NULL))); @@ -837,18 +837,23 @@ bool ModuleBase_WidgetMultiSelector::removeUnusedAttributeObjects std::string aType = anAttribute->attributeType(); std::set aShapes; std::set anIndicesToBeRemoved; + FeaturePtr aFeature; if (aType == ModelAPI_AttributeSelectionList::typeId()) { // iteration through data model to find not selected elements to remove them AttributeSelectionListPtr aSelectionListAttr = aData->selectionList(attributeID()); for (int i = 0; i < aSelectionListAttr->size(); i++) { AttributeSelectionPtr anAttr = aSelectionListAttr->value(i); - bool aFound = findInSelection( - anAttr->contextObject(), anAttr->value(), aGeomSelection, myWorkshop); - if (!aFound) - anIndicesToBeRemoved.insert(i); + //aFeature = std::dynamic_pointer_cast(anAttr->contextObject()); + //if (!aFeature.get()) { // Feature can not be found as geometry selection + bool aFound = findInSelection( + anAttr->contextObject(), anAttr->value(), aGeomSelection, myWorkshop); + if (!aFound) + anIndicesToBeRemoved.insert(i); +// } } isDone = anIndicesToBeRemoved.size() > 0; - aSelectionListAttr->remove(anIndicesToBeRemoved); + if (isDone) + aSelectionListAttr->remove(anIndicesToBeRemoved); } else if (aType == ModelAPI_AttributeRefList::typeId()) { AttributeRefListPtr aRefListAttr = aData->reflist(attributeID());