X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_AttributeSelectionList.cpp;h=0643a520bb91a23e620d37c64fefe8413ba3da90;hb=9c54fb01877c455abb5b5ff22e384468f795b328;hp=14a684a96657ff7f13443ac8dc4ef9bff83ccc9a;hpb=3874b57fe5aba25ff5aee2a07654fc23c1ee8eb0;p=modules%2Fshaper.git diff --git a/src/Model/Model_AttributeSelectionList.cpp b/src/Model/Model_AttributeSelectionList.cpp index 14a684a96..0643a520b 100644 --- a/src/Model/Model_AttributeSelectionList.cpp +++ b/src/Model/Model_AttributeSelectionList.cpp @@ -11,6 +11,7 @@ #include "Model_Data.h" #include +#include using namespace std; @@ -30,6 +31,35 @@ void Model_AttributeSelectionList::append( owner()->data()->sendAttributeUpdated(this); } +void Model_AttributeSelectionList::append(std::string theNamingName) +{ + int aNewTag = mySize->Get() + 1; + TDF_Label aNewLab = mySize->Label().FindChild(aNewTag); + + std::shared_ptr aNewAttr = + std::shared_ptr(new Model_AttributeSelection(aNewLab)); + if (owner()) { + aNewAttr->setObject(owner()); + } + mySize->Set(aNewTag); + TopAbs_ShapeEnum aType = (TopAbs_ShapeEnum)selectionType(); + string aTypeName; + switch(aType) { + case TopAbs_VERTEX: aTypeName = "VERT"; break; + case TopAbs_EDGE: aTypeName = "EDGE"; break; + case TopAbs_WIRE: aTypeName = "WIRE"; break; + case TopAbs_FACE: aTypeName = "FACE"; break; + case TopAbs_SHELL: aTypeName = "SHEL"; break; + case TopAbs_SOLID: aTypeName = "SOLD"; break; + case TopAbs_COMPOUND: aTypeName = "COMP"; break; + case TopAbs_COMPSOLID: aTypeName = "COMS"; break; + default: + return; // invalid case => empty new attribute + }; + aNewAttr->selectSubShape(aTypeName, theNamingName); + owner()->data()->sendAttributeUpdated(this); +} + int Model_AttributeSelectionList::size() { return mySize->Get();