summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-10-03 12:28:47 (GMT)
committerDennis Nienhüser <nienhueser@kde.org>2016-10-03 12:41:12 (GMT)
commitf4530d81d984b02df492fa66a1bc4446e9b70706 (patch)
tree32d8b769afa6bba58d66be7fc957c26cfbc0a3e6
parent081d2950f7e7a7f587b76191386e4b1047e798a7 (diff)
Use progress bar output for high level tiles as well
-rw-r--r--tools/vectorosm-tilecreator/TileDirectory.cpp4
-rw-r--r--tools/vectorosm-tilecreator/TileDirectory.h3
-rw-r--r--tools/vectorosm-tilecreator/main.cpp10
3 files changed, 9 insertions, 8 deletions
diff --git a/tools/vectorosm-tilecreator/TileDirectory.cpp b/tools/vectorosm-tilecreator/TileDirectory.cpp
index 340f461..c28194f 100644
--- a/tools/vectorosm-tilecreator/TileDirectory.cpp
+++ b/tools/vectorosm-tilecreator/TileDirectory.cpp
@@ -267,11 +267,11 @@ void TileDirectory::download(const QString &url, const QString &target)
cout << endl;
}
-void TileDirectory::printProgress(double progress, int barWidth) const
+void TileDirectory::printProgress(double progress, int barWidth)
{
int const position = barWidth * progress;
cout << " [" << string(position, '=') << ">";
- cout << string(barWidth-position, ' ') << "] " << int(progress * 100.0) << "%";
+ cout << string(barWidth-position, ' ') << "] " << std::right << setw(3) << int(progress * 100.0) << "%";
}
GeoDataLatLonBox TileDirectory::boundingBox() const
diff --git a/tools/vectorosm-tilecreator/TileDirectory.h b/tools/vectorosm-tilecreator/TileDirectory.h
index c2d4f2c..9f985e1 100644
--- a/tools/vectorosm-tilecreator/TileDirectory.h
+++ b/tools/vectorosm-tilecreator/TileDirectory.h
@@ -72,6 +72,8 @@ public:
void createTiles() const;
bool contains(const TileId &tile) const;
+ static void printProgress(double progress, int barWidth=40);
+
private Q_SLOTS:
void updateProgress();
void handleFinishedDownload(const QString &filename, const QString &id);
@@ -80,7 +82,6 @@ private:
QStringList tagsFilteredIn(int zoomLevel) const;
void setTagZoomLevel(int zoomLevel);
void download(const QString &url, const QString &target);
- void printProgress(double progress, int barWidth=40) const;
QString m_cacheDir;
QString m_baseDir;
diff --git a/tools/vectorosm-tilecreator/main.cpp b/tools/vectorosm-tilecreator/main.cpp
index a81d257..768a502 100644
--- a/tools/vectorosm-tilecreator/main.cpp
+++ b/tools/vectorosm-tilecreator/main.cpp
@@ -235,10 +235,9 @@ int main(int argc, char *argv[])
}
}
- std::cout << "Tile " << count << "/" << total << " (landmass ";
- std::cout << loader.name().toStdString() << " + map ";
- std::cout << mapTiles.name().toStdString() << " ~> ";
- std::cout << combined->name().toStdString() << ") done.";
+ TileDirectory::printProgress(count / double(total));
+ std::cout << " Tile " << count << "/" << total << " (";
+ std::cout << combined->name().toStdString() << ").";
double const reduction = nodeReducer.removedNodes() / qMax(1.0, double(nodeReducer.remainingNodes() + nodeReducer.removedNodes()));
std::cout << " Node reduction: " << qRound(reduction * 100.0) << "%";
std::cout << " \r";
@@ -248,8 +247,9 @@ int main(int argc, char *argv[])
delete tile2;
}
}
+ TileDirectory::printProgress(1.0);
+ std::cout << " Vector OSM tiles complete." << std::string(30, ' ') << std::endl;
}
return 0;
}
-