本文整理汇总了C++中node::SPtr::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ SPtr::getName方法的具体用法?C++ SPtr::getName怎么用?C++ SPtr::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类node::SPtr
的用法示例。
在下文中一共展示了SPtr::getName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addNew
typename Component::SPtr addNew( Node::SPtr parentNode, std::string name="" )
{
typename Component::SPtr component = New<Component>();
parentNode->addObject(component);
component->setName(parentNode->getName()+"_"+name);
return component;
}
示例2: buildNodeFromBaseElement
Node::SPtr GraphModeler::buildNodeFromBaseElement(Node::SPtr node,xml::BaseElement *elem, bool saveHistory)
{
const bool displayWarning=true;
Node::SPtr newNode = Node::create("");
//Configure the new Node
configureElement(newNode.get(), elem);
if (newNode->getName() == "Group")
{
//We can't use the parent node, as it is null
if (!node) return NULL;
//delete newNode;
newNode = node;
}
else
{
// if (node)
{
//Add as a child
addNode(node,newNode,saveHistory);
}
}
typedef xml::BaseElement::child_iterator<> elem_iterator;
for (elem_iterator it=elem->begin(); it != elem->end(); ++it)
{
if (std::string(it->getClass()) == std::string("Node"))
{
buildNodeFromBaseElement(newNode, it,true);
}
else
{
const ComponentLibrary *component = sofaLibrary->getComponent(it->getType());
//Configure the new Component
const std::string templateAttribute("template");
std::string templatename;
templatename = it->getAttribute(templateAttribute, "");
const ClassEntry::SPtr info = component->getEntry();
BaseObject::SPtr newComponent=addComponent(newNode, info, templatename, saveHistory,displayWarning);
if (!newComponent) continue;
configureElement(newComponent.get(), it);
QTreeWidgetItem* itemGraph = graphListener->items[newComponent.get()];
std::string name=itemGraph->text(0).toStdString();
std::string::size_type pos = name.find(' ');
if (pos != std::string::npos) name.resize(pos);
name += " ";
name+=newComponent->getName();
itemGraph->setText(0,name.c_str());
}
}
newNode->clearWarnings();
return newNode;
}