]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Debug of working with transactions in different parts
authormpv <mikhail.ponikarov@opencascade.com>
Mon, 28 Jul 2014 14:28:37 +0000 (18:28 +0400)
committermpv <mikhail.ponikarov@opencascade.com>
Mon, 28 Jul 2014 14:28:37 +0000 (18:28 +0400)
src/Model/Model_Document.cpp
src/ModelAPI/ModelAPI_Object.h

index a69ef1a93a9d3a2f7588a39e2d77ea46da857d51..a4c9729ae4594613d8a745d1c6e0b14a42efc013 100644 (file)
@@ -214,7 +214,7 @@ void Model_Document::startOperation()
     myIsEmptyTr[myTransactionsAfterSave] = false;
     myTransactionsAfterSave++;
     myDoc->NewCommand();
-  } else { // start of simple command
+  } else { // start the simple command
     myDoc->NewCommand();
   }
   // new command for all subs
@@ -224,12 +224,16 @@ void Model_Document::startOperation()
 }
 
 void Model_Document::compactNested() {
+  bool allWasEmpty = true;
   while(myNestedNum != -1) {
     myTransactionsAfterSave--;
+    if (!myIsEmptyTr[myTransactionsAfterSave]) {
+      allWasEmpty = false;
+    }
     myIsEmptyTr.erase(myTransactionsAfterSave);
     myNestedNum--;
   }
-  myIsEmptyTr[myTransactionsAfterSave] = false;
+  myIsEmptyTr[myTransactionsAfterSave] = allWasEmpty;
   myTransactionsAfterSave++;
   myDoc->PerformDeltaCompaction();
 }
@@ -258,7 +262,7 @@ void Model_Document::finishOperation()
     }
   } else {
     // returns false if delta is empty and no transaction was made
-    myIsEmptyTr[myTransactionsAfterSave] = !myDoc->CommitCommand() && (myNestedNum == -1);
+    myIsEmptyTr[myTransactionsAfterSave] = !myDoc->CommitCommand();// && (myNestedNum == -1);
     myTransactionsAfterSave++;
   }
 
@@ -681,10 +685,12 @@ void Model_Document::synchronizeFeatures(const bool theMarkUpdated)
       std::list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
       for(; aRIter != aResults.cend(); aRIter++) {
         boost::shared_ptr<ModelAPI_Result> aRes = *aRIter;
-        aRes->setData(boost::shared_ptr<ModelAPI_Data>()); // deleted flag
+        //aRes->setData(boost::shared_ptr<ModelAPI_Data>()); // deleted flag
         ModelAPI_EventCreator::get()->sendUpdated(aRes, EVENT_DISP);
         ModelAPI_EventCreator::get()->sendDeleted(aThis, aRes->groupName());
       }
+      // redisplay also removed feature (used for sketch and AISObject)
+      ModelAPI_EventCreator::get()->sendUpdated(aFeature, EVENT_DISP);
     } else aFIter.Next();
   }
 
@@ -695,6 +701,7 @@ void Model_Document::synchronizeFeatures(const bool theMarkUpdated)
   if (theMarkUpdated)
     Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
   Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_DELETED));
+  Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
   boost::static_pointer_cast<Model_PluginManager>(Model_PluginManager::get())->
     setCheckTransactions(true);
 }
index 9079883933ae2be6ee557374e53d1f4b11f94e92..7eb0cf97939b84d72f8fe26e8c19e89ec13cb0ed 100644 (file)
@@ -32,7 +32,7 @@ public:
   /// Returns the data manager of this object: attributes
   virtual boost::shared_ptr<ModelAPI_Data> data() {return myData;}
 
-  /// Returns true if feature refers to the same data model instance
+  /// Returns true if object refers to the same data model instance
   virtual bool isSame(const boost::shared_ptr<ModelAPI_Object>& theObject)
     {return theObject.get() == this;}