- static Events_ID anEvent = Events_Loop::eventByName(EVENT_FEATURE_UPDATED);
- Model_FeatureUpdatedMessage aMsg(owner(), anEvent);
- Events_Loop::loop()->send(aMsg);
+ std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(
+ theObject->data());
+ myRef->Set(aData->label().Father());
+ myID->Set(""); // feature is identified by the empty ID
+
+ // do it before the transaction finish to make just created/removed objects know dependencies
+ // and reference from composite feature is removed automatically
+ FeaturePtr anOwnerFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner());
+ if (anOwnerFeature.get()) {
+ aData->addBackReference(anOwnerFeature, id(), false);
+ }
+ ADD_BACK_REF(theObject);
+ owner()->data()->sendAttributeUpdated(this);
+ } else if (theObject.get() == NULL) {
+ REMOVE_BACK_REF(anObject);
+ myRef->Set(myRef->Label()); // reference to itself means that object is null
+ myID->Set(""); // feature is identified by the empty ID
+ owner()->data()->sendAttributeUpdated(this);