]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/Model/Model_Session.cpp
Salome HOME
Issue #2612 : Re-calculate model after modification of parameters
[modules/shaper.git] / src / Model / Model_Session.cpp
index c0dde0f287ea7bea7ff7f529b0ed201c658cd845..d150d44f902093c1cb3e74e29b887effadd79b48 100644 (file)
@@ -424,6 +424,7 @@ Model_Session::Model_Session()
   myPluginsInfoLoaded = false;
   myCheckTransactions = true;
   myOperationAttachedToNext = false;
+  myIsAutoUpdateBlocked = false;
   ModelAPI_Session::setSession(std::shared_ptr<ModelAPI_Session>(this));
   // register the configuration reading listener
   Events_Loop* aLoop = Events_Loop::loop();
@@ -577,3 +578,19 @@ int Model_Session::transactionID()
 {
   return ROOT_DOC->transactionID();
 }
+
+void Model_Session::blockAutoUpdate(const bool theBlock)
+{
+  if (myIsAutoUpdateBlocked != theBlock) {
+    static Events_Loop* aLoop = Events_Loop::loop();
+    if (theBlock) {
+      static const Events_ID kAutoOff = aLoop->eventByName(EVENT_AUTOMATIC_RECOMPUTATION_DISABLE);
+      std::shared_ptr<Events_Message> aMsg(new Events_Message(kAutoOff));
+      aLoop->send(aMsg);
+    } else {
+      static const Events_ID kAutoOn = aLoop->eventByName(EVENT_AUTOMATIC_RECOMPUTATION_ENABLE);
+      std::shared_ptr<Events_Message> aMsg(new Events_Message(kAutoOn));
+      aLoop->send(aMsg);
+    }
+  }
+}