-
Notifications
You must be signed in to change notification settings - Fork 74
v0.2.54..v0.2.55 changeset Way.h
Garret Voltz edited this page Aug 14, 2020
·
1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/elements/Way.h b/hoot-core/src/main/cpp/hoot/core/elements/Way.h
index 74cb24a..d9d1269 100644
--- a/hoot-core/src/main/cpp/hoot/core/elements/Way.h
+++ b/hoot-core/src/main/cpp/hoot/core/elements/Way.h
@@ -104,7 +104,8 @@ public:
/**
* Returns the same result as getEnvelopeInternal, but copied so the caller gets ownership.
*/
- virtual geos::geom::Envelope* getEnvelope(const std::shared_ptr<const ElementProvider>& ep) const override
+ virtual geos::geom::Envelope* getEnvelope(
+ const std::shared_ptr<const ElementProvider>& ep) const override
{ return new geos::geom::Envelope(getEnvelopeInternal(ep)); }
/**
@@ -121,9 +122,17 @@ public:
int getNodeIndex(long nodeId) const;
long getFirstNodeId() const { return getNodeId(0); }
-
long getLastNodeId() const { return getNodeId(getNodeCount() - 1); }
+ /**
+ * Determines if an index is the first or las
+ *
+ * @param index index to examine
+ * @return true if the index is extreme; false otherwise
+ */
+ bool isExtremeIndex(const int index) const
+ { return index == 0 || index == (int)getNodeCount() - 1; }
+
size_t getNodeCount() const { return _wayData->getNodeIds().size(); }
long getNodeId(int index) const { return _wayData->getNodeIds()[index]; }
@@ -181,13 +190,28 @@ public:
void reverseOrder();
/**
- * Determines if two ways have the same node IDs
+ * Determines if two ways have the same nodes
+ *
+ * @param other way to compare with
+ * @return true if the other way has the same nodes in the same order as this way; false otherwise
+ */
+ bool hasSameNodes(const Way& other) const;
+
+ /**
+ * Determines if two ways share the same node
*
- * @param other way to compare node IDs with
- * @return true if the other way has the same node IDs in the same order as this way; false
- * otherwise
+ * @param other way to compare with
+ * @return true if the other way shares at least one node with this way; false otherwise
*/
- bool hasSameNodeIds(const Way& other) const;
+ bool hasSharedNode(const Way& other) const;
+
+ /**
+ * Retrieves the IDs of shared nodes between two ways
+ *
+ * @param other way to compare with
+ * @return a collection of node IDs
+ */
+ QSet<long> sharedNodeIds(const Way& other) const;
/**
* This is rarely used. Primarily it is useful when loading the way from a file that does
@@ -198,7 +222,6 @@ public:
QString toString() const;
virtual void visitRo(const ElementProvider& map, ConstElementVisitor& filter) const;
-
virtual void visitRw(ElementProvider& map, ConstElementVisitor& filter);
/**