Commit 3439995a authored by Dennis Nienhüser's avatar Dennis Nienhüser
Browse files

More meaningful node reduction statistics

parent cbc023b2
......@@ -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) {
......
......@@ -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;
};
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment