Skip to content

v0.2.49..v0.2.50 changeset UnifyingConflator.h

Garret Voltz edited this page Nov 6, 2019 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/conflate/UnifyingConflator.h b/hoot-core/src/main/cpp/hoot/core/conflate/UnifyingConflator.h
index 298722b..a5ee0f1 100644
--- a/hoot-core/src/main/cpp/hoot/core/conflate/UnifyingConflator.h
+++ b/hoot-core/src/main/cpp/hoot/core/conflate/UnifyingConflator.h
@@ -28,15 +28,16 @@
 #define UNIFYINGCONFLATOR_H
 
 // hoot
+#include <hoot/core/conflate/matching/MatchGraph.h>
+#include <hoot/core/conflate/merging/Merger.h>
 #include <hoot/core/elements/OsmMap.h>
+#include <hoot/core/info/SingleStat.h>
 #include <hoot/core/io/Serializable.h>
 #include <hoot/core/ops/OsmMapOperation.h>
 #include <hoot/core/util/Boundable.h>
 #include <hoot/core/util/Configurable.h>
-#include <hoot/core/util/Settings.h>
-#include <hoot/core/conflate/matching/MatchGraph.h>
-#include <hoot/core/info/SingleStat.h>
 #include <hoot/core/util/ProgressReporter.h>
+#include <hoot/core/util/Settings.h>
 
 // tgs
 #include <tgs/HashMap.h>
@@ -51,7 +52,6 @@ class Match;
 class MatchClassification;
 class MatchFactory;
 class MatchThreshold;
-class Merger;
 class MergerFactory;
 class ElementId;
 
@@ -82,30 +82,30 @@ public:
    * Conflates the specified map. If the map is not in a planar projection it is reprojected. The
    * map is not reprojected back to the original projection when conflation is complete.
    */
-  virtual void apply(OsmMapPtr& map);
+  virtual void apply(OsmMapPtr& map) override;
 
-  virtual std::string getClassName() const { return className(); }
+  virtual std::string getClassName() const override { return className(); }
 
   QList<SingleStat> getStats() const { return _stats; }
 
-  virtual void readObject(QDataStream& /*is*/) {}
+  virtual void readObject(QDataStream& /*is*/) override {}
 
-  virtual void setBounds(const geos::geom::Envelope& bounds) { _bounds = bounds; }
+  virtual void setBounds(const geos::geom::Envelope& bounds) override { _bounds = bounds; }
 
-  virtual void setConfiguration(const Settings &conf);
+  virtual void setConfiguration(const Settings &conf) override;
 
   /**
    * Set the factory to use when creating mergers. This method is likely only useful when testing.
    */
   void setMergerFactory(const std::shared_ptr<MergerFactory>& mf) { _mergerFactory = mf; }
 
-  virtual void writeObject(QDataStream& /*os*/) const {}
+  virtual void writeObject(QDataStream& /*os*/) const override {}
 
-  virtual QString getDescription() const
+  virtual QString getDescription() const override
   { return "Conflates two inputs maps into one with Unifying Conflation"; }
 
-  virtual void setProgress(Progress progress) { _progress = progress; }
-  virtual unsigned int getNumSteps() const { return 3; }
+  virtual void setProgress(Progress progress) override { _progress = progress; }
+  virtual unsigned int getNumSteps() const override { return 3; }
 
 private:
 
@@ -114,26 +114,16 @@ private:
   std::shared_ptr<MatchThreshold> _matchThreshold;
   std::shared_ptr<MergerFactory> _mergerFactory;
   Settings _settings;
-  HashMap<ElementId, std::vector<Merger*>> _e2m;
-  std::vector<const Match*> _matches;
-  std::vector<Merger*> _mergers;
+  HashMap<ElementId, std::vector<MergerPtr>> _e2m;
+  std::vector<ConstMatchPtr> _matches;
+  std::vector<MergerPtr> _mergers;
   QList<SingleStat> _stats;
   int _taskStatusUpdateInterval;
   Progress _progress;
 
-  void _addReviewTags(const OsmMapPtr &map, const std::vector<const Match *> &matches);
+  void _addReviewTags(const OsmMapPtr &map, const std::vector<ConstMatchPtr> &matches);
   void _addScoreTags(const ElementPtr& e, const MatchClassification& mc);
 
-  template <typename InputCollection>
-  void _deleteAll(InputCollection& ic)
-  {
-    for (typename InputCollection::const_iterator it = ic.begin(); it != ic.end(); ++it)
-    {
-      delete *it;
-    }
-    ic.clear();
-  }
-
   /**
    * Populates the _e2m map with a mapping of ElementIds to their respective Merger objects. This
    * is helpful when replacing element ids with new ids.
@@ -144,7 +134,7 @@ private:
    */
   void _mapElementIdsToMergers();
 
-  void _removeWholeGroups(std::vector<const Match *> &matches, MatchSetVector &matchSets,
+  void _removeWholeGroups(std::vector<ConstMatchPtr> &matches, MatchSetVector &matchSets,
     const OsmMapPtr &map);
 
   void _replaceElementIds(const std::vector<std::pair<ElementId, ElementId>>& replaced);
@@ -155,10 +145,10 @@ private:
    */
   void _reset();
 
-  void _validateConflictSubset(const ConstOsmMapPtr& map, std::vector<const Match *> matches);
+  void _validateConflictSubset(const ConstOsmMapPtr& map, std::vector<ConstMatchPtr> matches);
 
-  void _printMatches(std::vector<const Match*> matches);
-  void _printMatches(std::vector<const Match*> matches, const MatchType& typeFilter);
+  void _printMatches(std::vector<ConstMatchPtr> matches);
+  void _printMatches(std::vector<ConstMatchPtr> matches, const MatchType& typeFilter);
   QString _matchSetToString(const MatchSet& matchSet) const;
 
   void _updateProgress(const int currentStep, const QString message);
Clone this wiki locally