- myExtraCoincidence.erase(anExtraIt);
- }
-
- bool isFullyRemoved = myStorage->removeConstraint(mySlvsConstraints[aPos+1]);
- mySlvsConstraints.erase(mySlvsConstraints.begin() + (1+aPos));
- if (aPos < 0 && !myExtraCoincidence.empty()) {
- anExtraIt = myExtraCoincidence.begin();
- // Remove invalid constraints
- while (anExtraIt != myExtraCoincidence.end()) {
- if (!anExtraIt->second->data() || !anExtraIt->second->data()->isValid()) {
- std::map<Slvs_hConstraint, ConstraintPtr>::iterator aTempIt = anExtraIt++;
- if (aTempIt->first != SLVS_E_UNKNOWN) {
- myStorage->removeConstraint(aTempIt->first);
- std::vector<Slvs_hConstraint>::iterator anIt = mySlvsConstraints.begin();
- for (; anIt != mySlvsConstraints.end(); anIt++)
- if (*anIt == aTempIt->first) {
- mySlvsConstraints.erase(anIt);
- break;
- }
- }
- myExtraCoincidence.erase(aTempIt);
- continue;
- }
- anExtraIt++;
- }
- // Find first non-extra conststraint
- while (anExtraIt != myExtraCoincidence.end() && anExtraIt->first == SLVS_E_UNKNOWN)
- anExtraIt++;
- if (anExtraIt != myExtraCoincidence.end()) {
- // Need to specify another base coincidence constraint
- myBaseConstraint = anExtraIt->second;
- myExtraCoincidence.erase(anExtraIt);
- std::vector<Slvs_hConstraint>::iterator aCIter = mySlvsConstraints.begin();
- Slvs_Constraint aBase = myStorage->getConstraint(*aCIter);
- for (++aCIter; aCIter != mySlvsConstraints.end(); aCIter++) {
- Slvs_Constraint aConstr = myStorage->getConstraint(*aCIter);
- aConstr.ptA = aBase.ptA;
- myStorage->updateConstraint(aConstr);
- }
- }
- }
- // Clear removed attributes
- std::set<Slvs_hParam> aParamRemoved;
- std::set<Slvs_hEntity> anEntRemoved;
- std::set<Slvs_hConstraint> aConstrRemoved;
- myStorage->getRemoved(aParamRemoved, anEntRemoved, aConstrRemoved);
- std::map<AttributePtr, Slvs_hEntity>::iterator anAttrIter = myAttributeMap.begin();
- while (anAttrIter != myAttributeMap.end()) {
- if (anEntRemoved.find(anAttrIter->second) != anEntRemoved.end()) {
- std::map<AttributePtr, Slvs_hEntity>::iterator aTempIt = anAttrIter++;
- myAttributeMap.erase(aTempIt);
- continue;
- }
- anAttrIter++;