Skip to content

v0.2.52..v0.2.53 changeset PoiPolygonMatch.h

Garret Voltz edited this page Feb 12, 2020 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/conflate/poi-polygon/PoiPolygonMatch.h b/hoot-core/src/main/cpp/hoot/core/conflate/poi-polygon/PoiPolygonMatch.h
index dac29a5..52721d0 100644
--- a/hoot-core/src/main/cpp/hoot/core/conflate/poi-polygon/PoiPolygonMatch.h
+++ b/hoot-core/src/main/cpp/hoot/core/conflate/poi-polygon/PoiPolygonMatch.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 POIPOLYGONMATCH_H
 #define POIPOLYGONMATCH_H
@@ -43,10 +43,7 @@
 #include <hoot/core/util/Configurable.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>
-
-// Qt
-#include <QElapsedTimer>
+#include <hoot/core/conflate/poi-polygon/PoiPolygonInfoCache.h>
 
 namespace hoot
 {
@@ -64,14 +61,15 @@ public:
 
   static std::string className() { return "hoot::PoiPolygonMatch"; }
 
+  static const QString MATCH_NAME;
+
   PoiPolygonMatch();
   // this constructor added primarily for testing purposes
   PoiPolygonMatch(ConstMatchThresholdPtr threshold);
   PoiPolygonMatch(const ConstOsmMapPtr& map, ConstMatchThresholdPtr threshold,
     std::shared_ptr<const PoiPolygonRfClassifier> rf,
-    PoiPolygonCachePtr infoCache,
-    const std::set<ElementId>& polyNeighborIds = std::set<ElementId>(),
-    const std::set<ElementId>& poiNeighborIds = std::set<ElementId>());
+    PoiPolygonInfoCachePtr infoCache = PoiPolygonInfoCachePtr(),
+    const std::set<ElementId>& polyNeighborIds = std::set<ElementId>());
 
   virtual void setConfiguration(const Settings& conf) override;
 
@@ -79,16 +77,19 @@ public:
 
   virtual const MatchClassification& getClassification() const override { return _class; }
 
-  virtual MatchMembers getMatchMembers() const override { return MatchMembers::Poi | MatchMembers::Polygon; }
+  virtual MatchMembers getMatchMembers() const override
+  { return MatchMembers::Poi | MatchMembers::Polygon; }
 
-  virtual QString getMatchName() const override { return _matchName; }
+  virtual QString getMatchName() const override { return getPoiPolygonMatchName(); }
+  static QString getPoiPolygonMatchName() { return MATCH_NAME; }
 
   virtual std::set<std::pair<ElementId, ElementId>> getMatchPairs() const override;
 
   virtual double getProbability() const override { return _class.getMatchP(); }
 
   // Is the right implementation for this?
-  virtual bool isConflicting(const ConstMatchPtr& /*other*/, const ConstOsmMapPtr& /*map*/) const override
+  virtual bool isConflicting(const ConstMatchPtr& /*other*/,
+                             const ConstOsmMapPtr& /*map*/) const override
   { return false; }
 
   virtual bool isWholeGroup() const override { return true; }
@@ -118,7 +119,6 @@ public:
   void setNameScoreThreshold(const double threshold);
   void setTypeScoreThreshold(const double threshold);
   void setReviewIfMatchedTypes(const QStringList& types);
-  void setEnableAdvancedMatching(const bool enabled) { _enableAdvancedMatching = enabled; }
   void setEnableReviewReduction(const bool enabled) { _enableReviewReduction = enabled; }
   void setMatchEvidenceThreshold(const int threshold) { _matchEvidenceThreshold = threshold; }
   void setReviewEvidenceThreshold(const int threshold) { _reviewEvidenceThreshold = threshold; }
@@ -152,8 +152,6 @@ private:
 
   friend class PoiPolygonMergerCreatorTest;
 
-  static QString _matchName;
-
   ConstOsmMapPtr _map;
 
   ElementId _eid1;
@@ -174,7 +172,8 @@ private:
   double _distance;
   //max distance allowed between the elements where they can be considered a distance match
   double _matchDistanceThreshold;
-  //max distance allowed between the elements where they can be considered for review
+  // max distance allowed between the elements where they can be considered for review; note: this
+  // possibly should be renamed to search distance
   double _reviewDistanceThreshold;
   double _reviewDistancePlusCe;
   //true if the distance between the elements, given CE, is within the review distance; absolute
@@ -183,7 +182,7 @@ private:
 
   // should be able to shrink some of this scorer code down with some abstraction
 
-  PoiPolygonTypeScoreExtractor _typeScorer;
+  std::shared_ptr<PoiPolygonTypeScoreExtractor> _typeScorer;
   double _typeScore;
   double _typeScoreThreshold;
   QStringList _reviewIfMatchedTypes;
@@ -200,15 +199,12 @@ private:
   double _phoneNumberScore;
   bool _phoneNumberMatchEnabled;
 
-  //These two are used by PoiPolygonReviewReducer and PoiPolygonDistance
+  //These is used by PoiPolygonReviewReducer
   // all the polys within the search radius of the POI being matched
   std::set<ElementId> _polyNeighborIds;
-  // all the pois within the search radius of the POI being matched
-  std::set<ElementId> _poiNeighborIds;
 
   MatchClassification _class;
 
-  bool _enableAdvancedMatching;
   bool _enableReviewReduction;
 
   bool _disableSameSourceConflation;
@@ -226,9 +222,9 @@ private:
   PoiPolygonPoiCriterion _poiCrit;
   PoiPolygonPolyCriterion _polyCrit;
 
-  std::shared_ptr<QElapsedTimer> _timer;
+  PoiPolygonInfoCachePtr _infoCache;
 
-  PoiPolygonCachePtr _infoCache;
+  int _timingThreshold;
 
   void _categorizeElementsByGeometryType();
 
Clone this wiki locally