本文整理汇总了C++中Progress::Warning方法的典型用法代码示例。如果您正苦于以下问题:C++ Progress::Warning方法的具体用法?C++ Progress::Warning怎么用?C++ Progress::Warning使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Progress
的用法示例。
在下文中一共展示了Progress::Warning方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FitsIndexCriteria
bool AreaWayIndexGenerator::FitsIndexCriteria(const ImportParameter& parameter,
Progress& progress,
const TypeInfo& typeInfo,
const TypeData& typeData,
const CoordCountMap& cellFillCount)
{
if (typeData.indexCells==0) {
return true;
}
size_t entryCount=0;
size_t max=0;
for (CoordCountMap::const_iterator cell=cellFillCount.begin();
cell!=cellFillCount.end();
++cell) {
entryCount+=cell->second;
max=std::max(max,cell->second);
}
// Average number of entries per tile cell
double average=entryCount*1.0/cellFillCount.size();
// If the fill rate of the index is too low, we use this index level anyway
if (typeData.indexCells/(1.0*typeData.cellXCount*typeData.cellYCount)<=
parameter.GetAreaWayIndexMinFillRate()) {
progress.Warning(typeInfo.GetName()+" ("+NumberToString(typeInfo.GetId())+") is not well distributed");
return true;
}
// If average fill size and max fill size for tile cells
// is within limits, store it now.
if (max<=parameter.GetAreaWayIndexCellSizeMax() &&
average<=parameter.GetAreaWayIndexCellSizeAverage()) {
return true;
}
return false;
}
示例2: Import
//.........这里部分代码省略.........
++cell) {
nodeTypeData[i].indexEntries+=cell->second;
nodeTypeData[i].cellXStart=std::min(nodeTypeData[i].cellXStart,cell->first.x);
nodeTypeData[i].cellXEnd=std::max(nodeTypeData[i].cellXEnd,cell->first.x);
nodeTypeData[i].cellYStart=std::min(nodeTypeData[i].cellYStart,cell->first.y);
nodeTypeData[i].cellYEnd=std::max(nodeTypeData[i].cellYEnd,cell->first.y);
}
}
nodeTypeData[i].cellXCount=nodeTypeData[i].cellXEnd-nodeTypeData[i].cellXStart+1;
nodeTypeData[i].cellYCount=nodeTypeData[i].cellYEnd-nodeTypeData[i].cellYStart+1;
// Count absolute number of entries
for (std::map<Pixel,size_t>::const_iterator cell=cellFillCount[i].begin();
cell!=cellFillCount[i].end();
++cell) {
entryCount+=cell->second;
max=std::max(max,cell->second);
}
// Average number of entries per tile cell
double average=entryCount*1.0/cellFillCount[i].size();
// If we do not have any entries, we store it now
if (cellFillCount[i].empty()) {
continue;
}
// If the fill rate of the index is too low, we use this index level anyway
if (nodeTypeData[i].indexCells/(1.0*nodeTypeData[i].cellXCount*nodeTypeData[i].cellYCount)<=
parameter.GetAreaNodeIndexMinFillRate()) {
progress.Warning(typeConfig.GetTypeInfo(i).GetName()+" ("+NumberToString(i)+") is not well distributed");
continue;
}
// If average fill size and max fill size for tile cells
// is within limits, store it now.
if (max<=parameter.GetAreaNodeIndexCellSizeMax() &&
average<=parameter.GetAreaNodeIndexCellSizeAverage()) {
continue;
}
// else, we remove it from the list and try again with an higher
// level.
currentNodeTypes.erase(i);
}
}
// Now process all types for this limit, that are within the limits
for (std::set<TypeId>::const_iterator cnt=currentNodeTypes.begin();
cnt!=currentNodeTypes.end();
cnt++) {
maxLevel=std::max(maxLevel,level);
progress.Info("Type "+typeConfig.GetTypeInfo(*cnt).GetName()+"(" + NumberToString(*cnt)+"), "+NumberToString(nodeTypeData[*cnt].indexCells)+" cells, "+NumberToString(nodeTypeData[*cnt].indexEntries)+" objects");
remainingNodeTypes.erase(*cnt);
}
level++;
}
//
// Writing index file
示例3: FitsIndexCriteria
bool AreaWayIndexGenerator::FitsIndexCriteria(const ImportParameter& /*parameter*/,
Progress& progress,
const TypeInfo& typeInfo,
const TypeData& typeData,
const CoordCountMap& cellFillCount) const
{
if (typeData.indexCells==0) {
return true;
}
size_t overallCount=0;
size_t maxCellCount=0;
for (const auto& cell : cellFillCount) {
overallCount+=cell.second;
maxCellCount=std::max(maxCellCount,cell.second);
}
// Average number of entries per tile cell
double average=overallCount*1.0/cellFillCount.size();
size_t emptyCount=0;
size_t toLowCount=0;
size_t toHighCount=0;
size_t inCount=0;
size_t allCount=0;
for (const auto& cell : cellFillCount) {
if (cell.second==0) {
emptyCount++;
}
else if (cell.second<0.4*average) {
toLowCount++;
}
else if (cell.second>128){
toHighCount++;
}
else {
inCount++;
}
allCount++;
}
if (toHighCount*1.0/allCount>=0.05) {
return false;
}
if (toLowCount*1.0/allCount>=0.2) {
progress.Warning(typeInfo.GetName()+" has more than 20% cells with <40% of average filling ("+NumberToString(toLowCount)+"/"+NumberToString(allCount)+")");
}
/*
// If the fill rate of the index is too low, we use this index level anyway
if (fillRate<parameter.GetAreaWayIndexMinFillRate()) {
progress.Warning(typeInfo.GetName()+" is not well distributed");
return true;
}
// If average fill size and max fill size for tile cells
// is within limits, store it now.
if (maxCellCount<=parameter.GetAreaWayIndexCellSizeMax() &&
average<=parameter.GetAreaWayIndexCellSizeAverage()) {
return true;
}*/
return true;
}