]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Update tolerance for deciding the parameters are same to prevent frequent updates...
authorazv <azv@opencascade.com>
Thu, 24 Nov 2016 10:01:29 +0000 (13:01 +0300)
committerazv <azv@opencascade.com>
Thu, 24 Nov 2016 10:02:07 +0000 (13:02 +0300)
src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp

index 90e25c458bec8f27f4699edff712f590852a7aa4..b26213dcc8c703cef60ecf79ea2a4e8dc02b21fb 100644 (file)
@@ -672,6 +672,8 @@ void PlaneGCSSolver_Storage::refresh(bool theFixedOnly) const
 {
   //blockEvents(true);
 
+  const double aTol = 1000. * tolerance; // tolerance to prevent frequent updates
+
   std::map<AttributePtr, EntityWrapperPtr>::const_iterator anIt = myAttributeMap.begin();
   std::list<ParameterWrapperPtr> aParams;
   std::list<ParameterWrapperPtr>::const_iterator aParIt;
@@ -698,8 +700,8 @@ void PlaneGCSSolver_Storage::refresh(bool theFixedOnly) const
     std::shared_ptr<GeomDataAPI_Point2D> aPoint2D =
         std::dynamic_pointer_cast<GeomDataAPI_Point2D>(anIt->first);
     if (aPoint2D) {
-      if ((isUpd[0] && fabs(aPoint2D->x() - aCoords[0]) > tolerance) ||
-          (isUpd[1] && fabs(aPoint2D->y() - aCoords[1]) > tolerance) || isExternal) {
+      if ((isUpd[0] && fabs(aPoint2D->x() - aCoords[0]) > aTol) ||
+          (isUpd[1] && fabs(aPoint2D->y() - aCoords[1]) > aTol) || isExternal) {
         // Find points coincident with this one (probably not in GID_OUTOFGROUP)
         CoincidentPointsMap::const_iterator aCoincIt = myCoincidentPoints.begin();
         for (; aCoincIt != myCoincidentPoints.end(); ++aCoincIt)
@@ -729,7 +731,7 @@ void PlaneGCSSolver_Storage::refresh(bool theFixedOnly) const
     }
     AttributeDoublePtr aScalar = std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(anIt->first);
     if (aScalar && !isExternal) {
-      if (isUpd[0] && fabs(aScalar->value() - aCoords[0]) > tolerance)
+      if (isUpd[0] && fabs(aScalar->value() - aCoords[0]) > aTol)
         aScalar->setValue(aCoords[0]);
       continue;
     }