Skip to content

v0.2.49..v0.2.50 changeset NetworkMatchCreator.cpp

Garret Voltz edited this page Nov 6, 2019 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/conflate/network/NetworkMatchCreator.cpp b/hoot-core/src/main/cpp/hoot/core/conflate/network/NetworkMatchCreator.cpp
index ab367c5..f24567b 100644
--- a/hoot-core/src/main/cpp/hoot/core/conflate/network/NetworkMatchCreator.cpp
+++ b/hoot-core/src/main/cpp/hoot/core/conflate/network/NetworkMatchCreator.cpp
@@ -27,25 +27,25 @@
 #include "NetworkMatchCreator.h"
 
 // hoot
-#include <hoot/core/util/Factory.h>
-#include <hoot/core/util/MapProjector.h>
-#include <hoot/core/elements/OsmMap.h>
 #include <hoot/core/conflate/matching/MatchType.h>
 #include <hoot/core/conflate/matching/MatchThreshold.h>
-#include <hoot/core/elements/ConstElementVisitor.h>
+#include <hoot/core/conflate/network/NetworkMatch.h>
+#include <hoot/core/conflate/network/NetworkMatcher.h>
+#include <hoot/core/conflate/network/OsmNetworkExtractor.h>
 #include <hoot/core/criterion/ChainCriterion.h>
 #include <hoot/core/criterion/HighwayCriterion.h>
 #include <hoot/core/criterion/StatusCriterion.h>
+#include <hoot/core/elements/ConstElementVisitor.h>
+#include <hoot/core/elements/OsmMap.h>
 #include <hoot/core/io/OsmJsonWriter.h>
 #include <hoot/core/io/OsmMapWriterFactory.h>
 #include <hoot/core/schema/OsmSchema.h>
 #include <hoot/core/util/ConfigOptions.h>
-#include <hoot/core/util/NotImplementedException.h>
+#include <hoot/core/util/Factory.h>
 #include <hoot/core/util/Log.h>
-#include <hoot/core/conflate/network/NetworkMatch.h>
-#include <hoot/core/conflate/network/OsmNetworkExtractor.h>
-#include <hoot/core/conflate/network/NetworkMatcher.h>
+#include <hoot/core/util/MapProjector.h>
 #include <hoot/core/util/StringUtils.h>
+#include <hoot/core/util/NotImplementedException.h>
 
 // Standard
 #include <fstream>
@@ -53,6 +53,9 @@
 // tgs
 #include <tgs/RandomForest/RandomForest.h>
 
+// Qt
+#include <QElapsedTimer>
+
 using namespace std;
 using namespace Tgs;
 
@@ -69,26 +72,27 @@ _matchScoringFunctionCurveSteepness(ConfigOptions().getNetworkMatchScoringFuncti
   _userCriterion.reset(new HighwayCriterion());
 }
 
-Match* NetworkMatchCreator::createMatch(const ConstOsmMapPtr& /*map*/, ElementId /*eid1*/,
+MatchPtr NetworkMatchCreator::createMatch(const ConstOsmMapPtr& /*map*/, ElementId /*eid1*/,
   ElementId /*eid2*/)
 {
-  Match* result = 0;
-  return result;
+  return MatchPtr();
 }
 
-const Match* NetworkMatchCreator::_createMatch(const NetworkDetailsPtr& map, NetworkEdgeScorePtr e,
+ConstMatchPtr NetworkMatchCreator::_createMatch(const NetworkDetailsPtr& map, NetworkEdgeScorePtr e,
   ConstMatchThresholdPtr mt)
 {
-  return
+  return ConstMatchPtr(
     new NetworkMatch(
       map, e->getEdgeMatch(), e->getScore(), mt, _matchScoringFunctionMax,
-      _matchScoringFunctionCurveMidpointX, _matchScoringFunctionCurveSteepness);
+      _matchScoringFunctionCurveMidpointX, _matchScoringFunctionCurveSteepness));
 }
 
-void NetworkMatchCreator::createMatches(const ConstOsmMapPtr& map, vector<const Match*>& matches,
+void NetworkMatchCreator::createMatches(const ConstOsmMapPtr& map, std::vector<ConstMatchPtr>& matches,
   ConstMatchThresholdPtr threshold)
 {
-  LOG_DEBUG("Creating matches with: " << className() << "...");
+  QElapsedTimer timer;
+  timer.start();
+  LOG_INFO("Looking for matches with: " << className() << "...");
   LOG_VART(threshold);
 
   // use another class to extract graph nodes and graph edges.
@@ -158,14 +162,15 @@ void NetworkMatchCreator::createMatches(const ConstOsmMapPtr& map, vector<const
     if (edgeMatch[i]->getScore() > matcher->getMatchThreshold())
     {
       LOG_VART(edgeMatch[i]->getEdgeMatch()->getUid());
-      const Match* match = _createMatch(details, edgeMatch[i], threshold);
+      ConstMatchPtr match = _createMatch(details, edgeMatch[i], threshold);
       LOG_VART(match);
       matches.push_back(match);
     }
   }
 
   LOG_INFO(
-    "Found " << StringUtils::formatLargeNumber(matches.size()) << " highway match candidates.");
+    "Found " << StringUtils::formatLargeNumber(matches.size()) <<
+    " highway match candidates in: " << StringUtils::millisecondsToDhms(timer.elapsed()) << ".");
 }
 
 vector<CreatorDescription> NetworkMatchCreator::getAllCreators() const
Clone this wiki locally