template <class ENT_TYPE>
static bool isUsed(ConstraintWrapperPtr theConstraint, ENT_TYPE theEntity)
{
+ if (!theConstraint || !theEntity)
+ return false;
std::list<EntityWrapperPtr>::const_iterator anEntIt = theConstraint->entities().begin();
for (; anEntIt != theConstraint->entities().end(); ++anEntIt)
if ((*anEntIt)->isBase(theEntity))
static bool isUsed(EntityWrapperPtr theFeature, AttributePtr theSubEntity)
{
+ if (!theFeature || !theSubEntity)
+ return false;
std::list<EntityWrapperPtr>::const_iterator aSubIt = theFeature->subEntities().begin();
for (; aSubIt != theFeature->subEntities().end(); ++aSubIt)
if ((*aSubIt)->isBase(theSubEntity))
myFeatureMap.erase(aFound);
// Check if the feature is not used by constraints, remove it
- if (!isUsed(theFeature) && remove(anEntity))
+ if (!anEntity || (!isUsed(theFeature) && remove(anEntity)))
return true;
// feature is not removed, revert operation
myAttributeMap.erase(aFound);
// Check if the attribute is not used by constraints and features, remove it
- if (!isUsed(theAttribute) && remove(anEntity))
+ if (!anEntity || (!isUsed(theAttribute) && remove(anEntity)))
return true;
// attribute is not removed, revert operation
aConstr.entityC == aSlvsCIt->entityC && aConstr.entityD == aSlvsCIt->entityD) {
Slvs_hConstraint anIDToRemove = aConstr.h;
aConstr = *aSlvsCIt;
+ int aShift = aSlvsCIt - myConstraints.begin();
removeConstraint(anIDToRemove);
+ aSlvsCIt = myConstraints.begin() + aShift - 1;
+ for (; aSlvsCIt != myConstraints.end(); ++aSlvsCIt)
+ if (aSlvsCIt->h == aConstr.h)
+ break;
break;
}
std::set<EntityWrapperPtr> anUpdFeatures;
std::map<FeaturePtr, EntityWrapperPtr>::iterator aFIt = myFeatureMap.begin();
for (; aFIt != myFeatureMap.end(); ++aFIt) {
+ if (!aFIt->second)
+ continue; // avoid not completed arcs
for (aNotCIt = aNotCoinc.begin(); aNotCIt != aNotCoinc.end(); ++aNotCIt) {
if (!aNotCIt->second || !aFIt->second->isUsed(aNotCIt->first->baseAttribute()))
continue;