From: szy Date: Thu, 25 Dec 2014 11:48:03 +0000 (+0300) Subject: Added name registration for methods 'storeGenerated' & 'store'. X-Git-Tag: V_0.7.0_rc1~43^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a54b060bf89f6760dde19f28cbf060905b394d58;p=modules%2Fshaper.git Added name registration for methods 'storeGenerated' & 'store'. --- diff --git a/src/Model/Model_ResultBody.cpp b/src/Model/Model_ResultBody.cpp index 9f1afcdee..da3ceb26e 100644 --- a/src/Model/Model_ResultBody.cpp +++ b/src/Model/Model_ResultBody.cpp @@ -53,6 +53,17 @@ void Model_ResultBody::store(const std::shared_ptr& theShape) return; // null shape inside aBuilder.Generated(aShape); + // register name + if(!aBuilder.NamedShape()->IsEmpty()) { + Handle(TDataStd_Name) anAttr; + if(aBuilder.NamedShape()->Label().FindAttribute(TDataStd_Name::GetID(),anAttr)) { + std::string aName (TCollection_AsciiString(anAttr->Get()).ToCString()); + if(!aName.empty()) { + std::shared_ptr aDoc = std::dynamic_pointer_cast(document()); + aDoc->addNamingName(aBuilder.NamedShape()->Label(), aName); + } + } + } } } @@ -75,6 +86,17 @@ void Model_ResultBody::storeGenerated(const std::shared_ptr& theF if (aShapeNew.IsNull()) return; // null shape inside aBuilder.Generated(aShapeBasis, aShapeNew); + // register name + if(!aBuilder.NamedShape()->IsEmpty()) { + Handle(TDataStd_Name) anAttr; + if(aBuilder.NamedShape()->Label().FindAttribute(TDataStd_Name::GetID(),anAttr)) { + std::string aName (TCollection_AsciiString(anAttr->Get()).ToCString()); + if(!aName.empty()) { + std::shared_ptr aDoc = std::dynamic_pointer_cast(document()); + aDoc->addNamingName(aBuilder.NamedShape()->Label(), aName); + } + } + } } }