本文整理汇总了C++中TileKey::createChildKey方法的典型用法代码示例。如果您正苦于以下问题:C++ TileKey::createChildKey方法的具体用法?C++ TileKey::createChildKey怎么用?C++ TileKey::createChildKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TileKey
的用法示例。
在下文中一共展示了TileKey::createChildKey方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processKey
void TMSBackFiller::processKey( const TileKey& key )
{
if (_verbose) OE_NOTICE << "Processing key " << key.str() << std::endl;
//Get all of the child tiles for this key, load them and mosaic them into a new tile
TileKey ulKey = key.createChildKey( 0 );
TileKey urKey = key.createChildKey( 1 );
TileKey llKey = key.createChildKey( 2 );
TileKey lrKey = key.createChildKey( 3 );
osg::ref_ptr< osg::Image > ul = readTile( ulKey );
osg::ref_ptr< osg::Image > ur = readTile( urKey );
osg::ref_ptr< osg::Image > ll = readTile( llKey );
osg::ref_ptr< osg::Image > lr = readTile( lrKey );
if (ul.valid() && ur.valid() && ll.valid() && lr.valid())
{
//Merge them together
ImageMosaic mosaic;
mosaic.getImages().push_back( TileImage( ul.get(), ulKey ) );
mosaic.getImages().push_back( TileImage( ur.get(), urKey ) );
mosaic.getImages().push_back( TileImage( ll.get(), llKey ) );
mosaic.getImages().push_back( TileImage( lr.get(), lrKey ) );
osg::ref_ptr< osg::Image> merged = mosaic.createImage();
if (merged.valid())
{
//Resize the image so it's the same size as one of the input files
osg::ref_ptr<osg::Image> resized;
ImageUtils::resizeImage( merged.get(), ul->s(), ul->t(), resized );
std::string outputFilename = getFilename( key );
writeTile( key, resized.get() );
}
}
}
示例2: cacheTile
void
CacheSeed::processKey(const MapFrame& mapf, const TileKey& key ) const
{
unsigned int x, y, lod;
key.getTileXY(x, y);
lod = key.getLevelOfDetail();
bool gotData = true;
if ( _minLevel <= lod && _maxLevel >= lod )
{
gotData = cacheTile( mapf, key );
if (gotData)
{
incrementCompleted( 1 );
}
if ( _progress.valid() && _progress->isCanceled() )
return; // Task has been cancelled by user
if ( _progress.valid() && gotData && _progress->reportProgress(_completed, _total, std::string("Cached tile: ") + key.str()) )
return; // Canceled
}
if ( gotData && lod <= _maxLevel )
{
TileKey k0 = key.createChildKey(0);
TileKey k1 = key.createChildKey(1);
TileKey k2 = key.createChildKey(2);
TileKey k3 = key.createChildKey(3);
bool intersectsKey = false;
if (_extents.empty()) intersectsKey = true;
else
{
for (unsigned int i = 0; i < _extents.size(); ++i)
{
if (_extents[i].intersects( k0.getExtent() ) ||
_extents[i].intersects( k1.getExtent() ) ||
_extents[i].intersects( k2.getExtent() ) ||
_extents[i].intersects( k3.getExtent() ))
{
intersectsKey = true;
}
}
}
//Check to see if the bounds intersects ANY of the tile's children. If it does, then process all of the children
//for this level
if (intersectsKey)
{
processKey(mapf, k0);
processKey(mapf, k1);
processKey(mapf, k2);
processKey(mapf, k3);
}
}
}
示例3: processKey
void TileVisitor::processKey( const TileKey& key )
{
// If we've been cancelled then just return.
if (_progress && _progress->isCanceled())
{
return;
}
unsigned int x, y, lod;
key.getTileXY(x, y);
lod = key.getLevelOfDetail();
// Only process this key if it has a chance of succeeding.
if (_tileHandler && !_tileHandler->hasData(key))
{
return;
}
bool traverseChildren = false;
// If the key intersects the extent attempt to traverse
if (intersects( key.getExtent() ))
{
// If the lod is less than the min level don't do anything but do traverse the children.
if (lod < _minLevel)
{
traverseChildren = true;
}
else
{
// Process the key
traverseChildren = handleTile( key );
}
}
// Traverse the children
if (traverseChildren && lod < _maxLevel)
{
for (unsigned int i = 0; i < 4; i++)
{
TileKey k = key.createChildKey(i);
processKey( k );
}
}
}