本文整理汇总了C++中TileSource::getPixelsPerTile方法的典型用法代码示例。如果您正苦于以下问题:C++ TileSource::getPixelsPerTile方法的具体用法?C++ TileSource::getPixelsPerTile怎么用?C++ TileSource::getPixelsPerTile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TileSource
的用法示例。
在下文中一共展示了TileSource::getPixelsPerTile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getTileSource
unsigned
TerrainLayer::getTileSize() const
{
TileSource* ts = getTileSource();
return ts ? ts->getPixelsPerTile() : _tileSize;
}
示例2: if
osg::Image*
CompositeTileSource::createImage(const TileKey& key,
ProgressCallback* progress )
{
ImageMixVector images;
images.reserve( _options._components.size() );
for(CompositeTileSourceOptions::ComponentVector::const_iterator i = _options._components.begin();
i != _options._components.end();
++i )
{
if ( progress && progress->isCanceled() )
return 0L;
ImageInfo imageInfo;
imageInfo.dataInExtents = false;
TileSource* source = i->_tileSourceInstance.get();
if ( source )
{
//TODO: This duplicates code in ImageLayer::isKeyValid. Maybe should move that to TileSource::isKeyValid instead
int minLevel = 0;
int maxLevel = INT_MAX;
if (i->_imageLayerOptions->minLevel().isSet())
{
minLevel = i->_imageLayerOptions->minLevel().value();
}
else if (i->_imageLayerOptions->minResolution().isSet())
{
minLevel = source->getProfile()->getLevelOfDetailForHorizResolution(
i->_imageLayerOptions->minResolution().value(),
source->getPixelsPerTile());
}
if (i->_imageLayerOptions->maxLevel().isSet())
{
maxLevel = i->_imageLayerOptions->maxLevel().value();
}
else if (i->_imageLayerOptions->maxResolution().isSet())
{
maxLevel = source->getProfile()->getLevelOfDetailForHorizResolution(
i->_imageLayerOptions->maxResolution().value(),
source->getPixelsPerTile());
}
// check that this source is within the level bounds:
if (minLevel > (int)key.getLevelOfDetail() ||
maxLevel < (int)key.getLevelOfDetail() )
{
continue;
}
//Only try to get data if the source actually has data
if (source->hasDataInExtent( key.getExtent() ) )
{
//We have data within these extents
imageInfo.dataInExtents = true;
if ( !source->getBlacklist()->contains( key.getTileId() ) )
{
osg::ref_ptr< ImageLayerPreCacheOperation > preCacheOp;
if ( i->_imageLayerOptions.isSet() )
{
preCacheOp = new ImageLayerPreCacheOperation();
preCacheOp->_processor.init( i->_imageLayerOptions.value(), _dbOptions.get(), true );
}
imageInfo.image = source->createImage( key, preCacheOp.get(), progress );
imageInfo.opacity = 1.0f;
//If the image is not valid and the progress was not cancelled, blacklist
if (!imageInfo.image.valid() && (!progress || !progress->isCanceled()))
{
//Add the tile to the blacklist
OE_DEBUG << LC << "Adding tile " << key.str() << " to the blacklist" << std::endl;
source->getBlacklist()->add( key.getTileId() );
}
imageInfo.opacity = i->_imageLayerOptions.isSet() ? i->_imageLayerOptions->opacity().value() : 1.0f;
}
}
else
{
OE_DEBUG << LC << "Source has no data at " << key.str() << std::endl;
}
}
//Add the ImageInfo to the list
images.push_back( imageInfo );
}
unsigned numValidImages = 0;
osg::Vec2s textureSize;
for (unsigned int i = 0; i < images.size(); i++)
{
ImageInfo& info = images[i];
if (info.image.valid())
{
if (numValidImages == 0)
//.........这里部分代码省略.........
示例3: if
osg::Image*
CompositeTileSource::createImage( const TileKey& key, ProgressCallback* progress )
{
ImageMixVector images;
images.reserve( _options._components.size() );
for(CompositeTileSourceOptions::ComponentVector::const_iterator i = _options._components.begin();
i != _options._components.end();
++i )
{
if ( progress && progress->isCanceled() )
return 0L;
TileSource* source = i->_tileSourceInstance->get();
if ( source )
{
//TODO: This duplicates code in ImageLayer::isKeyValid. Maybe should move that to TileSource::isKeyValid instead
int minLevel = 0;
int maxLevel = INT_MAX;
if (i->_imageLayerOptions->minLevel().isSet())
{
minLevel = i->_imageLayerOptions->minLevel().value();
}
else if (i->_imageLayerOptions->minLevelResolution().isSet())
{
minLevel = source->getProfile()->getLevelOfDetailForHorizResolution( i->_imageLayerOptions->minLevelResolution().value(), source->getPixelsPerTile());
}
if (i->_imageLayerOptions->maxLevel().isSet())
{
maxLevel = i->_imageLayerOptions->maxLevel().value();
}
else if (i->_imageLayerOptions->maxLevelResolution().isSet())
{
maxLevel = source->getProfile()->getLevelOfDetailForHorizResolution( i->_imageLayerOptions->maxLevelResolution().value(), source->getPixelsPerTile());
}
// check that this source is within the level bounds:
if (minLevel > key.getLevelOfDetail() ||
maxLevel < key.getLevelOfDetail() )
{
continue;
}
if ( !source->getBlacklist()->contains( key.getTileId() ) )
{
//Only try to get data if the source actually has data
if ( source->hasData( key ) )
{
osg::ref_ptr< ImageLayerPreCacheOperation > preCacheOp;
if ( i->_imageLayerOptions.isSet() )
{
preCacheOp = new ImageLayerPreCacheOperation();
preCacheOp->_processor.init( i->_imageLayerOptions.value(), true );
}
ImageOpacityPair imagePair(
source->createImage( key, preCacheOp.get(), progress ),
1.0f );
//If the image is not valid and the progress was not cancelled, blacklist
if (!imagePair.first.valid() && (!progress || !progress->isCanceled()))
{
//Add the tile to the blacklist
OE_DEBUG << LC << "Adding tile " << key.str() << " to the blacklist" << std::endl;
source->getBlacklist()->add( key.getTileId() );
}
if ( imagePair.first.valid() )
{
// check for opacity:
imagePair.second = i->_imageLayerOptions.isSet() ? i->_imageLayerOptions->opacity().value() : 1.0f;
images.push_back( imagePair );
}
}
else
{
OE_DEBUG << LC << "Source has no data at " << key.str() << std::endl;
}
}
else
{
OE_DEBUG << LC << "Tile " << key.str() << " is blacklisted, not checking" << std::endl;
}
}
}
if ( progress && progress->isCanceled() )
{
//.........这里部分代码省略.........