本文整理汇总了C++中Progress::Debug方法的典型用法代码示例。如果您正苦于以下问题:C++ Progress::Debug方法的具体用法?C++ Progress::Debug怎么用?C++ Progress::Debug使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Progress
的用法示例。
在下文中一共展示了Progress::Debug方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Import
//.........这里部分代码省略.........
if (level==l) {
//
// Renormated coordinate space (everything is >=0)
//
minLon+=180;
maxLon+=180;
minLat+=90;
maxLat+=90;
//
// Calculate minimum and maximum tile ids that are covered
// by the area
//
uint32_t minyc=(uint32_t)floor(minLat/cellHeight[level]);
uint32_t maxyc=(uint32_t)ceil(maxLat/cellHeight[level]);
uint32_t minxc=(uint32_t)floor(minLon/cellWidth[level]);
uint32_t maxxc=(uint32_t)ceil(maxLon/cellWidth[level]);
Entry entry;
entry.type=area.GetType()->GetId();
entry.offset=offset;
// Add this area to the tile where the center of the area lies in.
leafs[Pixel((minxc+maxxc)/2,(minyc+maxyc)/2)].areas.push_back(entry);
areaLevelEntries++;
areasConsumed++;
}
}
}
progress.Debug(std::string("Writing ")+NumberToString(leafs.size())+" leafs ("+
NumberToString(areaLevelEntries)+") "+
"to index of level "+NumberToString(l)+"...");
// Remember the offset of one cell in level '0'
if (l==0) {
if (!writer.GetPos(topLevelOffset)) {
progress.Error("Cannot read top level entry offset");
return false;
}
}
/*
uint32_t minX=std::numeric_limits<uint32_t>::max();
uint32_t minY=std::numeric_limits<uint32_t>::max();
uint32_t maxX=std::numeric_limits<uint32_t>::min();
uint32_t maxY=std::numeric_limits<uint32_t>::min();
std::map<TypeId,size_t> useMap;
for (std::map<Pixel,AreaLeaf>::const_iterator leaf=leafs.begin();
leaf!=leafs.end();
++leaf) {
minX=std::min(minX,leaf->first.x);
maxX=std::max(maxX,leaf->first.x);
minY=std::min(minY,leaf->first.y);
maxY=std::max(maxY,leaf->first.y);
for (std::list<Entry>::const_iterator entry=leaf->second.areas.begin();
entry!=leaf->second.areas.end();
entry++) {
std::map<TypeId,size_t>::iterator u=useMap.find(entry->type);
if (u==useMap.end()) {
useMap[entry->type]=1;
}
else {
u->second++;
}
}
}*/
/*
std::cout << "[" << minX << "-" << maxX << "]x[" << minY << "-" << maxY << "] => " << leafs.size() << "/" << (maxX-minX+1)*(maxY-minY+1) << " " << (int)BytesNeededToAddressFileData(leafs.size()) << " " << ByteSizeToString(BytesNeededToAddressFileData(leafs.size())*(maxX-minX+1)*(maxY-minY+1)) << std::endl;
for (std::map<TypeId,size_t>::const_iterator u=useMap.begin();
u!=useMap.end();
++u) {
std::cout << "* " << u->first << " " << typeConfig.GetTypeInfo(u->first).GetName() << " " << u->second << std::endl;
}*/
if (!WriteIndexLevel(parameter,
writer,
(int)l,
leafs)) {
return false;
}
l--;
}
writer.SetPos(topLevelOffsetOffset);
writer.WriteFileOffset(topLevelOffset);
return !writer.HasError() && writer.Close();
}
示例2: RemoveDuplicateNodes
bool WayNodeReductionProcessorFilter::RemoveDuplicateNodes(Progress& progress,
const FileOffset& offset,
Way& way,
bool& save)
{
unsigned char buffers[2][coordByteSize];
bool reduced=false;
if (way.nodes.size()>=2) {
size_t lastIndex=0;
size_t currentIndex=1;
nodeBuffer.clear();
idBuffer.clear();
// Prefill with the first coordinate
way.nodes[0].EncodeToBuffer(buffers[0]);
nodeBuffer.push_back(way.nodes[0]);
if (!way.ids.empty()) {
idBuffer.push_back(way.ids[0]);
}
for (size_t n=1; n<way.nodes.size(); n++) {
way.nodes[n].EncodeToBuffer(buffers[currentIndex]);
if (IsEqual(buffers[lastIndex],
buffers[currentIndex])) {
if (n>=way.ids.size() ||
way.ids[n]==0) {
duplicateCount++;
reduced=true;
}
else if ((n-1)>=way.ids.size() ||
way.ids[n-1]==0) {
way.ids[n-1]=way.ids[n];
duplicateCount++;
reduced=true;
}
else {
nodeBuffer.push_back(way.nodes[n]);
if (n<way.ids.size()) {
idBuffer.push_back(way.ids[n]);
}
lastIndex=currentIndex;
currentIndex=(lastIndex+1)%2;
}
}
else {
nodeBuffer.push_back(way.nodes[n]);
if (n<way.ids.size()) {
idBuffer.push_back(way.ids[n]);
}
lastIndex=currentIndex;
currentIndex=(lastIndex+1)%2;
}
}
}
if (reduced) {
if (nodeBuffer.size()<2) {
progress.Debug("Way " + NumberToString(offset) + " empty/invalid after node reduction");
save=false;
return true;
}
else {
way.nodes=nodeBuffer;
way.ids=idBuffer;
}
}
return true;
}
示例3: HandleAreas
bool OptimizeAreasLowZoomGenerator::HandleAreas(const ImportParameter& parameter,
Progress& progress,
const TypeConfig& typeConfig,
FileWriter& writer,
const TypeInfoSet& types,
std::list<TypeData>& typesData)
{
FileScanner scanner;
// Everything smaller than 2mm should get dropped. Width, height and DPI come from the Nexus 4
double dpi=320.0;
double pixel=2.0/* mm */ * dpi / 25.4 /* inch */;
progress.Info("Minimum visible size in pixel: "+NumberToString((unsigned long)pixel));
try {
scanner.Open(AppendFileToDir(parameter.GetDestinationDirectory(),
AreaDataFile::AREAS_DAT),
FileScanner::Sequential,
parameter.GetWayDataMemoryMaped());
TypeInfoSet typesToProcess(types);
std::vector<std::list<AreaRef> > allAreas(typeConfig.GetTypeCount());
while (true) {
//
// Load type data
//
TypeInfoSet loadedTypes;
if (!GetAreas(typeConfig,
parameter,
progress,
scanner,
typesToProcess,
allAreas,
loadedTypes)) {
return false;
}
typesToProcess.Remove(loadedTypes);
for (const auto& type : loadedTypes) {
progress.SetAction("Optimizing type "+ type->GetName());
for (uint32_t level=parameter.GetOptimizationMinMag();
level<=parameter.GetOptimizationMaxMag();
level++) {
Magnification magnification; // Magnification, we optimize for
std::list<AreaRef> optimizedAreas;
magnification.SetLevel(level);
OptimizeAreas(allAreas[type->GetIndex()],
optimizedAreas,
1280,768,
dpi,
pixel,
magnification,
parameter.GetOptimizationWayMethod());
if (optimizedAreas.empty()) {
progress.Debug("Empty optimization result for level "+NumberToString(level)+", no index generated");
TypeData typeData;
typeData.type=type;
typeData.optLevel=level;
typesData.push_back(typeData);
continue;
}
progress.Info("Optimized from "+NumberToString(allAreas[type->GetIndex()].size())+" to "+NumberToString(optimizedAreas.size())+" areas");
/*
size_t optAreas=optimizedAreas.size();
size_t optRoles=0;
size_t optNodes=0;
for (std::list<AreaRef>::const_iterator a=optimizedAreas.begin();
a!=optimizedAreas.end();
++a) {
AreaRef area=*a;
optRoles+=area->rings.size();
for (size_t r=0; r<area->rings.size(); r++) {
optNodes+=area->rings[r].nodes.size();
}
}*/
/*
std::cout << "Areas: " << origAreas << " => " << optAreas << std::endl;
std::cout << "Roles: " << origRoles << " => " << optRoles << std::endl;
std::cout << "Nodes: " << origNodes << " => " << optNodes << std::endl;*/
TypeData typeData;
//.........这里部分代码省略.........