]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #355 - Delete: elements of sketch and constraints
authornds <natalia.donis@opencascade.com>
Tue, 26 May 2015 15:12:06 +0000 (18:12 +0300)
committernds <natalia.donis@opencascade.com>
Tue, 26 May 2015 15:12:29 +0000 (18:12 +0300)
An iteration through the opened documents to find references to a feature in the "PartSet" document.

src/XGUI/XGUI_Workshop.cpp

index 646a41bfa8c070f70a6f183e566d8db0c59b2cb1..89d6e4b6a53cf8a9dcdebd38c73219b01a355dbe 100644 (file)
@@ -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<DocumentPtr> aDocuments = aMgr->allOpenedDocuments();
+        std::list<DocumentPtr> anOpenedDocs = aMgr->allOpenedDocuments();
+        std::list<DocumentPtr>::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