Skip to content

v0.2.47..v0.2.48 changeset WayJoinerAdvanced.h

Garret Voltz edited this page Sep 27, 2019 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/algorithms/WayJoinerAdvanced.h b/hoot-core/src/main/cpp/hoot/core/algorithms/WayJoinerAdvanced.h
index 662295b..d18e0f7 100644
--- a/hoot-core/src/main/cpp/hoot/core/algorithms/WayJoinerAdvanced.h
+++ b/hoot-core/src/main/cpp/hoot/core/algorithms/WayJoinerAdvanced.h
@@ -56,7 +56,7 @@ public:
   WayJoinerAdvanced();
 
   /**
-   * Static method to join all joinable ways using WayJoinerBasic
+   * Static method to join all joinable ways using WayJoinerAdvanced
    */
   static void joinWays(const OsmMapPtr& map);
 
@@ -65,34 +65,49 @@ public:
    */
   virtual void join(const OsmMapPtr& map) override;
 
-protected:
-
   /**
-   * @brief joinParentChild Simplest joining algorithm that joins a way with a parent id to that
-   * parent
+   * @see ApiEntityInfo
    */
-  virtual void _joinParentChild() override;
+  virtual QString getDescription() const override
+  { return "Extends WayJoinerBasic with additional join pre-conditions."; }
 
-  /**
-   * @brief joinAtNode Joining algorithm that searches all ways that have a parent id and tries
-   *    to join them with adjacent ways that have the same tags
-   */
+protected:
+
+  // identifies the way in the join pair whose ID was kep after the join
+  WayPtr _wayKeptAfterJoin;
+  // the name of the class implementation being executed
+  QString _callingClass;
+
+  virtual void _joinParentChild() override;
   virtual void _joinAtNode() override;
+  virtual void _rejoinSiblings(std::deque<long>& way_ids) override;
+  virtual bool _joinWays(const WayPtr& parent, const WayPtr& child) override;
 
-  /**
-   * @brief rejoinSiblings Function that rejoins ways that all have the same parent id
-   *    but that parent way doesn't exist
-   * @param way_ids Deque of sorted ways to join
+  /*
+   * Determines which feature's tags are kept during a way join
    */
-  virtual void _rejoinSiblings(std::deque<long>& way_ids) override;
+  virtual void _determineKeeperFeatureForTags(WayPtr parent, WayPtr child, WayPtr& keeper,
+                                              WayPtr& toRemove) const;
 
-  /**
-   * @brief joinWays Function to rejoin two ways
-   * @param parent Way that is modified to include the child way
-   * @param child Way that will be merged into the parent and then deleted
-   * @return true if the two ways were joined; false otherwise
+  /*
+   * Determine which feature's ID is kept during a way join
    */
-  virtual bool _joinWays(const WayPtr& parent, const WayPtr& child) override;
+  virtual void _determineKeeperFeatureForId(WayPtr parent, WayPtr child, WayPtr& keeper,
+                                            WayPtr& toRemove) const;
+
+  /*
+   * These accessors have been added to appease the ReplacementSnappedWayJoiner used by
+   * ChangesetReplacementCreator. Without them there is difficulty in tracking provenance of
+   * modified ways. I believe with some further work they eventually can go away (see related
+   * method in UnconnectedWaySnapper as well.
+   */
+  virtual bool _hasPid(const ConstWayPtr& way) const;
+  virtual long _getPid(const ConstWayPtr& way) const;
+
+private:
+
+  // name of the method calling into _jointAtNode
+  QString _callingMethod;
 
   /**
    * A more aggressive joining approach that tries to join up any unnamed generic roads in the
@@ -101,8 +116,6 @@ protected:
    */
   void _joinUnsplitWaysAtNode();
 
-  void _determineKeeperFeature(WayPtr parent, WayPtr child, WayPtr& keeper, WayPtr& toRemove);
-
   bool _handleOneWayStreetReversal(WayPtr wayWithTagsToKeep, ConstWayPtr wayWithTagsToLose);
 
   double _getTotalLengthFromTags(const Tags& tags1, const Tags& tags2) const;
Clone this wiki locally