本文整理汇总了C++中TileSource::hasDataAtLOD方法的典型用法代码示例。如果您正苦于以下问题:C++ TileSource::hasDataAtLOD方法的具体用法?C++ TileSource::hasDataAtLOD怎么用?C++ TileSource::hasDataAtLOD使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TileSource
的用法示例。
在下文中一共展示了TileSource::hasDataAtLOD方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: seed
//.........这里部分代码省略.........
for (unsigned int level = _minLevel; level <= _maxLevel; level++)
{
double coverageRatio = 0.0;
if (_extents.empty())
{
unsigned int wide, high;
map->getProfile()->getNumTiles( level, wide, high );
_total += (wide * high);
}
else
{
for (std::vector< GeoExtent >::const_iterator itr = _extents.begin(); itr != _extents.end(); itr++)
{
const GeoExtent& extent = *itr;
double boundsArea = extent.area();
TileKey ll = map->getProfile()->createTileKey(extent.xMin(), extent.yMin(), level);
TileKey ur = map->getProfile()->createTileKey(extent.xMax(), extent.yMax(), level);
int tilesWide = ur.getTileX() - ll.getTileX() + 1;
int tilesHigh = ll.getTileY() - ur.getTileY() + 1;
int tilesAtLevel = tilesWide * tilesHigh;
//OE_NOTICE << "Tiles at level " << level << "=" << tilesAtLevel << std::endl;
bool hasData = false;
for (ImageLayerVector::const_iterator itr = mapf.imageLayers().begin(); itr != mapf.imageLayers().end(); itr++)
{
TileSource* src = itr->get()->getTileSource();
if (src)
{
if (src->hasDataAtLOD( level ))
{
//Compute the percent coverage of this dataset on the current extent
if (src->getDataExtents().size() > 0)
{
double cov = 0.0;
for (unsigned int j = 0; j < src->getDataExtents().size(); j++)
{
GeoExtent b = src->getDataExtents()[j].transform( extent.getSRS());
GeoExtent intersection = b.intersectionSameSRS( extent );
if (intersection.isValid())
{
double coverage = intersection.area() / boundsArea;
cov += coverage; //Assumes the extents aren't overlapping
}
}
if (coverageRatio < cov) coverageRatio = cov;
}
else
{
//We have no way of knowing how much coverage we have
coverageRatio = 1.0;
}
hasData = true;
break;
}
}
}
for (ElevationLayerVector::const_iterator itr = mapf.elevationLayers().begin(); itr != mapf.elevationLayers().end(); itr++)
{
TileSource* src = itr->get()->getTileSource();
if (src)
示例2: assembleImageFromTileSource
GeoImage
ImageLayer::createImageFromTileSource(const TileKey& key,
ProgressCallback* progress,
bool forceFallback,
bool& out_isFallback)
{
// Results:
//
// * return an osg::Image matching the key extent is all goes well;
//
// * return NULL to indicate that the key exceeds the maximum LOD of the source data,
// and that the engine may need to generate a "fallback" tile if necessary;
//
// deprecated:
// * return an "empty image" if the LOD is valid BUT the key does not intersect the
// source's data extents.
out_isFallback = false;
TileSource* source = getTileSource();
if ( !source )
return GeoImage::INVALID;
// If the profiles are different, use a compositing method to assemble the tile.
if ( !key.getProfile()->isEquivalentTo( getProfile() ) )
{
return assembleImageFromTileSource( key, progress, out_isFallback );
}
// Fail is the image is blacklisted.
// ..unless there will be a fallback attempt.
if ( source->getBlacklist()->contains( key.getTileId() ) && !forceFallback )
{
OE_DEBUG << LC << "createImageFromTileSource: blacklisted(" << key.str() << ")" << std::endl;
return GeoImage::INVALID;
}
// Fail if no data is available for this key.
if ( !source->hasDataAtLOD( key.getLevelOfDetail() ) && !forceFallback )
{
OE_DEBUG << LC << "createImageFromTileSource: hasDataAtLOD(" << key.str() << ") == false" << std::endl;
return GeoImage::INVALID;
}
if ( !source->hasDataInExtent( key.getExtent() ) )
{
OE_DEBUG << LC << "createImageFromTileSource: hasDataInExtent(" << key.str() << ") == false" << std::endl;
return GeoImage::INVALID;
}
// Good to go, ask the tile source for an image:
osg::ref_ptr<TileSource::ImageOperation> op = _preCacheOp;
osg::ref_ptr<osg::Image> result;
TileKey finalKey = key;
bool fellBack = false;
if ( forceFallback )
{
while( !result.valid() && finalKey.valid() )
{
if ( !source->getBlacklist()->contains( finalKey.getTileId() ) )
{
result = source->createImage( finalKey, op.get(), progress );
if ( result.valid() )
{
if ( finalKey.getLevelOfDetail() != key.getLevelOfDetail() )
{
// crop the fallback image to match the input key, and ensure that it remains the
// same pixel size; because chances are if we're requesting a fallback that we're
// planning to mosaic it later, and the mosaicer requires same-size images.
GeoImage raw( result.get(), finalKey.getExtent() );
GeoImage cropped = raw.crop( key.getExtent(), true, raw.getImage()->s(), raw.getImage()->t(), *_runtimeOptions.driver()->bilinearReprojection() );
result = cropped.takeImage();
fellBack = true;
}
}
}
if ( !result.valid() )
{
finalKey = finalKey.createParentKey();
out_isFallback = true;
}
}
if ( !result.valid() )
{
result = 0L;
//result = _emptyImage.get();
finalKey = key;
}
}
else
{
result = source->createImage( key, op.get(), progress );
}
// Process images with full alpha to properly support MP blending.
if ( result != 0L )
//.........这里部分代码省略.........