if (aType == ModelAPI_AttributeSelectionList::typeId()) {
AttributeSelectionListPtr aSelectionListAttr = aData->selectionList(attributeID());
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theSelectedObject);
- //if (!aSelectionListAttr->isInList(aResult, theShape, myIsInValidate))
+ if (!aSelectionListAttr->isInList(aResult, theShape, myIsInValidate))
aSelectionListAttr->append(aResult, theShape, myIsInValidate);
}
else if (aType == ModelAPI_AttributeRefList::typeId()) {
AttributeRefListPtr aRefListAttr = aData->reflist(attributeID());
- //if (!aRefListAttr->isInList(theSelectedObject))
+ if (!aRefListAttr->isInList(theSelectedObject))
aRefListAttr->append(theSelectedObject);
}
else if (aType == ModelAPI_AttributeRefAttrList::typeId()) {
AttributePtr anAttribute = myWorkshop->module()->findAttribute(theSelectedObject, theShape);
if (anAttribute.get()) {
- //if (!aRefAttrListAttr->isInList(anAttribute))
+ if (!aRefAttrListAttr->isInList(anAttribute))
aRefAttrListAttr->append(anAttribute);
}
else {
- //if (!aRefAttrListAttr->isInList(theSelectedObject))
+ if (!aRefAttrListAttr->isInList(theSelectedObject))
aRefAttrListAttr->append(theSelectedObject);
}
}
{
QList<ModuleBase_ViewerPrs> aSkippedValues;
+ /// remove unused objects from the model attribute.
+ /// It should be performed before new attributes append.
+ removeUnusedAttributeObjects(theValues);
+
QList<ModuleBase_ViewerPrs>::const_iterator anIt = theValues.begin(), aLast = theValues.end();
bool isDone = false;
for (; anIt != aLast; anIt++) {
//emit valuesChanged();
//}
- /// remove unused objects from the model attribute
- removeUnusedAttributeObjects(theValues);
-
theValues.clear();
if (!aSkippedValues.empty())
theValues.append(aSkippedValues);
aShapeTypeName = myTypeCombo->itemText(idx);
TopAbs_ShapeEnum aRefType = ModuleBase_Tools::shapeType(aShapeTypeName);
if(aRefType == theShapeType && idx != myTypeCombo->currentIndex()) {
- activateSelectionAndFilters(false);
+ bool aWasActivated = activateSelectionAndFilters(false);
bool isBlocked = myTypeCombo->blockSignals(true);
myTypeCombo->setCurrentIndex(idx);
myTypeCombo->blockSignals(isBlocked);
-
- activateSelectionAndFilters(true);
+ if (aWasActivated)
+ activateSelectionAndFilters(true);
break;
}
}
(QList<ModuleBase_ViewerPrs>& theValues)
{
std::map<ObjectPtr, std::set<GeomShapePtr> > aGeomSelection = convertSelection(theValues);
-
DataPtr aData = myFeature->data();
AttributePtr anAttribute = aData->attribute(attributeID());
std::string aType = anAttribute->attributeType();
aRefListAttr->remove(anIndicesToBeRemoved);
}
else if (aType == ModelAPI_AttributeRefAttrList::typeId()) {
- /*AttributeRefAttrListPtr aRefAttrListAttr = aData->refattrlist(attributeID());
+ std::set<AttributePtr> anAttributes;
+ QList<ModuleBase_ViewerPrs>::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<GeomShapePtr> aShapes = aGeomSelection[anAttrObject];
- std::set<GeomShapePtr>::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);
if (!aFound)
anIndicesToBeRemoved.insert(i);
}
- aRefAttrListAttr->remove(anIndicesToBeRemoved);*/
+ aRefAttrListAttr->remove(anIndicesToBeRemoved);
}
}