本文整理汇总了C++中SoGroup::copy方法的典型用法代码示例。如果您正苦于以下问题:C++ SoGroup::copy方法的具体用法?C++ SoGroup::copy怎么用?C++ SoGroup::copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoGroup
的用法示例。
在下文中一共展示了SoGroup::copy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
SoGroup *
SoFile::copyChildren() const
//
////////////////////////////////////////////////////////////////////////
{
// Create a new SoGroup with our children, and return a copy of
// it. This will ensure that connections are copied properly.
SoGroup *holder = new SoGroup;
holder->ref();
for (int i = 0; i < children.getLength(); i++)
holder->addChild(children[i]);
SoGroup *result = (SoGroup *) holder->copy(TRUE);
holder->unref();
return result;
}
示例2: return
/*!
Returns a subgraph with a deep copy of the children of this node.
*/
SoGroup *
SoFile::copyChildren(void) const
{
SoGroup * tmproot = new SoGroup;
tmproot->ref();
// Instead of individually copying our children one by one and
// attaching to the new group node root, we use a temporary group
// node to first *attach* our children to, and then copying the
// root. This is done so any interconnections between sub-graphs are
// also copied.
const SoChildList * cl = this->children;
for (int i = 0; i < cl->getLength(); i++) {
tmproot->addChild(cl->operator[](i));
}
SoNode * n = tmproot->copy(TRUE);
tmproot->unref();
return (SoGroup *)n;
}