本文整理汇总了C++中ImageLayer::getInitialOptions方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageLayer::getInitialOptions方法的具体用法?C++ ImageLayer::getInitialOptions怎么用?C++ ImageLayer::getInitialOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageLayer
的用法示例。
在下文中一共展示了ImageLayer::getInitialOptions方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mapConf
Config
EarthFileSerializer2::serialize( MapNode* input ) const
{
Config mapConf("map");
mapConf.set("version", "2");
if ( !input || !input->getMap() )
return mapConf;
Map* map = input->getMap();
MapFrame mapf( map, Map::ENTIRE_MODEL );
// the map and node options:
Config optionsConf = map->getInitialMapOptions().getConfig();
optionsConf.merge( input->getMapNodeOptions().getConfig() );
mapConf.add( "options", optionsConf );
// the layers
for( ImageLayerVector::const_iterator i = mapf.imageLayers().begin(); i != mapf.imageLayers().end(); ++i )
{
ImageLayer* layer = i->get();
Config layerConf = layer->getInitialOptions().getConfig(); //ImageLayerOptions().getConfig();
layerConf.set("name", layer->getName());
layerConf.set("driver", layer->getInitialOptions().driver()->getDriver());
mapConf.add( "image", layerConf );
}
for( ElevationLayerVector::const_iterator i = mapf.elevationLayers().begin(); i != mapf.elevationLayers().end(); ++i )
{
ElevationLayer* layer = i->get();
Config layerConf = layer->getInitialOptions().getConfig();
layerConf.set("name", layer->getName());
layerConf.set("driver", layer->getInitialOptions().driver()->getDriver());
mapConf.add( "elevation", layerConf );
}
for( ModelLayerVector::const_iterator i = mapf.modelLayers().begin(); i != mapf.modelLayers().end(); ++i )
{
ModelLayer* layer = i->get();
Config layerConf = layer->getModelLayerOptions().getConfig(); //layer->getDriverConfig();
layerConf.set("name", layer->getName());
layerConf.set("driver", layer->getModelLayerOptions().driver()->getDriver());
mapConf.add( "model", layerConf );
}
Config ext = input->externalConfig();
if ( !ext.empty() )
{
ext.key() = "external";
mapConf.add( ext );
}
return mapConf;
}
示例2: usage
//.........这里部分代码省略.........
map->getImageLayers( imageLayers );
unsigned counter = 0;
for( ImageLayerVector::iterator i = imageLayers.begin(); i != imageLayers.end(); ++i, ++counter )
{
ImageLayer* layer = i->get();
if( layer->getImageLayerOptions().enabled() == true )
{
std::string layerFolder = toLegalFileName( layer->getName() );
if( layerFolder.empty() )
layerFolder = Stringify() << "image_layer_" << counter;
if( verbose )
{
OE_NOTICE << LC << "Packaging image layer \"" << layerFolder << "\"" << std::endl;
}
osg::ref_ptr< ConsoleProgressCallback > progress = new ConsoleProgressCallback();
std::string layerRoot = osgDB::concatPaths( rootFolder, layerFolder );
TMSPackager::Result r = packager.package( layer, layerRoot, progress, extension );
if( r.ok )
{
// save to the output map if requested:
if( outMap.valid() )
{
// new TMS driver info:
TMSOptions tms;
tms.url() = URI(
osgDB::concatPaths( layerFolder, "tms.xml" ),
outEarthFile );
ImageLayerOptions layerOptions( layer->getName(), tms );
layerOptions.mergeConfig( layer->getInitialOptions().getConfig( true ) );
layerOptions.cachePolicy() = CachePolicy::NO_CACHE;
outMap->addImageLayer( new ImageLayer( layerOptions ) );
}
}
else
{
OE_WARN << LC << r.message << std::endl;
}
}
else if( verbose )
{
OE_NOTICE << LC << "Skipping disabled layer \"" << layer->getName() << "\"" << std::endl;
}
}
// package any elevation layers that are enabled:
counter = 0;
ElevationLayerVector elevationLayers;
map->getElevationLayers( elevationLayers );
for( ElevationLayerVector::iterator i = elevationLayers.begin(); i != elevationLayers.end(); ++i, ++counter )
{
ElevationLayer* layer = i->get();
if( layer->getElevationLayerOptions().enabled() == true )
{
std::string layerFolder = toLegalFileName( layer->getName() );
if( layerFolder.empty() )
layerFolder = Stringify() << "elevation_layer_" << counter;
if( verbose )
{
示例3: mapConf
Config
EarthFileSerializer2::serialize(const MapNode* input, const std::string& referrer) const
{
Config mapConf("map");
mapConf.set("version", "2");
if ( !input || !input->getMap() )
return mapConf;
const Map* map = input->getMap();
MapFrame mapf( map, Map::ENTIRE_MODEL );
// the map and node options:
Config optionsConf = map->getInitialMapOptions().getConfig();
optionsConf.merge( input->getMapNodeOptions().getConfig() );
mapConf.add( "options", optionsConf );
// the layers
for( ImageLayerVector::const_iterator i = mapf.imageLayers().begin(); i != mapf.imageLayers().end(); ++i )
{
ImageLayer* layer = i->get();
//Config layerConf = layer->getInitialOptions().getConfig();
Config layerConf = layer->getImageLayerOptions().getConfig();
layerConf.set("name", layer->getName());
layerConf.set("driver", layer->getInitialOptions().driver()->getDriver());
mapConf.add( "image", layerConf );
}
for( ElevationLayerVector::const_iterator i = mapf.elevationLayers().begin(); i != mapf.elevationLayers().end(); ++i )
{
ElevationLayer* layer = i->get();
//Config layerConf = layer->getInitialOptions().getConfig();
Config layerConf = layer->getElevationLayerOptions().getConfig();
layerConf.set("name", layer->getName());
layerConf.set("driver", layer->getInitialOptions().driver()->getDriver());
mapConf.add( "elevation", layerConf );
}
for( ModelLayerVector::const_iterator i = mapf.modelLayers().begin(); i != mapf.modelLayers().end(); ++i )
{
ModelLayer* layer = i->get();
Config layerConf = layer->getModelLayerOptions().getConfig();
layerConf.set("name", layer->getName());
layerConf.set("driver", layer->getModelLayerOptions().driver()->getDriver());
mapConf.add( "model", layerConf );
}
Config ext = input->externalConfig();
if ( !ext.empty() )
{
ext.key() = "extensions";
mapConf.add( ext );
}
#if 1 // removed until it can be debugged.
// Re-write pathnames in the Config so they are relative to the new referrer.
if ( _rewritePaths && !referrer.empty() )
{
RewritePaths rewritePaths( referrer );
rewritePaths.setRewriteAbsolutePaths( _rewriteAbsolutePaths );
rewritePaths.apply( mapConf );
}
#endif
return mapConf;
}
示例4: usage
//.........这里部分代码省略.........
{
std::cout << "Failed to find an elevation layer at index " << elevationLayerIndex << std::endl;
return 1;
}
}
else
{
// Package all the ImageLayer's
for (unsigned int i = 0; i < map->getNumImageLayers(); i++)
{
ImageLayer* layer = map->getImageLayerAt(i);
OE_NOTICE << "Packaging " << layer->getName() << std::endl;
osg::Timer_t start = osg::Timer::instance()->tick();
packager.run(layer, map);
osg::Timer_t end = osg::Timer::instance()->tick();
if (verbose)
{
OE_NOTICE << "Completed seeding layer " << layer->getName() << " in " << prettyPrintTime( osg::Timer::instance()->delta_s( start, end ) ) << std::endl;
}
if (writeXML)
{
packager.writeXML(layer, map);
}
// save to the output map if requested:
if( outMap.valid() )
{
std::string layerFolder = toLegalFileName( packager.getLayerName() );
// new TMS driver info:
TMSOptions tms;
tms.url() = URI(
osgDB::concatPaths( layerFolder, "tms.xml" ),
outEarthFile );
ImageLayerOptions layerOptions( packager.getLayerName(), tms );
layerOptions.mergeConfig( layer->getInitialOptions().getConfig( true ) );
layerOptions.cachePolicy() = CachePolicy::NO_CACHE;
outMap->addImageLayer( new ImageLayer( layerOptions ) );
}
}
// Package all the ElevationLayer's
for (unsigned int i = 0; i < map->getNumElevationLayers(); i++)
{
ElevationLayer* layer = map->getElevationLayerAt(i);
OE_NOTICE << "Packaging " << layer->getName() << std::endl;
osg::Timer_t start = osg::Timer::instance()->tick();
packager.run(layer, map);
osg::Timer_t end = osg::Timer::instance()->tick();
if (verbose)
{
OE_NOTICE << "Completed seeding layer " << layer->getName() << " in " << prettyPrintTime( osg::Timer::instance()->delta_s( start, end ) ) << std::endl;
}
if (writeXML)
{
packager.writeXML(layer, map);
}
// save to the output map if requested:
if( outMap.valid() )
{
std::string layerFolder = toLegalFileName( packager.getLayerName() );
// new TMS driver info:
TMSOptions tms;
tms.url() = URI(
osgDB::concatPaths( layerFolder, "tms.xml" ),
outEarthFile );
ElevationLayerOptions layerOptions( packager.getLayerName(), tms );
layerOptions.mergeConfig( layer->getInitialOptions().getConfig( true ) );
layerOptions.cachePolicy() = CachePolicy::NO_CACHE;
outMap->addElevationLayer( new ElevationLayer( layerOptions ) );
}
}
}
// Write out an earth file if it was requested
// Finally, write an earth file if requested:
if( outMap.valid() )
{
MapNodeOptions outNodeOptions = mapNode->getMapNodeOptions();
osg::ref_ptr<MapNode> outMapNode = new MapNode( outMap.get(), outNodeOptions );
if( !osgDB::writeNodeFile( *outMapNode.get(), outEarthFile ) )
{
OE_WARN << LC << "Error writing earth file to \"" << outEarthFile << "\"" << std::endl;
}
else if( verbose )
{
OE_NOTICE << LC << "Wrote earth file to \"" << outEarthFile << "\"" << std::endl;
}
}
return 0;
}