From: azv Date: Thu, 23 Nov 2017 08:56:02 +0000 (+0300) Subject: Update history for the objects outside of the folder X-Git-Tag: V_2.10.0RC~123^2~28 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=48c727855d1b0cc508434a3a4267a7bd0732c55d;p=modules%2Fshaper.git Update history for the objects outside of the folder --- diff --git a/src/Model/Model_Objects.cpp b/src/Model/Model_Objects.cpp index 1eb9349d5..1d37ddeea 100644 --- a/src/Model/Model_Objects.cpp +++ b/src/Model/Model_Objects.cpp @@ -392,9 +392,8 @@ void Model_Objects::clearHistory(ObjectPtr theObj) { if (theObj.get()) { const std::string aGroup = theObj->groupName(); - std::map >::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(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 theObje void Model_Objects::updateHistory(const std::string theGroup) { std::map >::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 diff --git a/src/ModelAPI/Test/TestFolder_Create.py b/src/ModelAPI/Test/TestFolder_Create.py index a46b964d5..492e73f1e 100644 --- a/src/ModelAPI/Test/TestFolder_Create.py +++ b/src/ModelAPI/Test/TestFolder_Create.py @@ -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())