本文整理汇总了C++中MapFrame::sync方法的典型用法代码示例。如果您正苦于以下问题:C++ MapFrame::sync方法的具体用法?C++ MapFrame::sync怎么用?C++ MapFrame::sync使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapFrame
的用法示例。
在下文中一共展示了MapFrame::sync方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: clear
bool
ElevationPool::getTile(const TileKey& key, MapFrame& frame, osg::ref_ptr<ElevationPool::Tile>& output)
{
// Synchronize the MapFrame to its Map; if there's an update,
// clear out the internal cache and MRU.
if ( frame.needsSync() )
{
if (frame.sync())
{
// Probably unnecessary because the Map itself will clear the pool.
clear();
}
}
OE_START_TIMER(get);
const double timeout = 30.0;
osg::ref_ptr<Tile> tile;
while( tryTile(key, frame, tile) && !tile.valid() && OE_GET_TIMER(get) < timeout)
{
// condition: another thread is working on fetching the tile from the map,
// so wait and try again later. Do this until we succeed or time out.
OpenThreads::Thread::YieldCurrentThread();
}
if ( !tile.valid() && OE_GET_TIMER(get) >= timeout )
{
// this means we timed out trying to fetch the map tile.
OE_TEST << LC << "Timeout fetching tile " << key.str() << std::endl;
}
if ( tile.valid() )
{
if ( tile->_hf.valid() )
{
// got a valid tile, so push it to the query set.
output = tile.get();
}
else
{
OE_WARN << LC << "Got a tile with an invalid HF (" << key.str() << ")\n";
}
}
return tile.valid();
}