]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Clean history correction: len_1=100, sketch: R(circle) = len_1. Select both, clean...
authornds <nds@opencascade.com>
Fri, 22 Jan 2016 12:24:29 +0000 (15:24 +0300)
committernds <nds@opencascade.com>
Fri, 22 Jan 2016 12:24:54 +0000 (15:24 +0300)
src/XGUI/XGUI_Tools.cpp
src/XGUI/XGUI_Workshop.cpp

index 0b77c6c75cfb48c9a65acac5b5e8b0e93eb55905..4cf6fdeeffc0d4ae84037982914f717cc12a17df 100644 (file)
@@ -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<ModelAPI_CompositeFeature>(*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<FeaturePtr> aRefFeatures;
   refsToFeatureInFeatureDocument(theObject, aRefFeatures);
   std::set<FeaturePtr>::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);
   }
 
index 7f432db6b281a32cb3650905b2079edf57217472..8818366a0d8c6d2c2a4b31279d3b09128e54293d 100755 (executable)
@@ -1217,20 +1217,30 @@ void XGUI_Workshop::cleanHistory()
     return;
 
   QObjectPtrList anObjects = mySelector->selection()->selectedObjects();
-
-  // 1. find all referenced features
-  QList<ObjectPtr> anUnusedObjects;
-  std::set<FeaturePtr> aDirectRefFeatures;
+  QObjectPtrList aFeatures;
   foreach (ObjectPtr anObject, anObjects) {
     FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(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<ObjectPtr> anUnusedObjects;
+  std::set<FeaturePtr> aDirectRefFeatures;
+  //foreach (ObjectPtr anObject, anObjects) {
+  foreach (ObjectPtr anObject, aFeatures) {
+    FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(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<FeaturePtr> 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);