Skip to content

v0.2.54..v0.2.55 changeset UnconnectedWaySnapper.h

Garret Voltz edited this page Aug 14, 2020 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/ops/UnconnectedWaySnapper.h b/hoot-core/src/main/cpp/hoot/core/ops/UnconnectedWaySnapper.h
index 6518ed0..58c3062 100644
--- a/hoot-core/src/main/cpp/hoot/core/ops/UnconnectedWaySnapper.h
+++ b/hoot-core/src/main/cpp/hoot/core/ops/UnconnectedWaySnapper.h
@@ -33,6 +33,7 @@
 #include <hoot/core/ops/OsmMapOperation.h>
 #include <hoot/core/criterion/ElementCriterion.h>
 #include <hoot/core/util/Configurable.h>
+#include <hoot/core/conflate/review/ReviewMarker.h>
 
 // Tgs
 #include <tgs/RStarTree/HilbertRTree.h>
@@ -52,6 +53,9 @@ namespace hoot
  * should focus on trying to fix the lack of snapping in the conflation routines themselves rather
  * than relying on this as a cleanup utility.
  *
+ * Additionally, this class can be configured to mark any snapped roads as needing review or mark
+ * them for review without snapping them.
+ *
  * *Possible* future enhancements:
  *
  * - If a way is snapped to another way and the ways end up being parallel and overlap, snapping
@@ -119,10 +123,12 @@ public:
   void setSnapWayStatuses(const QStringList& statuses);
   void setSnapToWayStatuses(const QStringList& statuses);
   void setMarkSnappedWays(bool mark) { _markSnappedWays = mark; }
+  void setReviewSnappedWays(bool review) { _reviewSnappedWays = review; }
+  void setMarkOnly(bool markOnly) { _markOnly = markOnly; }
 
   /**
-   * @brief snapClosestEndpointToWay Finds the closest endpont on 'disconnected' and snaps it to
-   *   the closest node in 'connectTo'
+   * Finds the closest endpont on 'disconnected' and snaps it to the closest node in 'connectTo'
+   *
    * @param map Map containing ways
    * @param disconnected Disconnected way that needs to be connected
    * @param connectTo Way to connect the disconnected way to
@@ -133,16 +139,14 @@ public:
 
   virtual std::string getClassName() const { return className(); }
 
-protected:
+private:
+
+  friend class UnconnectedWaySnapperTest;
 
   // if true, will attempt to snap nodes to existing way nodes instead of adding them to the way as
   // a new way node
   bool _snapToExistingWayNodes;
 
-private:
-
-  friend class UnconnectedWaySnapperTest;
-
   // furthest away a way node can be from a unconnected node for us to consider snapping to it
   double _maxNodeReuseDistance;
   // furthest away a way can be from a unconnected node for us to consider snapping to it
@@ -156,6 +160,10 @@ private:
   bool _markSnappedNodes;
   // allow for optionally tagging snapped ways; useful for debugging
   bool _markSnappedWays;
+  // mark anything snapped as needing review
+  bool _reviewSnappedWays;
+  // don't actually snap ways; this allows for marking w/o snapping
+  bool _markOnly;
 
   // the feature criterion to be used for way snap target candidates
   QString _wayToSnapToCriterionClassName;
@@ -185,6 +193,7 @@ private:
   int _taskStatusUpdateInterval;
   OsmMapPtr _map;
   Settings _conf;
+  ReviewMarker _reviewMarker;
 
   /*
    * The radius around the end node to look for ways to snap to.
@@ -262,24 +271,27 @@ private:
    */
   bool _snapUnconnectedNodeToWay(const NodePtr& nodeToSnap);
 
-  /**
-   * @brief _snapUnconnectedNodeToWay Snap a particular node into a way at its closest intersecting
-   * point
+  /*
+   * Snap a particular node into a way at its closest intersecting point
+   *
    * @param nodeToSnap Node to snap/add into the way
    * @param wayToSnapTo Way to connect/add the node into
    * @return True if successful
    */
   bool _snapUnconnectedNodeToWay(const NodePtr& nodeToSnap, const WayPtr& wayToSnapTo);
 
-  /**
-   * @brief snapClosestEndpointToWay Finds the closest endpont on 'disconnected' and snaps it to
-   *   the closest node in 'connectTo'
+  /*
+   * Finds the closest endpont on 'disconnected' and snaps it to the closest node in 'connectTo'
+   *
    * @param disconnected Disconnected way that needs to be connected
    * @param connectTo Way to connect the disconnected way to
    * @return True if successful
    */
   bool _snapClosestEndpointToWay(const WayPtr& disconnected, const WayPtr& connectTo);
 
+  void _markSnappedWay(const long idOfNodeBeingSnapped);
+  void _reviewSnappedWay(const long idOfNodeBeingSnapped);
+
   /*
    * @see WayJoinerAdvanced
    */
Clone this wiki locally