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


C++ TileNode::isValid方法代码示例

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


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

示例1: addChild

// The osgDB::DatabasePager will call this method when merging a new child
// into the scene graph.
bool
TilePagedLOD::addChild(osg::Node* node)
{
    // First check whether this is a new TileGroup (a group that contains a TileNode
    // and children paged LODs). If so, add it normally and inform our parent.
    TileGroup* subtilegroup = dynamic_cast<TileGroup*>(node);
    if ( subtilegroup )
    {
        TileNode* subtile = subtilegroup->getTileNode();
        _isUpsampled = !subtile->getTileModel()->hasRealData();
        _live->add( subtile );
        return osg::PagedLOD::addChild( node );
    }

    // If that fails, check whether this is a simple TileNode. This means that 
    // this is a leaf node in the graph (no children), or it's a replacement
    // tile for our existing tileNode, or possibly that it has no data at all 
    // (and we need to create an upsampled child to complete the required set of
    // four).
    TileNode* subtile = dynamic_cast<TileNode*>(node);
    if ( subtile )
    {
        if ( subtile->getTileModel()->getMapRevision() < _live->getMapRevision() )
        {
            //OE_NOTICE << LC << "Tile " << subtile->getKey().str() << " received data but it's already out of date...requeuing"
            //    << std::endl;
            return false;
        }

        // If it's a legit tile, add it normally and inform our parent.
        // TODO: "invalid" tiles are deprecated. Remove this.
        else
        if ( subtile->isValid() )
        {
            if ( _children.size() == 0 )
            {
                _isUpsampled = !subtile->getTileModel()->hasRealData();

                // The initial valid tile node we've been waiting for. Insert it.
                _live->add( subtile );
                return osg::PagedLOD::addChild( node );
            }
            else
            {
                // A replacement tile. Replace the tile node we have with this
                // new version and update the registry.
                _isUpsampled = !subtile->getTileModel()->hasRealData();
                //if ( _isUpsampled )
                //    OE_NOTICE << LC << "Replaced UPSAMPLED leaf at " << _prefix << std::endl;

                if ( dynamic_cast<TileGroup*>(_children[0].get()) )
                {
                    subtile->setCullCallback( 0L );
                    static_cast<TileGroup*>(_children[0].get())->setTileNode( subtile );
                }
                else // TileNode
                {
                    this->setChild(0, subtile);
                }

                // remove the tile-replacement filename.
                _rangeList.resize( 1 );
                _perRangeDataList.resize( 1 );

                // update the registry. don't need to remove the old entry since add() will
                // replace the existing entry (they have the same key)
                _live->add( subtile );

                return true;
            }
        }
    }
    
    // Getting here means the Tile dies somewhere in the pager while the pager was
    // trying to add it. From what I can tell, this is normal and just happens sometimes
    if ( !node )
    {
        OE_DEBUG << LC << "TilePagedLOD: got an addChild(NULL) on " << _prefix << std::endl;
        _isCanceled = true;
    }

    return false;
}
开发者ID:flybpc,项目名称:osgearth,代码行数:85,代码来源:TilePagedLOD.cpp


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