Skip to content

v0.2.49..v0.2.50 changeset RemoveDuplicateWayNodesVisitor.cpp

Garret Voltz edited this page Nov 6, 2019 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/visitors/RemoveDuplicateWayNodesVisitor.cpp b/hoot-core/src/main/cpp/hoot/core/visitors/RemoveDuplicateWayNodesVisitor.cpp
index 44a7ada..fba9de6 100644
--- a/hoot-core/src/main/cpp/hoot/core/visitors/RemoveDuplicateWayNodesVisitor.cpp
+++ b/hoot-core/src/main/cpp/hoot/core/visitors/RemoveDuplicateWayNodesVisitor.cpp
@@ -30,6 +30,7 @@
 // Hoot
 #include <hoot/core/elements/Way.h>
 #include <hoot/core/util/Factory.h>
+#include <hoot/core/util/Log.h>
 
 // Qt
 #include <QVector>
@@ -43,6 +44,12 @@ RemoveDuplicateWayNodesVisitor::RemoveDuplicateWayNodesVisitor()
 {
 }
 
+void RemoveDuplicateWayNodesVisitor::removeDuplicates(const WayPtr& way)
+{
+  RemoveDuplicateWayNodesVisitor vis;
+  vis.visit(way);
+}
+
 void RemoveDuplicateWayNodesVisitor::visit(const ElementPtr& e)
 {
   if (e->getElementType() == ElementType::Way)
@@ -63,21 +70,20 @@ void RemoveDuplicateWayNodesVisitor::visit(const ElementPtr& e)
       LOG_VART(nodeId);
       if (!parsedNodeIds.contains(nodeId))
       {
-        //we haven't seen this node ID yet
+        // we haven't seen this node ID yet
         LOG_TRACE("Valid way node: " << nodeId);
         parsedNodeIds.append(nodeId);
       }
       else if (i == wayNodeIds.size() -1 && nodeId == parsedNodeIds.at(0))
       {
-        //this node ID is duplicated, but its the end node duplicating the start node, which is ok
-        //(closed way)
+        // this node ID is duplicated, but its the end node duplicating the start node, which is ok
+        // (closed way)
         LOG_TRACE("End node matches start node: " << nodeId);
         parsedNodeIds.append(nodeId);
       }
       else
       {
-        //we've found a duplicate where both nodes aren't start and end nodes...shouldn't ever
-        //happen
+        // we've found a duplicate where both nodes aren't start and end nodes...not allowed
         LOG_TRACE("Found duplicate way node: " << nodeId);
         duplicateWayNodeIds.append(nodeId);
         foundDuplicateWayNode = true;
Clone this wiki locally