]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Update history for the objects outside of the folder
authorazv <azv@opencascade.com>
Thu, 23 Nov 2017 08:56:02 +0000 (11:56 +0300)
committerazv <azv@opencascade.com>
Thu, 23 Nov 2017 08:56:02 +0000 (11:56 +0300)
src/Model/Model_Objects.cpp
src/ModelAPI/Test/TestFolder_Create.py

index 1eb9349d564c4485455c2a1a2c81b5ba30a458ce..1d37ddeeac4cc713080456236f145062819cbac8 100644 (file)
@@ -392,9 +392,8 @@ void Model_Objects::clearHistory(ObjectPtr theObj)
 {
   if (theObj.get()) {
     const std::string aGroup = theObj->groupName();
-    std::map<std::string, std::vector<ObjectPtr> >::iterator aHIter = myHistory.find(aGroup);
-    if (aHIter != myHistory.end())
-      myHistory.erase(aHIter); // erase from map => this means that it is not synchronized
+    updateHistory(aGroup);
+
     if (theObj->groupName() == ModelAPI_Feature::group()) { // clear results group of the feature
       FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theObj);
       std::string aResultGroup = featureResultGroup(aFeature);
@@ -457,7 +456,7 @@ void Model_Objects::createHistory(const std::string& theGroupID)
           // it may be a folder
           ObjectPtr aFolder = folder(aRefs->Value(a));
           if (aFolder.get()) {
-            aResult.push_back(aFolder);
+            aResultOutOfFolder.push_back(aFolder);
 
             // get the last feature in the folder
             AttributeReferencePtr aLastFeatAttr =
@@ -487,8 +486,13 @@ void Model_Objects::updateHistory(const std::shared_ptr<ModelAPI_Object> theObje
 void Model_Objects::updateHistory(const std::string theGroup)
 {
   std::map<std::string, std::vector<ObjectPtr> >::iterator aHIter = myHistory.find(theGroup);
-  if (aHIter != myHistory.end())
+  if (aHIter != myHistory.end()) {
     myHistory.erase(aHIter); // erase from map => this means that it is not synchronized
+
+    // erase history for the group of objects placed out of any folder
+    const std::string& anOutOfFolderGroupID = groupNameFoldering(theGroup, true);
+    myHistory.erase(anOutOfFolderGroupID);
+  }
 }
 
 ObjectPtr Model_Objects::folder(TDF_Label theLabel) const
index a46b964d5868e9aca24131e38a828c06e7f2fa1b..492e73f1ec12c1cbc94299b7003d0b7312e8905a 100644 (file)
@@ -96,7 +96,7 @@ aSession.finishOperation()
 
 assert(aPartDoc.size("Folders") == 1)
 FOLDER_NAME_EXPECTED = "Folder_1"
-assert(aFolder1.name() == FOLDER_NAME_EXPECTED), "Actual name '{}', expected '{}'".format(aFolder1.name(), FOLDER_NAME_EXPECTED)
+assert(aFolder2.name() == FOLDER_NAME_EXPECTED), "Actual name '{}', expected '{}'".format(aFolder2.name(), FOLDER_NAME_EXPECTED)
 
 from salome.shaper import model
 assert(model.checkPythonDump())