/// 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); }
/// 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); } }
/// 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); } }
void TiffComponent::addChild(TiffComponent::AutoPtr tiffComponent) { doAddChild(tiffComponent); } // TiffComponent::addChild
/// 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); }