]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix for the issue #613
authormpv <mpv@opencascade.com>
Thu, 9 Jul 2015 07:35:36 +0000 (10:35 +0300)
committermpv <mpv@opencascade.com>
Thu, 9 Jul 2015 07:35:36 +0000 (10:35 +0300)
src/PartSet/PartSet_SketcherMgr.cpp

index 891703b8e17ac324e83a707a5a7461ff59ee4658..73dd90c13ace843accb5019ce68b19eaaa2262ac 100644 (file)
@@ -792,28 +792,33 @@ void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation* theOperation)
     }
   }
   else {
-  // Hide all sketcher sub-Objects
-  for (int i = 0; i < myCurrentSketch->numberOfSubs(); i++) {
-    FeaturePtr aFeature = myCurrentSketch->subFeature(i);
-    std::list<ResultPtr> aResults = aFeature->results();
+    // Hide all sketcher sub-Objects
+    for (int i = 0; i < myCurrentSketch->numberOfSubs(); i++) {
+      FeaturePtr aFeature = myCurrentSketch->subFeature(i);
+      std::list<ResultPtr> aResults = aFeature->results();
+      std::list<ResultPtr>::const_iterator aIt;
+      for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
+        (*aIt)->setDisplayed(false);
+      }
+      aFeature->setDisplayed(false);
+    }
+    // Display sketcher result
+    std::list<ResultPtr> aResults = myCurrentSketch->results();
     std::list<ResultPtr>::const_iterator aIt;
+    Events_Loop* aLoop = Events_Loop::loop();
+    static Events_ID aDispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
     for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
-      (*aIt)->setDisplayed(false);
+      (*aIt)->setDisplayed(true);
+      // this display event is needed because sketch already may have "displayed" state,
+      // but not displayed while it is still active (issue 613, abort of existing sketch)
+      ModelAPI_EventCreator::get()->sendUpdated(*aIt, aDispEvent);
     }
-    aFeature->setDisplayed(false);
-  }
-  // Display sketcher result
-  std::list<ResultPtr> aResults = myCurrentSketch->results();
-  std::list<ResultPtr>::const_iterator aIt;
-  for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
-    (*aIt)->setDisplayed(true);
-  }
-  myCurrentSketch->setDisplayed(true);
+    myCurrentSketch->setDisplayed(true);
     
-  myCurrentSketch = CompositeFeaturePtr();
-  myModule->workshop()->viewer()->removeSelectionFilter(myPlaneFilter);
+    myCurrentSketch = CompositeFeaturePtr();
+    myModule->workshop()->viewer()->removeSelectionFilter(myPlaneFilter);
 
-  Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
+    Events_Loop::loop()->flush(aDispEvent);
   }
   // restore the module selection modes, which were changed on startSketch
   aConnector->activateModuleSelectionModes();