summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-09-04 17:45:02 (GMT)
committerDennis Nienhüser <nienhueser@kde.org>2016-09-04 17:45:02 (GMT)
commit3439995ac12215e62a007aa2179bff6ab1c21333 (patch)
tree94369cc853d181dce32b2ea8b92c2e4f52b788e9
parentcbc023b24f8f9ae11d3f87eb30c91e8ddcf4073c (diff)
More meaningful node reduction statistics
-rw-r--r--tools/vectorosm-tilecreator/NodeReducer.cpp7
-rw-r--r--tools/vectorosm-tilecreator/NodeReducer.h6
2 files changed, 9 insertions, 4 deletions
diff --git a/tools/vectorosm-tilecreator/NodeReducer.cpp b/tools/vectorosm-tilecreator/NodeReducer.cpp
index e297623..09eb49f 100644
--- a/tools/vectorosm-tilecreator/NodeReducer.cpp
+++ b/tools/vectorosm-tilecreator/NodeReducer.cpp
@@ -24,7 +24,8 @@ namespace Marble {
NodeReducer::NodeReducer(GeoDataDocument* document, int zoomLevel) :
PlacemarkFilter(document),
m_resolution(resolutionForLevel(zoomLevel)),
- m_count(0)
+ m_removedNodes(0),
+ m_remainingNodes(0)
{
// nothing to do
}
@@ -62,7 +63,9 @@ void NodeReducer::process()
placemark->setGeometry(reducedPolygon);
}
}
- qDebug()<<"Total nodes reduced: "<<m_count<<endl;
+ double const reduction = m_removedNodes / qMax(1.0, double(m_remainingNodes + m_removedNodes));
+ qDebug() << QString("Total nodes reduced: %1%").arg(QString("%1").arg(reduction * 100.0, 0, 'f', 1))
+ << "(" << m_removedNodes << "removed," << m_remainingNodes << "remaining)";
}
qreal NodeReducer::resolutionForLevel(int level) {
diff --git a/tools/vectorosm-tilecreator/NodeReducer.h b/tools/vectorosm-tilecreator/NodeReducer.h
index 7ea64f6..9d22de2 100644
--- a/tools/vectorosm-tilecreator/NodeReducer.h
+++ b/tools/vectorosm-tilecreator/NodeReducer.h
@@ -45,7 +45,8 @@ private:
reducedLine->append(*iter);
qint64 reducedSize = reducedLine->size();
- m_count += (prevSize - reducedSize);
+ m_removedNodes += (prevSize - reducedSize);
+ m_remainingNodes += reducedSize;
return reducedLine;
//qDebug()<<"Nodes reduced "<<(prevSize - reducedSize)<<endl;
}
@@ -53,7 +54,8 @@ private:
static qreal resolutionForLevel(int level);
qreal m_resolution;
- qint64 m_count;
+ qint64 m_removedNodes;
+ qint64 m_remainingNodes;
};
}