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


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

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


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

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