Skip to content

v0.2.50..v0.2.51 changeset BuildingMerger.h

Garret Voltz edited this page Jan 15, 2020 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/conflate/polygon/BuildingMerger.h b/hoot-core/src/main/cpp/hoot/core/conflate/polygon/BuildingMerger.h
index 4cfdecd..221760f 100644
--- a/hoot-core/src/main/cpp/hoot/core/conflate/polygon/BuildingMerger.h
+++ b/hoot-core/src/main/cpp/hoot/core/conflate/polygon/BuildingMerger.h
@@ -38,8 +38,6 @@ namespace hoot
 
 /**
  * Merges two or more buildings
- *
- * This guy could maybe use some refactoring now.
  */
 class BuildingMerger : public MergerBase
 {
@@ -102,6 +100,9 @@ public:
   void setKeepMoreComplexGeometryWhenAutoMerging(bool keepMoreComplex)
   { _keepMoreComplexGeometryWhenAutoMerging = keepMoreComplex; }
   void setMergeManyToManyMatches(bool merge) { _mergeManyToManyMatches = merge; }
+  void setUseChangedReview(bool use) { _useChangedReview = use; }
+  void setChangedReviewIouThreshold(double threshold) { _changedReviewIouThreshold = threshold; }
+  QString getMarkedReviewText() const { return _markedReviewText; }
 
 protected:
 
@@ -110,6 +111,8 @@ protected:
 
 private:
 
+  friend class BuildingMergerTest;
+
   std::set<std::pair<ElementId, ElementId>> _pairs;
 
   //If true, merging always keeps the more complex of the two building geometries.  If false,
@@ -120,6 +123,13 @@ private:
   bool _mergeManyToManyMatches;
   // set to true if the current building merge involves two buildings, each part of multiple matches
   bool _manyToManyMatch;
+  // This allows for trigger a "changed" review, where if two buildings match but their IoU score
+  // falls below a certain threshold then we'll flag them to be reviewed.
+  bool _useChangedReview;
+  // threshold used with _useChangedReview
+  double _changedReviewIouThreshold;
+  // records if this merger marked the input pair for review instead of merging them
+  QString _markedReviewText;
 
   /*
    * Creates a building out of the current set of building element IDs
@@ -131,6 +141,15 @@ private:
    */
   std::shared_ptr<Element> _buildBuilding(const OsmMapPtr& map, const bool unknown1) const;
 
+  /*
+   * Determine which of two buildings is more complex, using node count as a surrogate for
+   * complexity
+   */
+  ElementId _getIdOfMoreComplexBuilding(
+    const ElementPtr& building1, const ElementPtr& building2, const OsmMapPtr& map) const;
+
+  Tags _getMergedTags(const ElementPtr& e1, const ElementPtr& e2);
+
   QSet<ElementId> _getMultiPolyMemberIds(const ConstElementPtr& element) const;
   void _removeRedundantAltTypeTags(Tags& tags);
   static void _fixStatuses(OsmMapPtr map);
Clone this wiki locally