本文整理汇总了C++中TileSource::getCachePolicyHint方法的典型用法代码示例。如果您正苦于以下问题:C++ TileSource::getCachePolicyHint方法的具体用法?C++ TileSource::getCachePolicyHint怎么用?C++ TileSource::getCachePolicyHint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TileSource
的用法示例。
在下文中一共展示了TileSource::getCachePolicyHint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: seed
void CacheSeed::seed( Map* map )
{
if ( !map->getCache() )
{
OE_WARN << LC << "Warning: No cache defined; aborting." << std::endl;
return;
}
std::vector<TileKey> keys;
map->getProfile()->getRootKeys(keys);
//Add the map's entire extent if we don't have one specified.
if (_extents.empty())
{
addExtent( map->getProfile()->getExtent() );
}
bool hasCaches = false;
int src_min_level = INT_MAX;
unsigned int src_max_level = 0;
MapFrame mapf( map, Map::TERRAIN_LAYERS, "CacheSeed::seed" );
//Assumes the the TileSource will perform the caching for us when we call createImage
for( ImageLayerVector::const_iterator i = mapf.imageLayers().begin(); i != mapf.imageLayers().end(); i++ )
{
ImageLayer* layer = i->get();
TileSource* src = layer->getTileSource();
const ImageLayerOptions& opt = layer->getImageLayerOptions();
if ( layer->isCacheOnly() )
{
OE_WARN << LC << "Warning: Layer \"" << layer->getName() << "\" is set to cache-only; skipping." << std::endl;
}
else if ( !src )
{
OE_WARN << "Warning: Layer \"" << layer->getName() << "\" could not create TileSource; skipping." << std::endl;
}
else if ( src->getCachePolicyHint() == CachePolicy::NO_CACHE )
{
OE_WARN << LC << "Warning: Layer \"" << layer->getName() << "\" does not support seeding; skipping." << std::endl;
}
else if ( !layer->getCache() )
{
OE_WARN << LC << "Notice: Layer \"" << layer->getName() << "\" has no cache defined; skipping." << std::endl;
}
else
{
hasCaches = true;
if (opt.minLevel().isSet() && (int)opt.minLevel().get() < src_min_level)
src_min_level = opt.minLevel().get();
if (opt.maxLevel().isSet() && opt.maxLevel().get() > src_max_level)
src_max_level = opt.maxLevel().get();
}
}
for( ElevationLayerVector::const_iterator i = mapf.elevationLayers().begin(); i != mapf.elevationLayers().end(); i++ )
{
ElevationLayer* layer = i->get();
TileSource* src = layer->getTileSource();
const ElevationLayerOptions& opt = layer->getElevationLayerOptions();
if ( layer->isCacheOnly() )
{
OE_WARN << LC << "Warning: Layer \"" << layer->getName() << "\" is set to cache-only; skipping." << std::endl;
}
else if (!src)
{
OE_WARN << "Warning: Layer \"" << layer->getName() << "\" could not create TileSource; skipping." << std::endl;
}
else if ( src->getCachePolicyHint() == CachePolicy::NO_CACHE )
{
OE_WARN << LC << "Warning: Layer \"" << layer->getName() << "\" does not support seeding; skipping." << std::endl;
}
else if ( !layer->getCache() )
{
OE_WARN << LC << "Notice: Layer \"" << layer->getName() << "\" has no cache defined; skipping." << std::endl;
}
else
{
hasCaches = true;
if (opt.minLevel().isSet() && (int)opt.minLevel().get() < src_min_level)
src_min_level = opt.minLevel().get();
if (opt.maxLevel().isSet() && opt.maxLevel().get() > src_max_level)
src_max_level = opt.maxLevel().get();
}
}
if ( !hasCaches )
{
OE_WARN << LC << "There are either no caches defined in the map, or no sources to cache; aborting." << std::endl;
return;
}
if ( src_max_level > 0 && src_max_level < _maxLevel )
{
_maxLevel = src_max_level;
//.........这里部分代码省略.........