From: nds Date: Tue, 26 May 2015 15:12:06 +0000 (+0300) Subject: Issue #355 - Delete: elements of sketch and constraints X-Git-Tag: V_1.2.0~68 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d7c73b6f25c471b02988690ca7fa1d632eef150c;p=modules%2Fshaper.git Issue #355 - Delete: elements of sketch and constraints An iteration through the opened documents to find references to a feature in the "PartSet" document. --- diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 646a41bfa..89d6e4b6a 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -1313,7 +1313,22 @@ bool XGUI_Workshop::deleteFeatures(const QObjectPtrList& theList, foreach (ObjectPtr aObj, theList) { FeaturePtr aFeature = ModelAPI_Feature::feature(aObj); if (aFeature.get() != NULL) { - aObj->document()->refsToFeature(aFeature, aRefFeatures, false); + DocumentPtr aFeatureDoc = aObj->document(); + SessionPtr aMgr = ModelAPI_Session::get(); + DocumentPtr aModuleDoc = aMgr->moduleDocument(); + // objects from "Part" documents can refer to the the features of "PartSet". + // So, it the referenced features should be checked in these documents + if (aFeatureDoc == aModuleDoc) { + std::list aDocuments = aMgr->allOpenedDocuments(); + std::list anOpenedDocs = aMgr->allOpenedDocuments(); + std::list::const_iterator anIt = anOpenedDocs.begin(), + aLast = anOpenedDocs.end(); + for (; anIt != aLast; anIt++) { + (*anIt)->refsToFeature(aFeature, aRefFeatures, false); + } + } + else + aFeatureDoc->refsToFeature(aFeature, aRefFeatures, false); } } // 2. warn about the references remove, break the delete operation if the user chose it