void PlaneGCSSolver_Solver::clear()
{
- std::set<GCS::Constraint*>::const_iterator anIt = myConstraints.begin();
- for (; anIt != myConstraints.end(); ++anIt)
- myEquationSystem.removeConstraint(*anIt);
+ myEquationSystem.clear();
myConstraints.clear();
myParameters.clear();
}
if (aResult == GCS::Success) {
myEquationSystem.applySolution();
aStatus = STATUS_OK;
- } else
+ } else {
+ undo();
aStatus = STATUS_FAILED;
+ }
return aStatus;
}
bool PlaneGCSSolver_Storage::remove(EntityWrapperPtr theEntity)
{
bool isFullyRemoved = SketchSolver_Storage::remove(theEntity);
+ if (theEntity->type() == ENTITY_ARC) {
+ // remove arc additional constraints
+ std::map<EntityWrapperPtr, std::vector<GCSConstraintPtr> >::iterator
+ aFound = myArcConstraintMap.find(theEntity);
+ if (aFound != myArcConstraintMap.end()) {
+ myRemovedConstraints.insert(myRemovedConstraints.end(),
+ aFound->second.begin(), aFound->second.end());
+ myArcConstraintMap.erase(aFound);
+ }
+ }
if (isFullyRemoved && theEntity->id() == myEntityLastID)
--myEntityLastID;
return isFullyRemoved;
if (anIt != myParameters.end()) {
myParameters.erase(anIt);
setNeedToResolve(true);
+ aParam->setProcessed(false);
}
else {
for (anIt = myConst.begin(); anIt != myConst.end(); ++anIt)
if (anIt != myConst.end()) {
myConst.erase(anIt);
setNeedToResolve(true);
+ aParam->setProcessed(false);
}
}
}
- aParam->setProcessed(false);
return true;
}
std::dynamic_pointer_cast<PlaneGCSSolver_Solver>(theSolver);
if (!aSolver)
return;
+ aSolver->clear();
if (myExistArc)
processArcs();
FeaturePtr aBaseFeature = (*anEntIt)->baseFeature();
if (aBaseFeature)
isFullyRemoved = SketchSolver_Storage::removeEntity(aBaseFeature) && isFullyRemoved;
- else
- isFullyRemoved = SketchSolver_Storage::removeEntity((*anEntIt)->baseAttribute()) && isFullyRemoved;
+ else {
+ AttributePtr aBaseAttr = (*anEntIt)->baseAttribute();
+ if (aBaseAttr)
+ isFullyRemoved = SketchSolver_Storage::removeEntity(aBaseAttr) && isFullyRemoved;
+ else
+ remove(*anEntIt);
+ }
}
std::list<ParameterWrapperPtr>::const_iterator aParIt = theEntity->parameters().begin();