From: azv Date: Thu, 27 Apr 2017 07:52:15 +0000 (+0300) Subject: Improve sketch performance while moving entities X-Git-Tag: V_2.7.1~40 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2c3272b2cb03f034eea9fc9ae19095e0a2b905af;p=modules%2Fshaper.git Improve sketch performance while moving entities --- diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp index eb8868409..d06446e6f 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp @@ -35,7 +35,8 @@ void PlaneGCSSolver_Solver::addConstraint(GCSConstraintPtr theConstraint) { myEquationSystem->addConstraint(theConstraint.get()); myConstraints[theConstraint->getTag()].insert(theConstraint); - myDOF = -1; + if (theConstraint->getTag() >= 0) + myDOF = -1; } void PlaneGCSSolver_Solver::removeConstraint(ConstraintID theID) @@ -46,7 +47,8 @@ void PlaneGCSSolver_Solver::removeConstraint(ConstraintID theID) myDOF = (int)myParameters.size(); } else { myEquationSystem->clearByTag(theID); - myDOF = -1; + if (theID >= 0) + myDOF = -1; } } diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateCoincidence.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateCoincidence.cpp index 51cf2f985..1b7252e2b 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateCoincidence.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateCoincidence.cpp @@ -18,12 +18,11 @@ void PlaneGCSSolver_UpdateCoincidence::attach(SketchSolver_Constraint* theObserv { if (theType == GROUP()) { std::list::iterator aPlaceToAdd = myObservers.end(); - // point-point coincidence is placed first - if (theObserver->getType() == CONSTRAINT_PT_PT_COINCIDENT) { - for (aPlaceToAdd = myObservers.begin(); aPlaceToAdd != myObservers.end(); ++aPlaceToAdd) - if ((*aPlaceToAdd)->getType() != CONSTRAINT_PT_PT_COINCIDENT) - break; - } + // point-point coincidence is placed first, + // other constraints are sorted by their type + for (aPlaceToAdd = myObservers.begin(); aPlaceToAdd != myObservers.end(); ++aPlaceToAdd) + if ((*aPlaceToAdd)->getType() > theObserver->getType()) + break; myObservers.insert(aPlaceToAdd, theObserver); } else myNext->attach(theObserver, theType);