From a54b060bf89f6760dde19f28cbf060905b394d58 Mon Sep 17 00:00:00 2001 From: szy Date: Thu, 25 Dec 2014 14:48:03 +0300 Subject: [PATCH] Added name registration for methods 'storeGenerated' & 'store'. --- src/Model/Model_ResultBody.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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); + } + } + } } } -- 2.39.2