Skip to content

v0.2.54..v0.2.55 changeset Way.cpp

Garret Voltz edited this page Aug 14, 2020 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/elements/Way.cpp b/hoot-core/src/main/cpp/hoot/core/elements/Way.cpp
index 4616863..d67b953 100644
--- a/hoot-core/src/main/cpp/hoot/core/elements/Way.cpp
+++ b/hoot-core/src/main/cpp/hoot/core/elements/Way.cpp
@@ -475,9 +475,21 @@ long Way::getPid(long p, long c)
   else                                  return WayData::PID_EMPTY;
 }
 
-bool Way::hasSameNodeIds(const Way& other) const
+bool Way::hasSameNodes(const Way& other) const
 {
   return getNodeIds() == other.getNodeIds();
 }
 
+QSet<long> Way::sharedNodeIds(const Way& other) const
+{
+  QSet<long> nodes = QVector<long>::fromStdVector(getNodeIds()).toList().toSet();
+  QSet<long> otherNodes = QVector<long>::fromStdVector(other.getNodeIds()).toList().toSet();
+  return nodes.intersect(otherNodes);
+}
+
+bool Way::hasSharedNode(const Way& other) const
+{
+  return sharedNodeIds(other).size() > 0;
+}
+
 }
Clone this wiki locally