From: nds Date: Fri, 22 Jan 2016 12:24:29 +0000 (+0300) Subject: Clean history correction: len_1=100, sketch: R(circle) = len_1. Select both, clean... X-Git-Tag: V_2.2.0~179 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f7dd865551197c6060b4d188496074712220a49c;p=modules%2Fshaper.git Clean history correction: len_1=100, sketch: R(circle) = len_1. Select both, clean history. Corrected: in message box "sketch_1" and "len_1" should be (in previous version it was only "sketch_1") --- diff --git a/src/XGUI/XGUI_Tools.cpp b/src/XGUI/XGUI_Tools.cpp index 0b77c6c75..4cf6fdeef 100644 --- a/src/XGUI/XGUI_Tools.cpp +++ b/src/XGUI/XGUI_Tools.cpp @@ -235,15 +235,28 @@ void refsDirectToFeatureInAllDocuments(const ObjectPtr& theSourceObject, const O return; theAlreadyProcessed.insert(aFeature); - // 1. find references in the current document + //convert ignore object list to containt sub-features if the composite feature is in the list + QObjectPtrList aFullIgnoreList; + QObjectPtrList::const_iterator anIIt = theIgnoreList.begin(), anILast = theIgnoreList.end(); + for (; anIIt != anILast; anIIt++) { + aFullIgnoreList.append(*anIIt); + CompositeFeaturePtr aComposite = std::dynamic_pointer_cast(*anIIt); + if (aComposite.get()) { + int aNbSubs = aComposite->numberOfSubs(); + for (int aSub = 0; aSub < aNbSubs; aSub++) { + aFullIgnoreList.append(aComposite->subFeature(aSub)); + } + } + } + // 1. find references in the current document std::set aRefFeatures; refsToFeatureInFeatureDocument(theObject, aRefFeatures); std::set::const_iterator anIt = aRefFeatures.begin(), aLast = aRefFeatures.end(); for (; anIt != aLast; anIt++) { // composite feature should not be deleted when the sub feature is to be deleted - if (!isSubOfComposite(theSourceObject, *anIt) && !theIgnoreList.contains(*anIt)) + if (!isSubOfComposite(theSourceObject, *anIt) && !aFullIgnoreList.contains(*anIt)) theDirectRefFeatures.insert(*anIt); } diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 7f432db6b..8818366a0 100755 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -1217,20 +1217,30 @@ void XGUI_Workshop::cleanHistory() return; QObjectPtrList anObjects = mySelector->selection()->selectedObjects(); - - // 1. find all referenced features - QList anUnusedObjects; - std::set aDirectRefFeatures; + QObjectPtrList aFeatures; foreach (ObjectPtr anObject, anObjects) { FeaturePtr aFeature = std::dynamic_pointer_cast(anObject); // for parameter result, use the corresponded reature to be removed if (!aFeature.get() && anObject->groupName() == ModelAPI_ResultParameter::group()) { aFeature = ModelAPI_Feature::feature(anObject); } + aFeatures.append(aFeature); + } + + // 1. find all referenced features + QList anUnusedObjects; + std::set aDirectRefFeatures; + //foreach (ObjectPtr anObject, anObjects) { + foreach (ObjectPtr anObject, aFeatures) { + FeaturePtr aFeature = std::dynamic_pointer_cast(anObject); + // for parameter result, use the corresponded reature to be removed + //if (!aFeature.get() && anObject->groupName() == ModelAPI_ResultParameter::group()) { + // aFeature = ModelAPI_Feature::feature(anObject); + //} if (aFeature.get()) { std::set alreadyProcessed; aDirectRefFeatures.clear(); - XGUI_Tools::refsDirectToFeatureInAllDocuments(aFeature, aFeature, anObjects, + XGUI_Tools::refsDirectToFeatureInAllDocuments(aFeature, aFeature, aFeatures, aDirectRefFeatures, alreadyProcessed); if (aDirectRefFeatures.empty() && !anUnusedObjects.contains(aFeature)) anUnusedObjects.append(aFeature);