From dc3aa7dd575fd59e0744a24172d714873de6da61 Mon Sep 17 00:00:00 2001 From: azv Date: Thu, 2 Jul 2015 15:39:13 +0300 Subject: [PATCH] Avoid excessive recalculations when the group is not changed --- src/SketchSolver/SketchSolver_Constraint.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/SketchSolver/SketchSolver_Constraint.cpp b/src/SketchSolver/SketchSolver_Constraint.cpp index 27f7b76d1..c1d0558f4 100644 --- a/src/SketchSolver/SketchSolver_Constraint.cpp +++ b/src/SketchSolver/SketchSolver_Constraint.cpp @@ -140,8 +140,21 @@ bool SketchSolver_Constraint::checkAttributesChanged(ConstraintPtr theConstraint if (aRefAttr->isObject()) { FeaturePtr aFeature = ModelAPI_Feature::feature(aRefAttr->object()); std::map::iterator aFIt = myFeatureMap.find(aFeature); - if (aFeature && (aFIt == myFeatureMap.end() || aCurAttrs.find(aFIt->second) == aCurAttrs.end())) - return true; + if (aFeature) { + if (aFIt == myFeatureMap.end()) + return true; + // Additional check the points of entity + if (aCurAttrs.find(aFIt->second) == aCurAttrs.end()) { + Slvs_Entity anEntity = myStorage->getEntity(aFIt->second); + bool isFound = false; + for (int i = 0; i < 4 && !isFound; i++) + if (anEntity.point[i] != SLVS_E_UNKNOWN && + aCurAttrs.find(anEntity.point[i]) != aCurAttrs.end()) + isFound = true; + if (!isFound) + return true; + } + } } else if (aRefAttr->attr()) { std::map::iterator anAIt = myAttributeMap.find(aRefAttr->attr()); if (anAIt == myAttributeMap.end() || aCurAttrs.find(anAIt->second) == aCurAttrs.end()) -- 2.39.2