当前位置: 首页>>代码示例>>C++>>正文


C++ NodeUnrecPtr::getNChildren方法代码示例

本文整理汇总了C++中NodeUnrecPtr::getNChildren方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeUnrecPtr::getNChildren方法的具体用法?C++ NodeUnrecPtr::getNChildren怎么用?C++ NodeUnrecPtr::getNChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NodeUnrecPtr的用法示例。


在下文中一共展示了NodeUnrecPtr::getNChildren方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: addNode

void SceneGraphTreeModel::addNode(NodeUnrecPtr parent,NodeUnrecPtr nodeToBeAdded)
{
    UInt32 ChildIndex(parent->getNChildren());
    NodeRefPtr(parent)->addChild(nodeToBeAdded);
    produceTreeNodesInserted(createPath(parent),std::vector<UInt32>(1, ChildIndex),std::vector<boost::any>(1, nodeToBeAdded));

    if(parent->getNChildren() == 1)
    {
        if(parent->getParent() != NULL)
        {
            std::vector<UInt32> childIndices;
            childIndices.push_back(parent->getParent()->findChild(parent));
            std::vector<boost::any> ChildUserObjects;
            for(UInt32 i(0) ; i< childIndices.size() ; ++i)
            {
                ChildUserObjects.push_back(boost::any(NodeUnrecPtr(parent->getParent()->getChild(childIndices[i]))));
            }
            produceTreeNodesChanged(createPath(NodeUnrecPtr(parent->getParent())), childIndices, ChildUserObjects);
        }
    }
}	
开发者ID:msteners,项目名称:OpenSGToolbox,代码行数:21,代码来源:OSGSceneGraphTreeModel.cpp

示例2: getChildCount

UInt32 SceneGraphTreeModel::getChildCount(const boost::any& parent) const
{
    try
    {
        NodeUnrecPtr TheNode = boost::any_cast<NodeUnrecPtr>(parent);
        if(TheNode != NULL)
        {
            return TheNode->getNChildren();
        }
        else
        {
            return 0;
        }
    }
    catch(boost::bad_any_cast &ex)
    {
        SWARNING << "Bad any cast: " << ex.what() << std::endl;
        return 0;
    }
}
开发者ID:msteners,项目名称:OpenSGToolbox,代码行数:20,代码来源:OSGSceneGraphTreeModel.cpp

示例3: getChild

boost::any SceneGraphTreeModel::getChild(const boost::any& parent, const UInt32& index) const
{
    try
    {
        NodeUnrecPtr TheNode = boost::any_cast<NodeUnrecPtr>(parent);
        if(TheNode != NULL &&
           TheNode->getNChildren() > index)
        {
            return boost::any(NodeUnrecPtr(TheNode->getChild(index)));
        }
        else
        {
            return boost::any();
        }
    }
    catch(boost::bad_any_cast &ex)
    {
        SWARNING << "Bad any cast: " << ex.what() << std::endl;
        return boost::any();
    }
}
开发者ID:msteners,项目名称:OpenSGToolbox,代码行数:21,代码来源:OSGSceneGraphTreeModel.cpp

示例4: endEntity

/* Insert one or more shallow copies of a block (created by DXFBlock as
 * Transform Group) into a layer (created by DXFLayer as MaterialGroup) or
 * another block.
 * \todo 
 * Could there be a INSERT inside a block referring to another block which has
 * not been read yet? We then have to find a solution to enable deferred
 * instantiation of INSERT entities :-(
 */
DXFResult DXFInsert::endEntity(void)
{
    NodeUnrecPtr                ctrafoNodeP = NULL;
//    ComponentTransformUnrecPtr  ctrafoCoreP = NULL;
    TransformUnrecPtr           ctrafoCoreP = NULL;
    NodeUnrecPtr                blockNodeP  = NULL;

    Node                       *parentNodeP = getParentNode();
    
    StringToNodePtrMap::iterator itr = _blocksMapP->find(_blockName);
    if (itr != _blocksMapP->end() && parentNodeP != NULL)
    {
        blockNodeP = itr->second;
        // TODO: check fetched INSERT Data for consistency!

        // Insert multiple times in a grid...
        Vec3f offset(0.0, 0.0, 0.0);
        for(Int16 column = 0; column < _columnCount; ++ column)
        {
            offset[0] = column * _columnSpacing;
            for(Int16 row = 0; row < _rowCount; ++ row)
            {
                offset[1] = row * _rowSpacing;
                // TODO: find out about DXF insert semantics!

                ctrafoNodeP = Node::create();
                ctrafoCoreP = Transform::create();
                
#if 0
                beginEditCP(ctrafoCoreP);
#endif
                {
					if(_blockName == std::string("Rectangular Mullion - 64 x 128 rectangular-V1-Level 1"))
					{
						std::cout << blockNodeP->getNChildren() << std::endl;
					}
					OSG::TransformationMatrix<Real32> transMat;
					transMat.setIdentity();
		
					transMat.setTranslate(_insertionPoint + offset);

					OSG::TransformationMatrix<Real32> rotMat;
					rotMat.setIdentity();
					OSG::Quaternion rot(OSG::Vec3f(0,0,1),osgDegree2Rad(_rotationAngle));
					rotMat.setRotate(rot);
					OSG::TransformationMatrix<Real32> scaleMat;
					scaleMat.setIdentity();
					scaleMat.setScale(_scaleFactor);
					
					OSG::Vec3f vin(-40, 65, 0);
					OSG::Vec3f vout;
					transMat.mult(rotMat);
					transMat.mult(scaleMat);
					if(_extrusionDirection[2]<0)
					{
						transMat[0][0] *= -1.0;
						transMat[1][0] *= -1.0;
						transMat[2][0] *= -1.0;
						transMat[3][0] *= -1.0;
					}
					ctrafoCoreP->setMatrix(transMat);
                }
#if 0
                endEditCP(ctrafoCoreP);
#endif
#if 0
                beginEditCP(ctrafoNodeP);
#endif
                {
                    ctrafoNodeP->setCore(ctrafoCoreP);
#if 0
                    ctrafoNodeP->addChild(blockNodeP->clone());
#endif
                    NodeUnrecPtr pClone = cloneTree(blockNodeP);
                    ctrafoNodeP->addChild(pClone);
                }
#if 0
                endEditCP(ctrafoNodeP);
#endif                
#if 0
                beginEditCP(parentNodeP);
#endif
                {
                    parentNodeP->addChild(ctrafoNodeP);
                }
#if 0
                endEditCP(parentNodeP);
#endif
            }
        }

        // Warn for details not implemented or assured yet! TODO: better
//.........这里部分代码省略.........
开发者ID:chengzg,项目名称:OSGAddOnsGV,代码行数:101,代码来源:OSGDXFInsert.cpp


注:本文中的NodeUnrecPtr::getNChildren方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。