X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_Data.cpp;h=53444bb6d45845a17f5d46e7d783fec7fa0bb36f;hb=149dcd65a901bded64e17047cd5bf91921fa8bba;hp=b3baaea43867efe74c0fa09eef6c3a1e6f1b1b7f;hpb=ba8119ee40e4a1f84df10304dd420d0b9c0a9527;p=modules%2Fshaper.git diff --git a/src/Model/Model_Data.cpp b/src/Model/Model_Data.cpp index b3baaea43..53444bb6d 100644 --- a/src/Model/Model_Data.cpp +++ b/src/Model/Model_Data.cpp @@ -259,9 +259,28 @@ void Model_Data::eraseBackReferences() aRes->setIsConcealed(false); } +void Model_Data::removeBackReference(FeaturePtr theFeature, std::string theAttrID) +{ + AttributePtr anAttribute = theFeature->data()->attribute(theAttrID); + if (myRefsToMe.find(anAttribute) == myRefsToMe.end()) + return; + + myRefsToMe.erase(anAttribute); + // TODO: check whether the concealed should be thrown down to the false value + std::shared_ptr aRes = + std::dynamic_pointer_cast(myObject); + if (aRes) + aRes->setIsConcealed(false); +} + void Model_Data::addBackReference(FeaturePtr theFeature, std::string theAttrID, const bool theApplyConcealment) { + // do not add the same attribute twice + AttributePtr anAttribute = theFeature->data()->attribute(theAttrID); + if (myRefsToMe.find(anAttribute) != myRefsToMe.end()) + return; + myRefsToMe.insert(theFeature->data()->attribute(theAttrID)); if (theApplyConcealment && ModelAPI_Session::get()->validators()->isConcealed(theFeature->getKind(), theAttrID)) {