]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #99 fix
authormpv <mikhail.ponikarov@opencascade.com>
Thu, 11 Sep 2014 05:47:57 +0000 (09:47 +0400)
committermpv <mikhail.ponikarov@opencascade.com>
Thu, 11 Sep 2014 05:47:57 +0000 (09:47 +0400)
src/Model/Model_Update.cpp

index 9df4d10f0769a687844a6b8c8c1bd8a9fe58b63b..875d22dd1ad567ddfa7f43f6ed3a91f9e7bbeae6 100644 (file)
@@ -10,6 +10,7 @@
 #include <ModelAPI_Events.h>
 #include <ModelAPI_AttributeReference.h>
 #include <ModelAPI_AttributeRefList.h>
+#include <ModelAPI_AttributeRefAttr.h>
 #include <ModelAPI_Result.h>
 #include <ModelAPI_Validator.h>
 #include <Events_Loop.h>
@@ -79,6 +80,25 @@ bool Model_Update::updateFeature(FeaturePtr theFeature)
         aMustbeUpdated = true;
       }
     }
+    // reference to attribute or object
+    list<boost::shared_ptr<ModelAPI_Attribute> > aRefAttrs = theFeature->data()->attributes(
+        ModelAPI_AttributeRefAttr::type());
+    for (aRefsIter = aRefAttrs.begin(); aRefsIter != aRefAttrs.end(); aRefsIter++) {
+      boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef = 
+        boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(*aRefsIter);
+      if (!aRef) continue;
+      if (aRef->isObject()) {
+        boost::shared_ptr<ModelAPI_Object> aSub = aRef->object();
+        if (updateObject(aSub)) {
+          aMustbeUpdated = true;
+        }
+      } else if (aRef->attr()) { // reference to the attribute
+        boost::shared_ptr<ModelAPI_Object> aSub = aRef->attr()->owner();
+        if (updateObject(aSub)) {
+          aMustbeUpdated = true;
+        }
+      }
+    }
     // lists of references
     aRefs = theFeature->data()->attributes(ModelAPI_AttributeRefList::type());
     for (aRefsIter = aRefs.begin(); aRefsIter != aRefs.end(); aRefsIter++) {