X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_AttributeRefAttr.cpp;h=14e6eb4a18d394929af5d30dc2d89d11f10ac4c6;hb=3704e9a9bdb395cfe86e54ac53ef0ac91d8350bd;hp=560a3fd062f3202dd1ee99a1973b12d8bf68711f;hpb=8dc74f82810d5f597b78633b457efb0ef4f89f9f;p=modules%2Fshaper.git diff --git a/src/Model/Model_AttributeRefAttr.cpp b/src/Model/Model_AttributeRefAttr.cpp index 560a3fd06..14e6eb4a1 100644 --- a/src/Model/Model_AttributeRefAttr.cpp +++ b/src/Model/Model_AttributeRefAttr.cpp @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + // File: ModelAPI_AttributeRefAttr.cxx // Created: 2 Apr 2014 // Author: Mikhail PONIKAROV @@ -14,34 +16,33 @@ bool Model_AttributeRefAttr::isObject() return myID->Get().Length() == 0; } -void Model_AttributeRefAttr::setAttr(boost::shared_ptr theAttr) +void Model_AttributeRefAttr::setAttr(std::shared_ptr theAttr) { - boost::shared_ptr aData = boost::dynamic_pointer_cast( + std::shared_ptr aData = std::dynamic_pointer_cast( theAttr->owner()->data()); string anID = aData->id(theAttr); if (myIsInitialized && object() == theAttr->owner() && myID->Get().IsEqual(anID.c_str())) return; // nothing is changed - myRef->Set(aData->label().Father()); myID->Set(aData->id(theAttr).c_str()); owner()->data()->sendAttributeUpdated(this); } -boost::shared_ptr Model_AttributeRefAttr::attr() +std::shared_ptr Model_AttributeRefAttr::attr() { ObjectPtr anObj = object(); if (anObj) { - boost::shared_ptr aData = boost::dynamic_pointer_cast(anObj->data()); + std::shared_ptr aData = std::dynamic_pointer_cast(anObj->data()); return aData->attribute(TCollection_AsciiString(myID->Get()).ToCString()); } // not initialized - return boost::shared_ptr(); + return std::shared_ptr(); } void Model_AttributeRefAttr::setObject(ObjectPtr theObject) { - if (!myIsInitialized || myID->Get().Length() != 0 || object() != theObject) { - boost::shared_ptr aData = boost::dynamic_pointer_cast( + if (theObject && (!myIsInitialized || myID->Get().Length() != 0 || object() != theObject)) { + std::shared_ptr aData = std::dynamic_pointer_cast( theObject->data()); myRef->Set(aData->label().Father()); myID->Set(""); // feature is identified by the empty ID @@ -52,7 +53,7 @@ void Model_AttributeRefAttr::setObject(ObjectPtr theObject) ObjectPtr Model_AttributeRefAttr::object() { if (myRef->Get() != myRef->Label()) { // initialized - boost::shared_ptr aDoc = boost::dynamic_pointer_cast( + std::shared_ptr aDoc = std::dynamic_pointer_cast( owner()->document()); if (aDoc) { TDF_Label aRefLab = myRef->Get();