本文整理汇总了C++中TileSource::supportsPersistentCaching方法的典型用法代码示例。如果您正苦于以下问题:C++ TileSource::supportsPersistentCaching方法的具体用法?C++ TileSource::supportsPersistentCaching怎么用?C++ TileSource::supportsPersistentCaching使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TileSource
的用法示例。
在下文中一共展示了TileSource::supportsPersistentCaching方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: seed
void CacheSeed::seed( Map* map )
{
Threading::ScopedReadLock lock( map->getMapDataMutex() );
if (!map->getCache())
{
OE_WARN << "Warning: Map does not have a cache defined, please define a cache." << std::endl;
return;
}
osg::ref_ptr<MapEngine> engine = new MapEngine(); //map->createMapEngine();
std::vector< osg::ref_ptr<TileKey> > keys;
map->getProfile()->getRootKeys(keys);
//Set the default bounds to the entire profile if the user didn't override the bounds
if (_bounds.xMin() == 0 && _bounds.yMin() == 0 &&
_bounds.xMax() == 0 && _bounds.yMax() == 0)
{
const GeoExtent& mapEx = map->getProfile()->getExtent();
_bounds = Bounds( mapEx.xMin(), mapEx.yMin(), mapEx.xMax(), mapEx.yMax() );
}
bool hasCaches = false;
int src_min_level = INT_MAX;
int src_max_level = 0;
//Assumes the the TileSource will perform the caching for us when we call createImage
for( MapLayerList::const_iterator i = map->getImageMapLayers().begin(); i != map->getImageMapLayers().end(); i++ )
{
MapLayer* layer = i->get();
TileSource* src = i->get()->getTileSource();
if (layer->cacheOnly().get())
{
OE_WARN << "Warning: Cannot seed b/c Layer \"" << layer->getName() << "\" is cache only." << std::endl;
return;
}
else if (!src)
{
OE_WARN << "Warning: Layer \"" << layer->getName() << "\" could not create TileSource." << std::endl;
}
else if ( !src->supportsPersistentCaching() )
{
OE_WARN << "Warning: Layer \"" << layer->getName() << "\" does not support seeding." << std::endl;
}
else if ( !layer->getCache() )
{
OE_NOTICE << "Notice: Layer \"" << layer->getName() << "\" has no persistent cache defined; skipping." << std::endl;
}
else
{
hasCaches = true;
if (layer->minLevel().isSet() && layer->minLevel().get() < src_min_level)
src_min_level = layer->minLevel().get();
if (layer->maxLevel().isSet() && layer->maxLevel().get() > src_max_level)
src_max_level = layer->maxLevel().get();
}
}
for( MapLayerList::const_iterator i = map->getHeightFieldMapLayers().begin(); i != map->getHeightFieldMapLayers().end(); i++ )
{
MapLayer* layer = i->get();
TileSource* src = i->get()->getTileSource();
if (layer->cacheOnly().get())
{
OE_WARN << "Warning: Cannot seed b/c Layer \"" << layer->getName() << "\" is cache only." << std::endl;
return;
}
else if (!src)
{
OE_WARN << "Warning: Layer \"" << layer->getName() << "\" could not create TileSource." << std::endl;
}
else if ( !src->supportsPersistentCaching() )
{
OE_WARN << "Warning: Layer \"" << layer->getName() << "\" does not support seeding." << std::endl;
}
else if ( !layer->getCache() )
{
OE_NOTICE << "Notice: Layer \"" << src->getName() << "\" has no persistent cache defined; skipping." << std::endl;
}
else
{
hasCaches = true;
if (layer->minLevel().isSet() && layer->minLevel().get() < src_min_level)
src_min_level = layer->minLevel().get();
if (layer->maxLevel().isSet() && layer->maxLevel().get() > src_max_level)
src_max_level = layer->maxLevel().get();
}
}
if (!hasCaches)
{
OE_NOTICE << "There are either no caches defined in the map, or no sources to cache. Exiting." << std::endl;
return;
}
//.........这里部分代码省略.........