本文整理汇总了C++中ImageLayer::getCacheSettings方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageLayer::getCacheSettings方法的具体用法?C++ ImageLayer::getCacheSettings怎么用?C++ ImageLayer::getCacheSettings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageLayer
的用法示例。
在下文中一共展示了ImageLayer::getCacheSettings方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: usage
int
purge( osg::ArgumentParser& args )
{
osg::ref_ptr<osg::Node> node = osgDB::readNodeFiles( args );
if ( !node.valid() )
return usage( "Failed to read .earth file." );
MapNode* mapNode = MapNode::findMapNode( node.get() );
if ( !mapNode )
return usage( "Input file was not a .earth file" );
Map* map = mapNode->getMap();
if ( !map->getCache() )
return message( "Earth file does not contain a cache." );
std::vector<Entry> entries;
ImageLayerVector imageLayers;
map->getLayers( imageLayers );
for( ImageLayerVector::const_iterator i = imageLayers.begin(); i != imageLayers.end(); ++i )
{
ImageLayer* layer = i->get();
bool useMFP =
layer->getProfile() &&
layer->getProfile()->getSRS()->isSphericalMercator() &&
mapNode->getMapNodeOptions().getTerrainOptions().enableMercatorFastPath() == true;
const Profile* cacheProfile = useMFP ? layer->getProfile() : map->getProfile();
CacheSettings* cacheSettings = layer->getCacheSettings();
if (cacheSettings)
{
CacheBin* bin = cacheSettings->getCacheBin();
if ( bin )
{
entries.push_back(Entry());
entries.back()._isImage = true;
entries.back()._name = i->get()->getName();
entries.back()._bin = bin;
}
}
}
ElevationLayerVector elevationLayers;
map->getLayers( elevationLayers );
for( ElevationLayerVector::const_iterator i = elevationLayers.begin(); i != elevationLayers.end(); ++i )
{
ElevationLayer* layer = i->get();
bool useMFP =
layer->getProfile() &&
layer->getProfile()->getSRS()->isSphericalMercator() &&
mapNode->getMapNodeOptions().getTerrainOptions().enableMercatorFastPath() == true;
const Profile* cacheProfile = useMFP ? layer->getProfile() : map->getProfile();
CacheSettings* cacheSettings = layer->getCacheSettings();
if (cacheSettings)
{
CacheBin* bin = cacheSettings->getCacheBin();
if (bin)
{
entries.push_back(Entry());
entries.back()._isImage = false;
entries.back()._name = i->get()->getName();
entries.back()._bin = bin;
}
}
}
if ( entries.size() > 0 )
{
std::cout << std::endl;
for( unsigned i=0; i<entries.size(); ++i )
{
std::cout << (i+1) << ") " << entries[i]._name << " (" << (entries[i]._isImage? "image" : "elevation" ) << ")" << std::endl;
}
std::cout
<< std::endl
<< "Enter number of cache to purge, or <enter> to quit: "
<< std::flush;
std::string input;
std::getline( std::cin, input );
if ( !input.empty() )
{
unsigned k = as<unsigned>(input, 0L);
if ( k > 0 && k <= entries.size() )
{
Config meta = entries[k-1]._bin->readMetadata();
if ( !meta.empty() )
{
std::cout
<< std::endl
//.........这里部分代码省略.........