std::map<FeaturePtr, Slvs_hEntity>::iterator aFeatIt = myFeatureMap.begin();
for (; aFeatIt != myFeatureMap.end(); aFeatIt++)
myStorage->removeEntity(aFeatIt->second);
+ myStorage->removeUnusedEntities();
+
+ std::map<FeaturePtr, Slvs_hEntity> aFeatureMapCopy = myFeatureMap;
if (isFullyRemoved) {
myFeatureMap.clear();
myValueMap.clear();
} else
cleanRemovedEntities();
+
+ // Restore initial features
+ std::map<FeaturePtr, Slvs_hEntity>::iterator aFIter = aFeatureMapCopy.begin();
+ for (; aFIter != aFeatureMapCopy.end(); ++aFIter)
+ {
+ if (myFeatureMap.find(aFIter->first) != myFeatureMap.end())
+ continue; // the feature was not removed
+ Slvs_hEntity anEntity = myGroup->getFeatureId(aFIter->first);
+ if (anEntity != SLVS_E_UNKNOWN)
+ myFeatureMap[aFIter->first] = anEntity;
+ }
+
return true;
}
if (squareDistance(myStorage, aLine.point[0], aLine.point[1]) < tolerance * tolerance) {
myStorage->removeConstraint(aConstraint.h);
isFirstRemoved = aConstr == mySlvsConstraints.begin();
- std::vector<Slvs_hConstraint>::iterator aTmpIter = aConstr--;
+ std::vector<Slvs_hConstraint>::iterator aTmpIter = aConstr;
+ if (!isFirstRemoved)
+ --aConstr;
mySlvsConstraints.erase(aTmpIter);
}
// Store the lines into the map