From: nds Date: Fri, 26 Feb 2016 15:32:54 +0000 (+0300) Subject: Issue #1330 correction for attribute ref attr list X-Git-Tag: V_2.2.0~55 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=66cd22f8298c82f88249a02cd518dcb2c8dd3a71;p=modules%2Fshaper.git Issue #1330 correction for attribute ref attr list --- diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index 92caad3a6..1259441ca 100755 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@ -676,7 +676,6 @@ void ModuleBase_WidgetMultiSelector::removeUnusedAttributeObjects (QList& theValues) { std::map > aGeomSelection = convertSelection(theValues); - DataPtr aData = myFeature->data(); AttributePtr anAttribute = aData->attribute(attributeID()); std::string aType = anAttribute->attributeType(); @@ -706,23 +705,24 @@ void ModuleBase_WidgetMultiSelector::removeUnusedAttributeObjects aRefListAttr->remove(anIndicesToBeRemoved); } else if (aType == ModelAPI_AttributeRefAttrList::typeId()) { - /*AttributeRefAttrListPtr aRefAttrListAttr = aData->refattrlist(attributeID()); + std::set anAttributes; + QList::const_iterator anIt = theValues.begin(), aLast = theValues.end(); + ObjectPtr anObject; + GeomShapePtr aShape; + for (; anIt != aLast; anIt++) { + ModuleBase_ViewerPrs aPrs = *anIt; + getGeomSelection(aPrs, anObject, aShape); + AttributePtr anAttr = myWorkshop->module()->findAttribute(anObject, aShape); + if (anAttr.get() && anAttributes.find(anAttr) == anAttributes.end()) + anAttributes.insert(anAttr); + } + + AttributeRefAttrListPtr aRefAttrListAttr = aData->refattrlist(attributeID()); for (int i = 0; i < aRefAttrListAttr->size(); i++) { bool aFound = false; if (aRefAttrListAttr->isAttribute(i)) { AttributePtr anAttribute = aRefAttrListAttr->attribute(i); - ObjectPtr anAttrObject = anAttribute->owner(); - if (aGeomSelection.find(anAttrObject) != aGeomSelection.end()) { - std::set aShapes = aGeomSelection[anAttrObject]; - std::set::const_iterator anIt = aShapes.begin(), aLast = aShapes.end(); - for (; anIt != aLast && !aFound; anIt++) { - GeomShapePtr aCShape = *anIt; - if (aCShape.get()) { - AttributePtr aCAttr = myWorkshop->module()->findAttribute(anAttrObject, aCShape); - aFound = aCAttr == anAttribute; - } - } - } + aFound = anAttributes.find(anAttribute) != anAttributes.end(); } else { aFound = findInSelection(aRefAttrListAttr->object(i), GeomShapePtr(), aGeomSelection); @@ -730,7 +730,7 @@ void ModuleBase_WidgetMultiSelector::removeUnusedAttributeObjects if (!aFound) anIndicesToBeRemoved.insert(i); } - aRefAttrListAttr->remove(anIndicesToBeRemoved);*/ + aRefAttrListAttr->remove(anIndicesToBeRemoved); } }