summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-11-01 16:14:28 (GMT)
committerFriedrich W. H. Kossebau <kossebau@kde.org>2016-11-05 16:49:29 (GMT)
commit8ab1bc70a0adcc7822d86fdce0c9d92247432358 (patch)
tree53046499ef6baf76218cd383b2126ab3fbcf600d
parentedc02a8eb9d49eada1f85b9039777e768b5ddd21 (diff)
Integrate way merging into the vector tile creation toolchain
- Simplify tag filtering - Fix memory leaks and ownership issues - Enable way merging for tile levels 11, 13, 15
-rw-r--r--tools/vectorosm-tilecreator/WayChunk.cpp24
-rw-r--r--tools/vectorosm-tilecreator/WayChunk.h15
-rw-r--r--tools/vectorosm-tilecreator/WayConcatenator.cpp247
-rw-r--r--tools/vectorosm-tilecreator/WayConcatenator.h29
-rw-r--r--tools/vectorosm-tilecreator/main.cpp10
5 files changed, 130 insertions, 195 deletions
diff --git a/tools/vectorosm-tilecreator/WayChunk.cpp b/tools/vectorosm-tilecreator/WayChunk.cpp
index fb8eb42..524d068 100644
--- a/tools/vectorosm-tilecreator/WayChunk.cpp
+++ b/tools/vectorosm-tilecreator/WayChunk.cpp
@@ -21,7 +21,7 @@
namespace Marble {
-WayChunk::WayChunk(GeoDataPlacemark *placemark, qint64 first, qint64 last)
+WayChunk::WayChunk(const PlacemarkPtr &placemark, qint64 first, qint64 last)
{
m_wayList.append(placemark);
m_first = first;
@@ -44,14 +44,14 @@ qint64 WayChunk::last() const
return m_last;
}
-void WayChunk::append(GeoDataPlacemark *placemark, qint64 last)
+void WayChunk::append(const PlacemarkPtr &placemark, qint64 last)
{
m_wayList.append(placemark);
m_last = last;
}
-void WayChunk::prepend(GeoDataPlacemark *placemark, qint64 first)
+void WayChunk::prepend(const PlacemarkPtr &placemark, qint64 first)
{
m_wayList.prepend(placemark);
m_first = first;
@@ -64,31 +64,29 @@ void WayChunk::append(WayChunk *chunk)
m_last = chunk->last();
}
-GeoDataPlacemark* WayChunk::merge()
+WayChunk::PlacemarkPtr WayChunk::merge()
{
Q_ASSERT(!m_wayList.isEmpty());
- GeoDataPlacemark *placemark = new GeoDataPlacemark(*(m_wayList.first()));
+ PlacemarkPtr placemark = PlacemarkPtr(new GeoDataPlacemark(*(m_wayList.first())));
GeoDataLineString *line = static_cast<GeoDataLineString*>(placemark->geometry());
- QList<GeoDataPlacemark*>::iterator itr = m_wayList.begin();
- QList<GeoDataPlacemark*>::iterator itrEnd = m_wayList.end();
+ QVector<PlacemarkPtr>::iterator itr = m_wayList.begin();
+ QVector<PlacemarkPtr>::iterator itrEnd = m_wayList.end();
++itr;
for (; itr != itrEnd; ++itr) {
GeoDataLineString *currentLine = static_cast<GeoDataLineString*>( (*itr)->geometry() );
currentLine->remove(0);
(*line) << *currentLine;
}
- //qDebug()<<"Merging placemark";
return placemark;
}
void WayChunk::reverse()
{
std::reverse(m_wayList.begin(), m_wayList.end());
- QList<GeoDataPlacemark*>::iterator itr = m_wayList.begin();
+ QVector<PlacemarkPtr>::iterator itr = m_wayList.begin();
for (; itr != m_wayList.end(); ++itr) {
- GeoDataPlacemark *placemark = *itr;
- GeoDataLineString *line = static_cast<GeoDataLineString*>(placemark->geometry());
+ GeoDataLineString *line = static_cast<GeoDataLineString*>((*itr)->geometry());
line->reverse();
}
qSwap(m_first, m_last);
@@ -101,7 +99,7 @@ qint64 WayChunk::id() const
void WayChunk::printIds() const
{
- QList<GeoDataPlacemark*>::const_iterator itr = m_wayList.begin();
+ QVector<PlacemarkPtr>::const_iterator itr = m_wayList.begin();
qDebug()<<"IDs of placemarks in chunk";
for (; itr != m_wayList.end(); ++itr) {
qDebug()<<"Id :- "<<(*itr)->osmData().id();
@@ -113,7 +111,7 @@ int WayChunk::size() const
return m_wayList.size();
}
-bool WayChunk::concatPossible(GeoDataPlacemark *placemark) const
+bool WayChunk::concatPossible(const PlacemarkPtr &placemark) const
{
const GeoDataPlacemark::GeoDataVisualCategory category = placemark->visualCategory();
return (category == m_visualCategory);
diff --git a/tools/vectorosm-tilecreator/WayChunk.h b/tools/vectorosm-tilecreator/WayChunk.h
index c92d88f..6b15ea9 100644
--- a/tools/vectorosm-tilecreator/WayChunk.h
+++ b/tools/vectorosm-tilecreator/WayChunk.h
@@ -21,18 +21,21 @@ class GeoDataPlacemark;
class WayChunk
{
+private:
+ typedef QSharedPointer<GeoDataPlacemark> PlacemarkPtr;
+
public:
- WayChunk(GeoDataPlacemark *placemark, qint64 first, qint64 last );
+ WayChunk(const PlacemarkPtr &placemark, qint64 first, qint64 last );
~WayChunk();
- void append(GeoDataPlacemark *placemark, qint64 last);
+ void append(const PlacemarkPtr &placemark, qint64 last);
void append(WayChunk *chunk);
- void prepend(GeoDataPlacemark *placemark, qint64 first);
+ void prepend(const PlacemarkPtr & placemark, qint64 first);
/*
* Creates a new placemark object by concatenating all the linsetrings which exist in the WayChunk
* Caller has the responsibility of deleting the object.
*/
- GeoDataPlacemark* merge();
+ PlacemarkPtr merge();
qint64 first() const;
qint64 last() const;
@@ -40,11 +43,11 @@ public:
qint64 id() const;
void printIds() const;
int size() const;
- bool concatPossible(GeoDataPlacemark *placemark) const;
+ bool concatPossible(const PlacemarkPtr &placemark) const;
GeoDataPlacemark::GeoDataVisualCategory visualCategory() const;
private:
- QList<GeoDataPlacemark*> m_wayList;
+ QVector<PlacemarkPtr> m_wayList;
qint64 m_first;
qint64 m_last;
GeoDataPlacemark::GeoDataVisualCategory m_visualCategory;
diff --git a/tools/vectorosm-tilecreator/WayConcatenator.cpp b/tools/vectorosm-tilecreator/WayConcatenator.cpp
index 8a5a7a0..b1d4f50 100644
--- a/tools/vectorosm-tilecreator/WayConcatenator.cpp
+++ b/tools/vectorosm-tilecreator/WayConcatenator.cpp
@@ -18,6 +18,7 @@
#include "GeoDataLineString.h"
#include "OsmPlacemarkData.h"
#include "StyleBuilder.h"
+#include "OsmObjectManager.h"
#include "WayConcatenator.h"
#include "WayChunk.h"
@@ -25,121 +26,75 @@
namespace Marble {
-WayConcatenator::WayConcatenator(GeoDataDocument *document, const QStringList &tagsList, bool andFlag) : TagsFilter(document, tagsList, andFlag)
+WayConcatenator::WayConcatenator(GeoDataDocument *document) :
+ BaseFilter(document),
+ m_originalWays(0),
+ m_mergedWays(0)
{
- qint64 count = 0;
- qint64 chunkCount = 0;
- qint64 newCount = 0;
- qint64 placemarkCount = 0;
-
- // qDebug()<<"** Number of TagFiletered placemarks "<< m_objects.size();
- foreach (GeoDataPlacemark* placemark, placemarks()) {
- qDebug()<<" ";
- ++placemarkCount;
- // qDebug()<<"No."<<plcCount;
+ typedef QSharedPointer<GeoDataPlacemark> PlacemarkPtr;
+ foreach (GeoDataPlacemark* original, placemarks()) {
+ PlacemarkPtr placemark = PlacemarkPtr(new GeoDataPlacemark(*original));
+ OsmObjectManager::initializeOsmData(placemark.data());
+ bool isWay = false;
if (placemark->geometry()->nodeType() == GeoDataTypes::GeoDataLineStringType) {
- qDebug()<<"-- Placemark ID : "<<placemark->osmData().id()<<" visualCategory: "<<StyleBuilder::visualCategoryName(placemark->visualCategory());
- GeoDataLineString *line = static_cast<GeoDataLineString*>(placemark->geometry());
- qint64 firstId = placemark->osmData().nodeReference(line->first()).id();
- qint64 lastId = placemark->osmData().nodeReference(line->last()).id();
-
- bool containsFirst = m_hash.contains(firstId);
- bool containsLast = m_hash.contains(lastId);
-
- if (!containsFirst && !containsLast) {
- qDebug()<<"No coords matched, creating a new chunk";
- createWayChunk(placemark, firstId, lastId);
- ++count;
- ++chunkCount;
- } else if (containsFirst && !containsLast) {
- qDebug()<<"First coord matched";
- WayChunk *chunk = wayChunk(placemark, firstId);
- if (chunk != nullptr) {
- // qDebug()<< "First* Chunk found, concatenating to it";
- concatFirst(placemark, chunk);
- } else {
- // qDebug()<<"";
- qDebug()<< "First* No possible chunk found, creating a new chunk";
- qDebug()<<"FirstId"<<firstId;
- qDebug()<<"lastId"<<lastId;
- // qDebug()<<"";
+ OsmPlacemarkData const & osmData = placemark->osmData();
+ if (osmData.containsTagKey("highway") || osmData.containsTagKey("railway")) {
+ isWay = true;
+ ++m_originalWays;
+ GeoDataLineString *line = static_cast<GeoDataLineString*>(placemark->geometry());
+ qint64 firstId = osmData.nodeReference(line->first()).id();
+ Q_ASSERT(firstId != 0);
+ qint64 lastId = osmData.nodeReference(line->last()).id();
+ Q_ASSERT(lastId != 0);
+
+ bool containsFirst = m_hash.contains(firstId);
+ bool containsLast = m_hash.contains(lastId);
+
+ if (!containsFirst && !containsLast) {
createWayChunk(placemark, firstId, lastId);
- ++chunkCount;
- ++newCount;
- }
- ++count;
- } else if (!containsFirst && containsLast) {
- qDebug()<<"Last coord matched";
- WayChunk *chunk = wayChunk(placemark, lastId);
- if (chunk != nullptr) {
- // qDebug()<< "Last* Chunk found, concatenating to it";
- concatLast(placemark, chunk);
- } else {
- // qDebug()<<"";
- qDebug()<< "Last* No possible chunk found, creating a new chunk";
- qDebug()<<"FirstId"<<firstId;
- qDebug()<<"lastId"<<lastId;
- // qDebug()<<"";
- createWayChunk(placemark, firstId, lastId);
- ++chunkCount;
- ++newCount;
- }
- ++count;
- } else if (containsFirst && containsLast) {
- qDebug()<<"Both coord matched";
- WayChunk *chunk = wayChunk(placemark, firstId);
- WayChunk *otherChunk = wayChunk(placemark, lastId);
-
- if (chunk != nullptr && otherChunk != nullptr) {
- // qDebug()<< "Both* Both chunks found, concatenating to it";
- if(chunk == otherChunk) {
- qDebug()<<"#### Both the chunks are same, directly adding to the list of placemarks";
- m_wayPlacemarks.append(*placemark);
+ } else if (containsFirst && !containsLast) {
+ WayChunk *chunk = wayChunk(placemark, firstId);
+ if (chunk != nullptr) {
+ concatFirst(placemark, chunk);
} else {
- concatBoth(placemark, chunk, otherChunk);
- ++count;
+ createWayChunk(placemark, firstId, lastId);
+ }
+ } else if (!containsFirst && containsLast) {
+ WayChunk *chunk = wayChunk(placemark, lastId);
+ if (chunk != nullptr) {
+ concatLast(placemark, chunk);
+ } else {
+ createWayChunk(placemark, firstId, lastId);
+ }
+ } else if (containsFirst && containsLast) {
+ WayChunk *chunk = wayChunk(placemark, firstId);
+ WayChunk *otherChunk = wayChunk(placemark, lastId);
+
+ if (chunk != nullptr && otherChunk != nullptr) {
+ if(chunk == otherChunk) {
+ m_wayPlacemarks.append(placemark);
+ } else {
+ concatBoth(placemark, chunk, otherChunk);
+ }
+ } else if(chunk != nullptr && otherChunk == nullptr) {
+ concatFirst(placemark, chunk);
+ } else if(chunk == nullptr && otherChunk != nullptr) {
+ concatLast(placemark, otherChunk);
+ } else {
+ createWayChunk(placemark, firstId, lastId);
}
- } else if(chunk != nullptr && otherChunk == nullptr) {
- // qDebug()<< "Both* First chunk found, concatenating to it";
- concatFirst(placemark, chunk);
- ++count;
- } else if(chunk == nullptr && otherChunk != nullptr) {
- // qDebug()<< "Both* Last chunk found, concatenating to it";
- concatLast(placemark, otherChunk);
- ++count;
- } else {
- // qDebug()<<"";
- qDebug()<< "Both* No possible chunk found, creating a new chunk";
- qDebug()<<"FirstId"<<firstId;
- qDebug()<<"lastId"<<lastId;
- // qDebug()<<"";
- createWayChunk(placemark, firstId, lastId);
- ++chunkCount;
- ++newCount;
- ++count;
- }
+ }
}
+ }
- // if(flag) {
- // qDebug()<<" Concat not possible";
- // m_wayPlacemarks.append(*placemark);
- // }
- } else{
- m_wayPlacemarks.append(*placemark);
+ if (!isWay) {
+ m_otherPlacemarks << new GeoDataPlacemark(*original);
}
}
- addRejectedPlacemarks();
+ prepareDocument();
addWayChunks();
- modifyDocument();
-
- qDebug()<<"####################################";
- qDebug()<<"Total OSM ways concatenated: "<<count;
- qDebug()<<"* Counted no. of chunks: "<<chunkCount;
- qDebug()<<"* Chunks formed due to no match"<<newCount;
- // qDebug()<<"Total reverses required: "<<rvr;
-
}
WayConcatenator::~WayConcatenator()
@@ -147,57 +102,47 @@ WayConcatenator::~WayConcatenator()
qDeleteAll(m_chunks);
}
-void WayConcatenator::addRejectedPlacemarks()
+int WayConcatenator::originalWays() const
{
- QVector<GeoDataPlacemark*>::const_iterator itr = rejectedObjectsBegin();
- QVector<GeoDataPlacemark*>::const_iterator endItr = rejectedObjectsEnd();
- for (; itr != endItr; ++itr) {
- m_wayPlacemarks << **itr;
- }
+ return m_originalWays;
+}
+
+int WayConcatenator::mergedWays() const
+{
+ return m_mergedWays;
}
void WayConcatenator::addWayChunks()
{
- qint64 totalSize = 0;
- QSet<WayChunk*> chunkSet;
- // QList<WayChunk*> chunkList = m_hash.values();
- // QList<WayChunk*>::iterator cItr = chunkList.begin();
- // qDebug()<<"* Chunk list size = "<<chunkList.size();
+ for (auto const &placemark: m_wayPlacemarks) {
+ document()->append(new GeoDataPlacemark(*placemark));
+ }
+ QSet<WayChunk*> chunkSet;
QVector<WayChunk*>::iterator itr = m_chunks.begin();
for (; itr != m_chunks.end(); ++itr) {
if (!chunkSet.contains(*itr)) {
+ ++m_mergedWays;
chunkSet.insert(*itr);
- GeoDataPlacemark* placemark = (*itr)->merge();
+ PlacemarkPtr placemark = (*itr)->merge();
if (placemark) {
- m_wayPlacemarks.append(*placemark);
- totalSize += (*itr)->size();
- qDebug()<<"Chunk:";
- (*itr)->printIds();
- qDebug()<<"Size of this chunk"<<(*itr)->size();
- qDebug()<<"Merged";
- qDebug()<<" ";
- delete placemark;
+ document()->append(new GeoDataPlacemark(*placemark));
}
}
}
- qDebug()<<"*** Total number of ways merged"<<totalSize;
- qDebug()<<"******* m_chunks vector size"<<m_chunks.size();
- // qDebug()<< "Entered 1";
+
+ m_chunks.clear();
}
-void WayConcatenator::modifyDocument()
+void WayConcatenator::prepareDocument()
{
document()->clear();
- QVector<GeoDataPlacemark>::iterator itr;
- itr = m_wayPlacemarks.begin();
- for (; itr != m_wayPlacemarks.end(); ++itr) {
- GeoDataPlacemark *placemark = new GeoDataPlacemark(*itr);
+ for (auto placemark: m_otherPlacemarks) {
document()->append(placemark);
}
}
-void WayConcatenator::createWayChunk(GeoDataPlacemark *placemark, qint64 firstId, qint64 lastId)
+void WayConcatenator::createWayChunk(const PlacemarkPtr &placemark, qint64 firstId, qint64 lastId)
{
WayChunk *chunk = new WayChunk(placemark, firstId, lastId);
m_hash.insert(firstId, chunk);
@@ -207,31 +152,21 @@ void WayConcatenator::createWayChunk(GeoDataPlacemark *placemark, qint64 firstId
m_chunks.append(chunk);
}
-WayChunk* WayConcatenator::wayChunk(GeoDataPlacemark *placemark, qint64 matchId) const
+WayChunk* WayConcatenator::wayChunk(const PlacemarkPtr &placemark, qint64 matchId) const
{
- qDebug()<<"Searching for a compatible WayChunk";
- qDebug()<<"Visual category for placemark"<<StyleBuilder::visualCategoryName(placemark->visualCategory());
-
QHash<qint64, WayChunk*>::ConstIterator matchItr = m_hash.find(matchId);
while (matchItr != m_hash.end() && matchItr.key() == matchId) {
WayChunk *chunk = matchItr.value();
- qDebug()<<" * Chunk ID: "<<chunk->id()<<" Visual category for chunk"<<StyleBuilder::visualCategoryName(chunk->visualCategory());
if (chunk->concatPossible(placemark)) {
- qDebug()<<"Match found";
return chunk;
}
++matchItr;
}
- qDebug()<<"### No Chunk found, returning nullptr";
return nullptr;
}
-void WayConcatenator::concatFirst(GeoDataPlacemark *placemark, WayChunk *chunk)
+void WayConcatenator::concatFirst(const PlacemarkPtr &placemark, WayChunk *chunk)
{
- qDebug()<<"First coord matched";
- qDebug()<<"Matched with: ";
- chunk->printIds();
-
GeoDataLineString *line = static_cast<GeoDataLineString*>(placemark->geometry());
qint64 firstId = placemark->osmData().nodeReference(line->first()).id();
qint64 lastId = placemark->osmData().nodeReference(line->last()).id();
@@ -244,24 +179,17 @@ void WayConcatenator::concatFirst(GeoDataPlacemark *placemark, WayChunk *chunk)
if (firstId == chunk->last()) {
//First node matches with an existing last node
- qDebug()<<"Appended chunk";
chunk->append(placemark, lastId);
} else {
//First node matches with an existing first node
//Reverse the GeoDataLineString of the placemark
line->reverse();
chunk->prepend(placemark, lastId);
- qDebug()<<"Reversed line and then prepended";
}
-
}
-void WayConcatenator::concatLast(GeoDataPlacemark *placemark, WayChunk *chunk)
+void WayConcatenator::concatLast(const PlacemarkPtr &placemark, WayChunk *chunk)
{
- qDebug()<<"Last coord matched";
- qDebug()<<"Matched with: ";
- chunk->printIds();
-
GeoDataLineString *line = static_cast<GeoDataLineString*>(placemark->geometry());
qint64 firstId = placemark->osmData().nodeReference(line->first()).id();
qint64 lastId = placemark->osmData().nodeReference(line->last()).id();
@@ -273,26 +201,15 @@ void WayConcatenator::concatLast(GeoDataPlacemark *placemark, WayChunk *chunk)
m_hash.insert(firstId, chunk);
if (lastId == chunk->first()) {
- qDebug()<<"Prepended chunk";
chunk->prepend(placemark, firstId);
} else {
line->reverse();
chunk->append(placemark, firstId);
- qDebug()<<"Reversed line and then appended";
}
-
}
-void WayConcatenator::concatBoth(GeoDataPlacemark *placemark, WayChunk *chunk, WayChunk *otherChunk)
+void WayConcatenator::concatBoth(const PlacemarkPtr &placemark, WayChunk *chunk, WayChunk *otherChunk)
{
-
- qDebug()<<" Concat possible";
- qDebug()<<"Inserting in the middle";
- qDebug()<<"Matched first coord with: ";
- chunk->printIds();
- qDebug()<<"Matched last coord with";
- otherChunk->printIds();
-
GeoDataLineString *line = static_cast<GeoDataLineString*>(placemark->geometry());
qint64 firstId = placemark->osmData().nodeReference(line->first()).id();
qint64 lastId = placemark->osmData().nodeReference(line->last()).id();
@@ -310,7 +227,6 @@ void WayConcatenator::concatBoth(GeoDataPlacemark *placemark, WayChunk *chunk, W
chunk->append(placemark, lastId);
if (lastId == otherChunk->last()) {
- qDebug()<<" otherChunk reversed";
otherChunk->reverse();
}
chunk->append(otherChunk);
@@ -326,7 +242,6 @@ void WayConcatenator::concatBoth(GeoDataPlacemark *placemark, WayChunk *chunk, W
m_hash.insert(otherChunk->last(), chunk);
m_chunks.removeOne(otherChunk);
-
}
}
diff --git a/tools/vectorosm-tilecreator/WayConcatenator.h b/tools/vectorosm-tilecreator/WayConcatenator.h
index 338e979..ae05048 100644
--- a/tools/vectorosm-tilecreator/WayConcatenator.h
+++ b/tools/vectorosm-tilecreator/WayConcatenator.h
@@ -18,25 +18,34 @@ namespace Marble {
class WayChunk;
-class WayConcatenator : public TagsFilter
+class WayConcatenator: public BaseFilter
{
+private:
+ typedef QSharedPointer<GeoDataPlacemark> PlacemarkPtr;
+
public:
- WayConcatenator(GeoDataDocument *document, const QStringList &tagsList, bool andFlag = false);
+ WayConcatenator(GeoDataDocument *document);
~WayConcatenator();
+ int originalWays() const;
+ int mergedWays() const;
+
private:
- void createWayChunk(GeoDataPlacemark *placemark, qint64 firstId, qint64 lastId);
- WayChunk* wayChunk(GeoDataPlacemark *placemark, qint64 matchId) const;
- void concatFirst(GeoDataPlacemark *placemark, WayChunk *chunk);
- void concatLast(GeoDataPlacemark *placemark, WayChunk *chunk);
- void concatBoth(GeoDataPlacemark *placemark, WayChunk *chunk, WayChunk *otherChunk);
- void addRejectedPlacemarks();
+ void createWayChunk(const PlacemarkPtr &placemark, qint64 firstId, qint64 lastId);
+ WayChunk* wayChunk(const PlacemarkPtr &placemark, qint64 matchId) const;
+ void concatFirst(const PlacemarkPtr &placemark, WayChunk *chunk);
+ void concatLast(const PlacemarkPtr & placemark, WayChunk *chunk);
+ void concatBoth(const PlacemarkPtr &placemark, WayChunk *chunk, WayChunk *otherChunk);
void addWayChunks();
- void modifyDocument();
+ void prepareDocument();
QMultiHash<qint64, WayChunk*> m_hash;
QVector<WayChunk*> m_chunks;
- QVector<GeoDataPlacemark> m_wayPlacemarks;
+ QVector<PlacemarkPtr> m_wayPlacemarks;
+ QVector<GeoDataPlacemark*> m_otherPlacemarks;
+
+ int m_originalWays;
+ int m_mergedWays;
};
}
diff --git a/tools/vectorosm-tilecreator/main.cpp b/tools/vectorosm-tilecreator/main.cpp
index d542cbd..f17a2fa 100644
--- a/tools/vectorosm-tilecreator/main.cpp
+++ b/tools/vectorosm-tilecreator/main.cpp
@@ -266,6 +266,13 @@ int main(int argc, char *argv[])
typedef QSharedPointer<GeoDataDocument> GeoDocPtr;
GeoDocPtr tile1 = GeoDocPtr(mapTiles.clip(zoomLevel, tileId.x(), tileId.y()));
TagsFilter::removeAnnotationTags(tile1.data());
+ int originalWays = 0;
+ int mergedWays = 0;
+ if (zoomLevel < 17) {
+ WayConcatenator concatenator(tile1.data());
+ originalWays = concatenator.originalWays();
+ mergedWays = concatenator.mergedWays();
+ }
GeoDocPtr tile2 = GeoDocPtr(loader.clip(zoomLevel, tileId.x(), tileId.y()));
GeoDocPtr combined = GeoDocPtr(mergeDocuments(tile1.data(), tile2.data()));
NodeReducer nodeReducer(combined.data(), zoomLevel);
@@ -295,6 +302,9 @@ int main(int argc, char *argv[])
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) << "%";
+ if (originalWays > 0) {
+ std::cout << " , " << originalWays << " ways merged to " << mergedWays;
+ }
std::cout << " \r";
std::cout.flush();
}