+
+ std::map<ConstraintPtr, std::list<ConstraintWrapperPtr> >::const_iterator aCIt = myConstraintMap.begin();
+ std::list<ConstraintWrapperPtr>::const_iterator aCWIt;
+ for (; aCIt != myConstraintMap.end(); ++aCIt) {
+ if (aCIt->second.empty())
+ continue;
+ aCWIt = aCIt->second.begin();
+ if ((*aCWIt)->type() != CONSTRAINT_FIXED)
+ continue;
+ for (; aCWIt != aCIt->second.end(); ++aCIt)
+ if ((theEntity->baseAttribute() && (*aCWIt)->isUsed(theEntity->baseAttribute())) ||
+ (theEntity->baseFeature() && (*aCWIt)->isUsed(theEntity->baseFeature())))
+ return true;
+ }
+
+ return false;
+}
+
+void SketchSolver_Storage::removeInvalidEntities()
+{
+ // Remove invalid constraints
+ std::list<ConstraintPtr> anInvalidConstraints;
+ std::map<ConstraintPtr, std::list<ConstraintWrapperPtr> >::const_iterator
+ aCIter = myConstraintMap.begin();
+ for (; aCIter != myConstraintMap.end(); ++aCIter)
+ if (!aCIter->first->data() || !aCIter->first->data()->isValid())
+ anInvalidConstraints.push_back(aCIter->first);
+ std::list<ConstraintPtr>::const_iterator anInvCIt = anInvalidConstraints.begin();
+ for (; anInvCIt != anInvalidConstraints.end(); ++anInvCIt)
+ removeConstraint(*anInvCIt);
+ // Remove invalid features
+ std::list<FeaturePtr> anInvalidFeatures;
+ std::map<FeaturePtr, EntityWrapperPtr>::const_iterator aFIter = myFeatureMap.begin();
+ for (; aFIter != myFeatureMap.end(); aFIter++)
+ if (!aFIter->first->data() || !aFIter->first->data()->isValid())
+ anInvalidFeatures.push_back(aFIter->first);
+ std::list<FeaturePtr>::const_iterator anInvFIt = anInvalidFeatures.begin();
+ for (; anInvFIt != anInvalidFeatures.end(); ++anInvFIt)
+ removeEntity(*anInvFIt);