summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-11-12 09:29:37 (GMT)
committerDennis Nienhüser <nienhueser@kde.org>2016-11-12 09:38:18 (GMT)
commitfd535e6b3e11be92f9ca88fc12a3346a34a45af3 (patch)
treead6dab9f6867d4ad270b740e93f7a66d7e68b091
parent1426a625e23c6e103b4700d7d5617fb1f8c999cb (diff)
Drop explicit last node in a ring if it is a duplicate one
-rw-r--r--src/plugins/runner/osm/OsmWay.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/plugins/runner/osm/OsmWay.cpp b/src/plugins/runner/osm/OsmWay.cpp
index 98dedbe..0367d69 100644
--- a/src/plugins/runner/osm/OsmWay.cpp
+++ b/src/plugins/runner/osm/OsmWay.cpp
@@ -30,8 +30,9 @@ void OsmWay::create(GeoDataDocument *document, const OsmNodes &nodes, QSet<qint6
if (isArea()) {
GeoDataLinearRing linearRing;
-
- foreach(qint64 nodeId, m_references) {
+ bool const stripLastNode = m_references.first() == m_references.last();
+ for (int i=0, n=m_references.size() - (stripLastNode ? 1 : 0); i<n; ++i) {
+ qint64 nodeId = m_references[i];
auto const nodeIter = nodes.constFind(nodeId);
if (nodeIter == nodes.constEnd()) {
return;