本文整理汇总了C++中ImportParameter::GetOptimizationCellSizeMax方法的典型用法代码示例。如果您正苦于以下问题:C++ ImportParameter::GetOptimizationCellSizeMax方法的具体用法?C++ ImportParameter::GetOptimizationCellSizeMax怎么用?C++ ImportParameter::GetOptimizationCellSizeMax使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImportParameter
的用法示例。
在下文中一共展示了ImportParameter::GetOptimizationCellSizeMax方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetAreaIndexLevel
void OptimizeAreasLowZoomGenerator::GetAreaIndexLevel(const ImportParameter& parameter,
const std::list<AreaRef>& areas,
TypeData& typeData)
{
size_t level=5;//parameter.GetOptimizationMinMag();
while (true) {
std::map<Pixel,size_t> cellFillCount;
for (const auto& area : areas) {
GeoBox boundingBox;
area->GetBoundingBox(boundingBox);
//
// Calculate minimum and maximum tile ids that are covered
// by the way
// Renormated coordinate space (everything is >=0)
//
uint32_t minxc=(uint32_t)floor((boundingBox.GetMinLon()+180.0)/cellDimension[level].width);
uint32_t maxxc=(uint32_t)floor((boundingBox.GetMaxLon()+180.0)/cellDimension[level].width);
uint32_t minyc=(uint32_t)floor((boundingBox.GetMinLat()+90.0)/cellDimension[level].height);
uint32_t maxyc=(uint32_t)floor((boundingBox.GetMaxLat()+90.0)/cellDimension[level].height);
for (uint32_t y=minyc; y<=maxyc; y++) {
for (uint32_t x=minxc; x<=maxxc; x++) {
cellFillCount[Pixel(x,y)]++;
}
}
}
// Check if cell fill for current type is in defined limits
size_t entryCount=0;
size_t max=0;
for (std::map<Pixel,size_t>::const_iterator cell=cellFillCount.begin();
cell!=cellFillCount.end();
++cell) {
entryCount+=cell->second;
max=std::max(max,cell->second);
}
double average=entryCount*1.0/cellFillCount.size();
if (!(max>parameter.GetOptimizationCellSizeMax() ||
average>parameter.GetOptimizationCellSizeAverage())) {
typeData.indexLevel=(uint32_t)level;
typeData.indexCells=cellFillCount.size();
typeData.indexEntries=0;
if (!cellFillCount.empty()) {
typeData.cellXStart=cellFillCount.begin()->first.x;
typeData.cellYStart=cellFillCount.begin()->first.y;
typeData.cellXEnd=typeData.cellXStart;
typeData.cellYEnd=typeData.cellYStart;
for (std::map<Pixel,size_t>::const_iterator cell=cellFillCount.begin();
cell!=cellFillCount.end();
++cell) {
typeData.indexEntries+=cell->second;
typeData.cellXStart=std::min(typeData.cellXStart,cell->first.x);
typeData.cellXEnd=std::max(typeData.cellXEnd,cell->first.x);
typeData.cellYStart=std::min(typeData.cellYStart,cell->first.y);
typeData.cellYEnd=std::max(typeData.cellYEnd,cell->first.y);
}
}
typeData.cellXCount=typeData.cellXEnd-typeData.cellXStart+1;
typeData.cellYCount=typeData.cellYEnd-typeData.cellYStart+1;
return;
}
level++;
}
}