示例#1
0
/// Add a child node
void DAGNode::addChild(core::objectmodel::BaseNode::SPtr node)
{
//    printf("DAGNode::addChild this=%s child=%s\n",getName().c_str(),node->getName().c_str());
    DAGNode::SPtr dagnode = sofa::core::objectmodel::SPtr_static_cast<DAGNode>(node);
    notifyAddChild(dagnode);
    doAddChild(dagnode);
}
示例#2
0
/// Move a node from another node
void GNode::moveChild(BaseNode::SPtr node)
{
    GNode::SPtr gnode = sofa::core::objectmodel::SPtr_dynamic_cast<GNode>(node);
    if (!gnode) return;
    GNode* prev = gnode->parent();
    if (prev==NULL)
    {
        addChild(node);
    }
    else
    {
        notifyMoveChild(gnode,prev);
        prev->doRemoveChild(gnode);
        doAddChild(gnode);
    }
}
示例#3
0
/// Move a node from another node
void DAGNode::moveChild(BaseNode::SPtr node)
{
    DAGNode::SPtr dagnode = sofa::core::objectmodel::SPtr_static_cast<DAGNode>(node);
    if (!dagnode) return;

    core::objectmodel::BaseNode::Parents  nodeParents = dagnode->getParents();
    if (nodeParents.empty())
    {
        addChild(node);
    }
    else
    {
        for (core::objectmodel::BaseNode::Parents::iterator it = nodeParents.begin(); it != nodeParents.end(); ++it)
        {
            DAGNode *prev = static_cast<DAGNode*>(*it);
            notifyMoveChild(dagnode,prev);
            prev->doRemoveChild(dagnode);
        }
        doAddChild(dagnode);
    }
}
示例#4
0
 void TiffComponent::addChild(TiffComponent::AutoPtr tiffComponent)
 {
     doAddChild(tiffComponent);
 } // TiffComponent::addChild
示例#5
0
/// Add a child node
void GNode::addChild(core::objectmodel::BaseNode::SPtr node)
{
    GNode::SPtr gnode = sofa::core::objectmodel::SPtr_dynamic_cast<GNode>(node);
    notifyAddChild(gnode);
    doAddChild(gnode);
}