コード例 #1
0
ファイル: TilePagedLOD.cpp プロジェクト: diouck/osgearth
// The osgDB::DatabasePager will call this automatically to purge expired
// tiles from the scene graph.
bool
TilePagedLOD::removeExpiredChildren(double         expiryTime, 
                                    unsigned       expiryFrame, 
                                    osg::NodeList& removedChildren)
{
    if (_children.size()>_numChildrenThatCannotBeExpired)
    {
        unsigned cindex = _children.size() - 1;

        double   minExpiryTime   = 0.0;
        unsigned minExpiryFrames = 0;

        // these were added in osg 3.1.0+
#if OSG_VERSION_GREATER_OR_EQUAL(3,1,0)
        minExpiryTime   = _perRangeDataList[cindex]._minExpiryTime;
        minExpiryFrames = _perRangeDataList[cindex]._minExpiryFrames;
#endif

        if (!_perRangeDataList[cindex]._filename.empty() &&
            _perRangeDataList[cindex]._timeStamp   + minExpiryTime   < expiryTime &&
            _perRangeDataList[cindex]._frameNumber + minExpiryFrames < expiryFrame)
        {
            osg::Node* nodeToRemove = _children[cindex].get();
            removedChildren.push_back(nodeToRemove);

            ExpirationCollector collector( _live.get(), _dead.get() );
            nodeToRemove->accept( collector );

            OE_DEBUG << LC << "Expired " << collector._count << std::endl;

            return Group::removeChildren(cindex,1);
        }
    }
    return false;
}
コード例 #2
0
// The osgDB::DatabasePager will call this automatically to purge expired
// tiles from the scene graph.
bool
TilePagedLOD::removeExpiredChildren(double         expiryTime, 
                                    unsigned       expiryFrame, 
                                    osg::NodeList& removedChildren)
{
    if (_children.size()>_numChildrenThatCannotBeExpired)
    {
        unsigned cindex = _children.size() - 1;

        double   minExpiryTime   = 0.0;
        unsigned minExpiryFrames = 0;

        // these were added in osg 3.1.0+
#if OSG_VERSION_GREATER_OR_EQUAL(3,1,0)
        minExpiryTime   = _perRangeDataList[cindex]._minExpiryTime;
        minExpiryFrames = _perRangeDataList[cindex]._minExpiryFrames;
#endif

        if (!_perRangeDataList[cindex]._filename.empty() &&
            _perRangeDataList[cindex]._timeStamp   + minExpiryTime   < expiryTime &&
            _perRangeDataList[cindex]._frameNumber + minExpiryFrames < expiryFrame)
        {
            osg::Node* nodeToRemove = _children[cindex].get();
            removedChildren.push_back(nodeToRemove);

            ExpirationCollector collector( _live.get() );
            nodeToRemove->accept( collector );
            _releaser->push( collector._toRelease );

            if ( _debug )
            {
                TileNode* tileNode = getTileNode();
                std::string key = tileNode ? tileNode->getKey().str() : "unk";
                OE_NOTICE 
                    << LC << "Tile " << key << " : expiring " << collector._count << " children; "
                    << "TS = " << _perRangeDataList[cindex]._timeStamp
                    << ", MET = " << minExpiryTime
                    << ", ET = " << expiryTime
                    << "; FN = " << _perRangeDataList[cindex]._frameNumber
                    << ", MEF = " << minExpiryFrames
                    << ", EF = " << expiryFrame
                    << "\n";
            }

            return Group::removeChildren(cindex,1);
        }
    }
    return false;
}