summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-10-04 18:51:14 (GMT)
committerDennis Nienhüser <nienhueser@kde.org>2016-10-04 19:09:45 (GMT)
commit55e24cdac3d0daf79389562975e718dc8801dace (patch)
tree057a2b7494080d31c800a15b1558da9b25bb38f6
parent98d069f88f2da028d10e70ecf989c08d98a4e3ae (diff)
Re-enable node reduction for levels below 17
Still needs a proper Douglas-Peucker like implementation in the future.
-rw-r--r--tools/vectorosm-tilecreator/NodeReducer.cpp53
1 files changed, 25 insertions, 28 deletions
diff --git a/tools/vectorosm-tilecreator/NodeReducer.cpp b/tools/vectorosm-tilecreator/NodeReducer.cpp
index 1c620e9..19ca4b0 100644
--- a/tools/vectorosm-tilecreator/NodeReducer.cpp
+++ b/tools/vectorosm-tilecreator/NodeReducer.cpp
@@ -29,43 +29,40 @@ NodeReducer::NodeReducer(GeoDataDocument* document, int zoomLevel) :
m_removedNodes(0),
m_remainingNodes(0)
{
+ /*
+ * @todo FIXME distance based reduction is too simple for polygons, needs sth like Douglas-Peucker
+ */
+
foreach (GeoDataPlacemark* placemark, placemarks()) {
GeoDataGeometry const * const geometry = placemark->geometry();
-
if(geometry->nodeType() == GeoDataTypes::GeoDataLineStringType) {
GeoDataLineString const * prevLine = static_cast<GeoDataLineString const *>(geometry);
GeoDataLineString* reducedLine = new GeoDataLineString;
reduce(prevLine, placemark->osmData(), reducedLine);
placemark->setGeometry(reducedLine);
- }
-
- /*
- * @todo FIXME distance based reduction is too simple for polygons, needs sth like Douglas-Peucker
- *
- else if(geometry->nodeType() == GeoDataTypes::GeoDataLinearRingType) {
- GeoDataLinearRing const * prevRing = static_cast<GeoDataLinearRing const *>(geometry);
- GeoDataLinearRing* reducedRing = new GeoDataLinearRing;
- reduce(prevRing, reducedRing);
- placemark->setGeometry(reducedRing);
- }
-
- else if(geometry->nodeType() == GeoDataTypes::GeoDataPolygonType) {
- GeoDataPolygon* reducedPolygon = new GeoDataPolygon;
- GeoDataPolygon const * prevPolygon = static_cast<GeoDataPolygon const *>(geometry);
- GeoDataLinearRing const * prevRing = &(prevPolygon->outerBoundary());
- GeoDataLinearRing reducedRing;
- reduce(prevRing, &reducedRing);
- reducedPolygon->setOuterBoundary(reducedRing);
- QVector<GeoDataLinearRing> const & innerBoundaries = prevPolygon->innerBoundaries();
- for(int i = 0; i < innerBoundaries.size(); i++) {
- prevRing = &innerBoundaries[i];
- GeoDataLinearRing reducedInnerRing;
- reduce(prevRing, &reducedInnerRing);
- reducedPolygon->appendInnerBoundary(reducedInnerRing);
+ } else if (zoomLevel < 17) {
+ if(geometry->nodeType() == GeoDataTypes::GeoDataLinearRingType) {
+ GeoDataLinearRing const * prevRing = static_cast<GeoDataLinearRing const *>(geometry);
+ GeoDataLinearRing* reducedRing = new GeoDataLinearRing;
+ reduce(prevRing, placemark->osmData(), reducedRing);
+ placemark->setGeometry(reducedRing);
+ } else if(geometry->nodeType() == GeoDataTypes::GeoDataPolygonType) {
+ GeoDataPolygon* reducedPolygon = new GeoDataPolygon;
+ GeoDataPolygon const * prevPolygon = static_cast<GeoDataPolygon const *>(geometry);
+ GeoDataLinearRing const * prevRing = &(prevPolygon->outerBoundary());
+ GeoDataLinearRing reducedRing;
+ reduce(prevRing, placemark->osmData(), &reducedRing);
+ reducedPolygon->setOuterBoundary(reducedRing);
+ QVector<GeoDataLinearRing> const & innerBoundaries = prevPolygon->innerBoundaries();
+ for(int i = 0; i < innerBoundaries.size(); i++) {
+ prevRing = &innerBoundaries[i];
+ GeoDataLinearRing reducedInnerRing;
+ reduce(prevRing, placemark->osmData(), &reducedInnerRing);
+ reducedPolygon->appendInnerBoundary(reducedInnerRing);
+ }
+ placemark->setGeometry(reducedPolygon);
}
- placemark->setGeometry(reducedPolygon);
}
- */
}
}