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);
}
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);