cleanErrorMsg();
// Move fixed entities back to the current group
FeaturePtr aFeature = myBaseFeature;
- if (myBaseConstraint && myFixedAttribute && myFixedAttribute->isObject())
- aFeature = ModelAPI_Feature::feature(myFixedAttribute->object());
+ if (myBaseConstraint && myFixedAttribute) {
+ if (myFixedAttribute->isObject())
+ aFeature = ModelAPI_Feature::feature(myFixedAttribute->object());
+ else
+ myStorage->update(AttributePtr(myFixedAttribute), myGroupID);
+ }
if (aFeature)
myStorage->update(aFeature, myGroupID);
- else if (myFixedAttribute)
- myStorage->update(AttributePtr(myFixedAttribute), myGroupID);
// Remove constraint or base feature
if (myBaseConstraint) {
EntityWrapperPtr anEntity = aFound->second;
myFeatureMap.erase(aFound);
- // Check the feature is not used by constraints
- if (isUsed(theFeature))
- return false; // the feature is used, don't remove it
-
- // Remove feature
- if (remove(anEntity))
+ // Check if the feature is not used by constraints, remove it
+ if (!isUsed(theFeature) && remove(anEntity))
return true;
+
// feature is not removed, revert operation
myFeatureMap[theFeature] = anEntity;
update(anEntity);
EntityWrapperPtr anEntity = aFound->second;
myAttributeMap.erase(aFound);
- // Check the attribute is not used by constraints
- if (isUsed(theAttribute))
- return false; // the attribute is used, don't remove it
- // Check the attribute is not used by other features
- std::map<FeaturePtr, EntityWrapperPtr>::const_iterator aFIt = myFeatureMap.begin();
- for (; aFIt != myFeatureMap.end(); ++aFIt)
- if (::isUsed(aFIt->second, theAttribute)) // the attribute is used, don't remove it
- return false;
-
- // Remove attribute
- if (remove(anEntity))
+ // Check if the attribute is not used by constraints and features, remove it
+ if (!isUsed(theAttribute) && remove(anEntity))
return true;
+
// attribute is not removed, revert operation
myAttributeMap[theAttribute] = anEntity;
update(anEntity);
std::set<EntityWrapperPtr> aSlaves = aPtPtIt->second;
EntityWrapperPtr aNewMaster = *aSlaves.begin();
aSlaves.erase(aSlaves.begin());
- myCoincidentPoints[aNewMaster] = aSlaves;
myCoincidentPoints.erase(aPtPtIt);
+ myCoincidentPoints[aNewMaster] = aSlaves;
aPtPtIt = myCoincidentPoints.find(aNewMaster);
} else
aPtPtIt->second.erase(aNotCIt->first);