From: azv Date: Tue, 23 Sep 2014 12:13:27 +0000 (+0400) Subject: Issue #149 fix: Implemented update procedure for constraint when its attributes was... X-Git-Tag: V_0.4.4~30 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5891b7093f20399c05cdb9a1f678c7bdd05a9ad8;p=modules%2Fshaper.git Issue #149 fix: Implemented update procedure for constraint when its attributes was changed --- diff --git a/src/SketchSolver/SketchSolver_ConstraintGroup.cpp b/src/SketchSolver/SketchSolver_ConstraintGroup.cpp index 723ae3836..df7b1614e 100644 --- a/src/SketchSolver/SketchSolver_ConstraintGroup.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintGroup.cpp @@ -281,7 +281,7 @@ bool SketchSolver_ConstraintGroup::changeConstraint( aConstrEnt[indAttr] = changeEntity(aConstrAttr->attr()); } - if (aConstrMapIter == myConstraintMap.end()) { + if (aConstrMapIter == myConstraintMap.end()) { // Add new constraint // Several points may be coincident, it is not necessary to store all constraints between them. // Try to find sequence of coincident points which connects the points of new constraint if (aConstrType == SLVS_C_POINTS_COINCIDENT) { @@ -302,6 +302,17 @@ bool SketchSolver_ConstraintGroup::changeConstraint( int aConstrPos = Search(aConstraint.h, myConstraints); aConstrIter = myConstraints.begin() + aConstrPos; myNeedToSolve = true; + } else { // Attributes of constraint may be changed => update constraint + Slvs_hEntity* aCurrentAttr[] = {&aConstrIter->ptA, &aConstrIter->ptB, + &aConstrIter->entityA, &aConstrIter->entityB, + &aConstrIter->entityC, &aConstrIter->entityD}; + for (unsigned int indAttr = 0; indAttr < CONSTRAINT_ATTR_SIZE; indAttr++) { + if (*(aCurrentAttr[indAttr]) != aConstrEnt[indAttr]) + { + *(aCurrentAttr[indAttr]) = aConstrEnt[indAttr]; + myNeedToSolve = true; + } + } } checkConstraintConsistence(*aConstrIter);