]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix regression found in squish test for Platine
authorazv <azv@opencascade.com>
Wed, 23 Dec 2015 10:28:00 +0000 (13:28 +0300)
committerazv <azv@opencascade.com>
Wed, 23 Dec 2015 10:28:56 +0000 (13:28 +0300)
src/SketchSolver/SketchSolver_Group.cpp
src/SketchSolver/SketchSolver_Storage.cpp
src/SketchSolver/SketchSolver_Storage.h
src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Storage.cpp

index d62f995e15c507145b5363f6d26dd8f503028df6..b019c7ed308f8fae41a48515875687cfb3f9c4de 100644 (file)
@@ -212,11 +212,19 @@ bool SketchSolver_Group::updateFeature(FeaturePtr theFeature)
   if (!checkFeatureValidity(theFeature))
     return false;
 
-  myStorage->blockEvents(true);
+  bool isBlocked = myStorage->isEventsBlocked();
+  if (!isBlocked)
+    myStorage->blockEvents(true);
+
   myStorage->refresh(true);
   bool isUpdated = myStorage->update(theFeature);
 
   updateMultiConstraints(myConstraints, theFeature);
+
+  // events were not blocked before, the feature has not been updated,
+  // so it is necessary to revert blocking
+  if (!isUpdated && !isBlocked)
+    myStorage->blockEvents(false);
   return isUpdated;
 }
 
index acefc6396f92eab1282fd7eda5deec61f8910077..798935ecf3852f2160080a4591da52b8804ece22 100644 (file)
@@ -71,7 +71,9 @@ void SketchSolver_Storage::addConstraint(
     for (; aCIt != theSolverConstraints.end(); ++aCIt)
       update(*aCIt);
   }
-  myConstraintMap[theConstraint] = theSolverConstraints;
+
+  if (!theSolverConstraints.empty() || aFound == myConstraintMap.end())
+    myConstraintMap[theConstraint] = theSolverConstraints;
   // block events if necessary
   if (myEventsBlocked && theConstraint->data() && theConstraint->data()->isValid())
     theConstraint->data()->blockSendAttributeUpdated(myEventsBlocked);
@@ -91,7 +93,7 @@ void SketchSolver_Storage::addEntity(FeaturePtr       theFeature,
         theFeature->data()->attributes(GeomDataAPI_Point2D::typeId());
     std::list<AttributePtr>::const_iterator anAttrIt = aPntAttrs.begin();
     for (; anAttrIt != aPntAttrs.end(); ++anAttrIt)
-        addEntity(*anAttrIt, EntityWrapperPtr());
+      addEntity(*anAttrIt, EntityWrapperPtr());
     if (aFound == myFeatureMap.end())
       myFeatureMap[theFeature] = theSolverEntity;
   } else
index c5346906ea30792d865a52d49e854a1b10fd2bfd..a35a7366b5e53b6d8785e7461d9a5ca52f9c2feb 100644 (file)
@@ -150,6 +150,9 @@ public:
 
   /// \brief Block or unblock events when refreshing features
   SKETCHSOLVER_EXPORT void blockEvents(bool isBlocked);
+  /// \brief Shows the events are blocked for the features in the storage
+  bool isEventsBlocked() const
+  { return myEventsBlocked; }
 
 protected:
   /// \brief Change mapping feature from SketchPlugin and
index 169302581dc619d99413f2571bfeaba944802760..5398c8870795ca7cec95433d42002fe31fae7cba 100644 (file)
@@ -1649,13 +1649,25 @@ void SolveSpaceSolver_Storage::refresh(bool theFixedOnly) const
         if (!isUpd[1]) aCoords[1] = aPoint2D->y();
         aPoint2D->setValue(aCoords[0], aCoords[1]);
         // Find points coincident with this one (probably not in GID_OUTOFGROUP)
-        std::map<AttributePtr, EntityWrapperPtr>::const_iterator aLocIt =
-            theFixedOnly ? myAttributeMap.begin() : anIt;
-        for (++aLocIt; aLocIt != myAttributeMap.end(); ++aLocIt)
+        std::map<AttributePtr, EntityWrapperPtr>::const_iterator aLocIt;
+        if (theFixedOnly) 
+          aLocIt = myAttributeMap.begin();
+        else {
+          aLocIt = anIt;
+          ++aLocIt;
+        }
+        for (; aLocIt != myAttributeMap.end(); ++aLocIt) {
+          if (!aLocIt->second)
+            continue;
+          std::shared_ptr<SketchPlugin_Feature> aSketchFeature = 
+            std::dynamic_pointer_cast<SketchPlugin_Feature>(aLocIt->first->owner());
+          if (aSketchFeature && aSketchFeature->isExternal())
+            continue;
           if (anIt->second->id() == aLocIt->second->id()) {
             aPoint2D = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aLocIt->first);
             aPoint2D->setValue(aCoords[0], aCoords[1]);
           }
+        }
       }
       continue;
     }