]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Added name registration for methods 'storeGenerated' & 'store'.
authorszy <szy@opencascade.com>
Thu, 25 Dec 2014 11:48:03 +0000 (14:48 +0300)
committerszy <szy@opencascade.com>
Thu, 25 Dec 2014 11:48:03 +0000 (14:48 +0300)
src/Model/Model_ResultBody.cpp

index 9f1afcdee18b10bd9292473938734f7aa53bd41f..da3ceb26e3db74630d7f9b59f5ab775cd236d107 100644 (file)
@@ -53,6 +53,17 @@ void Model_ResultBody::store(const std::shared_ptr<GeomAPI_Shape>& 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<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(document());
+          aDoc->addNamingName(aBuilder.NamedShape()->Label(), aName);
+               }
+         }
+       }
   }
 }
 
@@ -75,6 +86,17 @@ void Model_ResultBody::storeGenerated(const std::shared_ptr<GeomAPI_Shape>& 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<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(document());
+          aDoc->addNamingName(aBuilder.NamedShape()->Label(), aName);
+               }
+         }
+       }
   }
 }