本文整理汇总了C++中ImageLayer::open方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageLayer::open方法的具体用法?C++ ImageLayer::open怎么用?C++ ImageLayer::open使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageLayer
的用法示例。
在下文中一共展示了ImageLayer::open方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getProfile
Status
LandUseTileSource::initialize(const osgDB::Options* dbOptions)
{
_dbOptions = Registry::instance()->cloneOrCreateOptions(dbOptions);
const Profile* profile = getProfile();
if ( !profile )
{
profile = osgEarth::Registry::instance()->getGlobalGeodeticProfile();
setProfile( profile );
}
// load all the image layers:
_imageLayers.assign( _options.imageLayerOptionsVector().size(), 0L );
_warps.assign( _options.imageLayerOptionsVector().size(), 0.0f );
for(unsigned i=0; i<_options.imageLayerOptionsVector().size(); ++i)
{
ImageLayerOptions ilo = _options.imageLayerOptionsVector()[i];
ilo.cachePolicy() = CachePolicy::NO_CACHE;
ImageLayer* layer = new ImageLayer( ilo );
layer->setTargetProfileHint( profile );
layer->setReadOptions(_dbOptions.get());
layer->open();
_imageLayers[i] = layer;
Config conf = ilo.getConfig();
_warps[i] = conf.value("warp", _options.warpFactor().get());
}
// set up the noise generator.
const float F[4] = { 4.0f, 16.0f, 4.0f, 8.0f };
const float P[4] = { 0.8f, 0.6f, 0.8f, 0.9f };
const float L[4] = { 2.2f, 1.7f, 3.0f, 4.0f };
// Configure the noise function:
_noiseGen.setNormalize ( true );
_noiseGen.setRange ( 0.0, 1.0 );
_noiseGen.setFrequency ( F[0] );
_noiseGen.setPersistence( P[0] );
_noiseGen.setLacunarity ( L[0] );
_noiseGen.setOctaves ( 8 );
return STATUS_OK;
}
示例2: args
/**
* Command-line tool that copies the contents of one TileSource
* to another. All arguments are Config name/value pairs, so you need
* to look in the header file for each driver's Options structure for
* options :)
*
* Example: copy a GDAL file to an MBTiles repo:
*
* osgearth_conv
* --in driver gdal
* --in url world.tif
* --out driver mbtiles
* --out format image/png
* --out filename world.db
*
* The "in" properties come from the GDALOptions getConfig method. The
* "out" properties come from the MBTilesOptions getConfig method.
*
* Other arguments:
*
* --elevation : convert as elevation data (instead of image data)
* --profile [profile] : reproject to the target profile, e.g. "wgs84"
* --min-level [int] : min level of detail to copy
* --max-level [int] : max level of detail to copy
* --threads [n] : threads to use (may crash. Careful.)
*
* --extents [minLat] [minLong] [maxLat] [maxLong] : Lat/Long extends to copy (*)
*
* OSG arguments:
*
* -O <string> : OSG Options string (plugin options)
*
* Of course, the output driver must support writing (by implementing
* the ReadWriteTileSource interface).
*/
int
main(int argc, char** argv)
{
osg::ArgumentParser args(&argc,argv);
if ( argc == 1 )
return usage(argv);
typedef std::map<std::string,std::string> KeyValue;
std::string key, value;
// collect input configuration:
Config inConf;
while( args.read("--in", key, value) )
inConf.set(key, value);
osg::ref_ptr<osgDB::Options> dbo = new osgDB::Options();
// plugin options, if the user passed them in:
std::string str;
while(args.read("--osg-options", str) || args.read("-O", str))
{
dbo->setOptionString( str );
}
TileSourceOptions inOptions(inConf);
osg::ref_ptr<TileSource> input = TileSourceFactory::create(inOptions);
if ( !input.valid() )
{
OE_WARN << LC << "Failed to open input" << std::endl;
return -1;
}
Status inputStatus = input->open( input->MODE_READ, dbo.get() );
if ( inputStatus.isError() )
{
OE_WARN << LC << "Error initializing input" << std::endl;
return -1;
}
// collect output configuration:
Config outConf;
while( args.read("--out", key, value) )
outConf.set(key, value);
// heightfields?
bool heightFields = args.read("--heightfield") || args.read("--hf") || args.read("--elevation");
if ( heightFields )
OE_INFO << LC << "Converting heightfield tiles" << std::endl;
else
OE_INFO << LC << "Converting image tiles" << std::endl;
// are we changing profiles?
osg::ref_ptr<const Profile> outputProfile = input->getProfile();
std::string profileString;
bool isSameProfile = true;
if ( args.read("--profile", profileString) )
{
outputProfile = Profile::create(profileString);
if ( !outputProfile.valid() || !outputProfile->isOK() )
{
OE_WARN << LC << "Output profile is not recognized" << std::endl;
return -1;
}
//.........这里部分代码省略.........