X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_AttributeRefList.cpp;h=b1fcda04632516822a6a4ae3c9abdbd4d95320dd;hb=2df56fe9d65461225eb0e622944862010dee54b0;hp=c9722835887b00258b8e1acbac9797dac0dd06c1;hpb=241b57ba3887bc2d239df98405c4fc4d6979119b;p=modules%2Fshaper.git diff --git a/src/Model/Model_AttributeRefList.cpp b/src/Model/Model_AttributeRefList.cpp index c97228358..b1fcda046 100644 --- a/src/Model/Model_AttributeRefList.cpp +++ b/src/Model/Model_AttributeRefList.cpp @@ -18,10 +18,7 @@ void Model_AttributeRefList::append(ObjectPtr theObject) myRef->Append(aData->label().Father()); // store label of the object // 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(owner()); - if (anOwnerFeature.get()) { - aData->addBackReference(anOwnerFeature, id()); - } + ADD_BACK_REF(theObject); owner()->data()->sendAttributeUpdated(this); } @@ -32,6 +29,7 @@ void Model_AttributeRefList::remove(ObjectPtr theObject) if (theObject.get() != NULL) { aData = std::dynamic_pointer_cast(theObject->data()); myRef->Remove(aData->label().Father()); + REMOVE_BACK_REF(theObject); } else { // in case of empty object remove, the first empty object is removed from the list std::shared_ptr aDoc = std::dynamic_pointer_cast( @@ -42,6 +40,7 @@ void Model_AttributeRefList::remove(ObjectPtr theObject) ObjectPtr anObj = aDoc->object(aLIter.Value()); if (anObj.get() == NULL) { myRef->Remove(aLIter.Value()); + REMOVE_BACK_REF(theObject); break; } } @@ -55,6 +54,14 @@ int Model_AttributeRefList::size() const return myRef->Extent(); } +bool Model_AttributeRefList::isInitialized() +{ + if (size() == 0) { // empty list is not initialized list: sketch will be not valid after add/undo + return false; + } + return ModelAPI_AttributeRefList::isInitialized(); +} + list Model_AttributeRefList::list() { std::list aResult;