本文整理汇总了C++中GeoExtent::area方法的典型用法代码示例。如果您正苦于以下问题:C++ GeoExtent::area方法的具体用法?C++ GeoExtent::area怎么用?C++ GeoExtent::area使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeoExtent
的用法示例。
在下文中一共展示了GeoExtent::area方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: seed
//.........这里部分代码省略.........
if ( !hasCaches )
{
OE_WARN << LC << "There are either no caches defined in the map, or no sources to cache; aborting." << std::endl;
return;
}
if ( src_max_level > 0 && src_max_level < _maxLevel )
{
_maxLevel = src_max_level;
}
OE_NOTICE << LC << "Maximum cache level will be " << _maxLevel << std::endl;
osg::Timer_t startTime = osg::Timer::instance()->tick();
//Estimate the number of tiles
_total = 0;
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
}
}