Skip to content

v0.2.52..v0.2.53 changeset PoiPolygonMatchCreator.h

Garret Voltz edited this page Feb 12, 2020 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/conflate/poi-polygon/PoiPolygonMatchCreator.h b/hoot-core/src/main/cpp/hoot/core/conflate/poi-polygon/PoiPolygonMatchCreator.h
index 3e04a3a..fa6a725 100644
--- a/hoot-core/src/main/cpp/hoot/core/conflate/poi-polygon/PoiPolygonMatchCreator.h
+++ b/hoot-core/src/main/cpp/hoot/core/conflate/poi-polygon/PoiPolygonMatchCreator.h
@@ -22,7 +22,7 @@
  * This will properly maintain the copyright information. DigitalGlobe
  * copyrights will be updated automatically.
  *
- * @copyright Copyright (C) 2016, 2017, 2018, 2019 DigitalGlobe (http://www.digitalglobe.com/)
+ * @copyright Copyright (C) 2016, 2017, 2018, 2019, 2020 DigitalGlobe (http://www.digitalglobe.com/)
  */
 #ifndef POIPOLYGONMATCHCREATOR_H
 #define POIPOLYGONMATCHCREATOR_H
@@ -34,7 +34,7 @@
 #include <hoot/core/conflate/poi-polygon/PoiPolygonRfClassifier.h>
 #include <hoot/core/criterion/poi-polygon/PoiPolygonPoiCriterion.h>
 #include <hoot/core/criterion/poi-polygon/PoiPolygonPolyCriterion.h>
-#include <hoot/core/conflate/poi-polygon/PoiPolygonCache.h>
+#include <hoot/core/conflate/poi-polygon/PoiPolygonInfoCache.h>
 
 namespace hoot
 {
@@ -69,6 +69,8 @@ public:
 
   virtual std::shared_ptr<MatchThreshold> getMatchThreshold() override;
 
+  virtual QString getName() const { return QString::fromStdString(className()); }
+
 private:
 
   std::shared_ptr<MatchThreshold> _matchThreshold;
@@ -79,7 +81,50 @@ private:
   PoiPolygonPoiCriterion _poiCrit;
   PoiPolygonPolyCriterion _polyCrit;
 
-  PoiPolygonCachePtr _infoCache;
+  PoiPolygonInfoCachePtr _infoCache;
+
+  /*
+   * For any 2:1 matches/reviews, will only keep the match with the smallest distance between
+   * matched features
+   */
+  int _retainClosestDistanceMatchesOnly(
+    std::vector<ConstMatchPtr>& matches, const ConstOsmMapPtr& map);
+  /*
+   * Called by _retainClosestDistanceMatchesOnly; 2:1 POI to poly and 2:1 polyl to POI matches are
+   * processed separately
+   */
+  int _retainClosestDistanceMatchesOnlyByType(
+    std::vector<ConstMatchPtr>& matches, const ConstOsmMapPtr& map, const bool processPois);
+
+  /*
+   * Organizes matches with key=element's ID and value=match its associated with; one
+   * element may be involved in more than one match
+   */
+  QMultiMap<ElementId, ConstMatchPtr> _indexMatchesById(
+    const std::vector<ConstMatchPtr>& matches, const QString& matchTypeStr);
+
+  /*
+   * Finds all instances where an element is involved in more than one match; returns a collection
+   * with the element's ID and all the matches its involved with
+   */
+  QMap<ElementId, QList<ConstMatchPtr>> _getOverlappingMatches(
+    const QMultiMap<ElementId, ConstMatchPtr>& matchesById, const QString& matchTypeStr);
+
+  /*
+   * Cycles through each overlapping match and keeps only the single match associated with each
+   * element that has the shortest distance between POI and polygon
+   */
+  std::vector<ConstMatchPtr> _filterOutNonClosestMatches(
+    const QMap<ElementId, QList<ConstMatchPtr>>& overlappingMatches,
+    const std::vector<ConstMatchPtr>& allMatches, const ConstOsmMapPtr& map,
+    const QString& matchTypeStr);
+
+  //debugging only methods
+  bool _containsMatch(
+    const ElementId& elementId1, const ElementId& elementId2,
+    const std::vector<ConstMatchPtr>& matches) const;
+  int _numMatchesContainingElement(const ElementId& elementId,
+                                   const std::vector<ConstMatchPtr>& matches) const;
 };
 
 }
Clone this wiki locally