}
}
+//**************************************************************
+bool XGUI_Tools::isSubOfComposite(const ObjectPtr& theObject)
+{
+ bool isSub = false;
+ std::set<FeaturePtr> aRefFeatures;
+ refsToFeatureInFeatureDocument(theObject, aRefFeatures);
+ std::set<FeaturePtr>::const_iterator anIt = aRefFeatures.begin(),
+ aLast = aRefFeatures.end();
+ for (; anIt != aLast && !isSub; anIt++) {
+ isSub = isSubOfComposite(theObject, *anIt);
+ }
+ return isSub;
+}
+
//**************************************************************
bool isSubOfComposite(const ObjectPtr& theObject, const FeaturePtr& theFeature)
{
theAlreadyProcessed.insert(aFeature);
// 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))
theDirectRefFeatures.insert(*anIt);
}
std::set<FeaturePtr>& theDirectRefFeatures,
std::set<FeaturePtr>& theIndirectRefFeatures,
std::set<FeaturePtr>& theAlreadyProcessed);
+
+/*!
+* Returns true if the result is a sub object of some composite object
+* \param theObject a result object
+* \returns boolean value
+*/
+bool XGUI_EXPORT isSubOfComposite(const ObjectPtr& theObject);
};
#endif