X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchSolver%2FSketchSolver_Group.cpp;h=0959722eeb56e68471b3524971f9b638d3517752;hb=8e3ea4b8a0e09cfb299a7a74f97b2df3f7f1b657;hp=ee4c2da05af6786761270d0ca593a3c23daec76e;hpb=9c0fc0d0d7cf50049ccd42f090cab48eb51e082b;p=modules%2Fshaper.git diff --git a/src/SketchSolver/SketchSolver_Group.cpp b/src/SketchSolver/SketchSolver_Group.cpp index ee4c2da05..0959722ee 100644 --- a/src/SketchSolver/SketchSolver_Group.cpp +++ b/src/SketchSolver/SketchSolver_Group.cpp @@ -133,6 +133,7 @@ bool SketchSolver_Group::changeConstraint( return false; BuilderPtr aBuilder = SketchSolver_Manager::instance()->builder(); + myStorage->blockEvents(true); bool isNewConstraint = myConstraints.find(theConstraint) == myConstraints.end(); if (isNewConstraint) { @@ -200,6 +201,7 @@ bool SketchSolver_Group::updateFeature(FeaturePtr theFeature) if (!checkFeatureValidity(theFeature)) return false; + myStorage->blockEvents(true); myStorage->refresh(true); return myStorage->update(theFeature); } @@ -209,6 +211,7 @@ void SketchSolver_Group::moveFeature(FeaturePtr theFeature) BuilderPtr aBuilder = SketchSolver_Manager::instance()->builder(); // Firstly, revert changes in the fixed entities + myStorage->blockEvents(true); myStorage->refresh(true); // Secondly, search attributes of the feature in the list of the Multi constraints and update them @@ -295,19 +298,17 @@ bool SketchSolver_Group::resolveConstraints() // To avoid overconstraint situation, we will remove temporary constraints one-by-one // and try to find the case without overconstraint bool isLastChance = false; - size_t aNbTemp = myStorage->nbTemporary(); while (true) { aResult = mySketchSolver->solve(); if (aResult == STATUS_OK || aResult == STATUS_EMPTYSET || isLastChance) break; - if (aNbTemp == 0) { - // try to update parameters and resolve once again - ConstraintConstraintMap::iterator aConstrIt = myConstraints.begin(); - for (; aConstrIt != myConstraints.end(); ++aConstrIt) - aConstrIt->second->update(); - isLastChance = true; - } else - aNbTemp = myStorage->removeTemporary(); + // try to update parameters and resolve once again + ConstraintConstraintMap::iterator aConstrIt = myConstraints.begin(); + for (; aConstrIt != myConstraints.end(); ++aConstrIt) + aConstrIt->second->update(); + isLastChance = true; + + removeTemporaryConstraints(); mySketchSolver->calculateFailedConstraints(true); // something failed => need to find it myStorage->initializeSolver(mySketchSolver); } @@ -353,6 +354,7 @@ bool SketchSolver_Group::resolveConstraints() myStorage->refresh(); } removeTemporaryConstraints(); + myStorage->blockEvents(false); myStorage->setNeedToResolve(false); return aResolved; } @@ -497,10 +499,6 @@ void SketchSolver_Group::removeTemporaryConstraints() for (; aTmpIt != myTempConstraints.end(); ++aTmpIt) (*aTmpIt)->remove(); - size_t aNbTemp = myStorage->nbTemporary(); - if (aNbTemp > 0) - myStorage->removeTemporary(aNbTemp); - if (!myTempConstraints.empty()) myStorage->verifyFixed(); myStorage->setNeedToResolve(false); @@ -569,7 +567,6 @@ bool SketchSolver_Group::isComplexConstraint(FeaturePtr theConstraint) // ============================================================================ void SketchSolver_Group::setTemporary(SolverConstraintPtr theConstraint) { - theConstraint->makeTemporary(); myTempConstraints.insert(theConstraint); }