Salome HOME
For the issue #1051: make the model able to be opened and parameters modifiable witho...
authormpv <mpv@opencascade.com>
Wed, 16 Dec 2015 14:59:20 +0000 (17:59 +0300)
committermpv <mpv@opencascade.com>
Wed, 16 Dec 2015 14:59:20 +0000 (17:59 +0300)
src/SketchSolver/SketchSolver_Group.cpp
src/SketchSolver/SketchSolver_Manager.cpp

index 5b242b63264e460bb16445454c7be0bfe5fe4d10..fbd8bf5e0f5ee22b86cd708f1ef3566e42268bbd 100644 (file)
@@ -199,6 +199,13 @@ bool SketchSolver_Group::updateFeature(FeaturePtr theFeature)
 {
   if (!checkFeatureValidity(theFeature))
     return false;
+  // the external feature always should keep the up to date values, so, 
+  // refresh from the solver is never needed
+  std::shared_ptr<SketchPlugin_Feature> aSketchFeature = 
+    std::dynamic_pointer_cast<SketchPlugin_Feature>(theFeature);
+  if (aSketchFeature.get() && aSketchFeature->isExternal())
+    return false;
+
   myStorage->refresh(true);
   return myStorage->update(theFeature);
 }
index 442cf15c2ae1e6fde13251104c025f82c36e36d5..34b2ea0405d432afa86608c2ee8a5c0fbf683b0e 100644 (file)
@@ -81,6 +81,7 @@ void SketchSolver_Manager::processEvent(
 {
   if (myIsComputed)
     return;
+  myIsComputed = true;
   if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)
       || theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED)
       || theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_MOVED)) {
@@ -156,6 +157,7 @@ void SketchSolver_Manager::processEvent(
         myGroups.insert(myGroups.end(), aSeparatedGroups.begin(), aSeparatedGroups.end());
     }
   }
+  myIsComputed = false;
 }
 
 // ============================================================================
@@ -339,7 +341,7 @@ std::shared_ptr<ModelAPI_CompositeFeature> SketchSolver_Manager
 // ============================================================================
 void SketchSolver_Manager::resolveConstraints(const bool theForceUpdate)
 {
-  myIsComputed = true;
+  //myIsComputed = true;
   bool needToUpdate = false;
   static Events_ID anUpdateEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
   // to avoid redisplay of each segment on update by solver one by one in the viewer
@@ -360,7 +362,7 @@ void SketchSolver_Manager::resolveConstraints(const bool theForceUpdate)
   // Must be before flush because on "Updated" flush the results may be produced
   // and the creation event is appeared with many new objects. If myIsComputed these
   // events are missed in processEvents and some elements are not added.
-  myIsComputed = false;
+  //myIsComputed = false;
   if (needToUpdate || theForceUpdate)
     Events_Loop::loop()->flush(anUpdateEvent);
 }