Skip to content

v0.2.52..v0.2.53 changeset FindNodesInWayFactory.cpp

Garret Voltz edited this page Feb 12, 2020 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/algorithms/FindNodesInWayFactory.cpp b/hoot-core/src/main/cpp/hoot/core/algorithms/FindNodesInWayFactory.cpp
index 59f7d2e..d4cbd08 100644
--- a/hoot-core/src/main/cpp/hoot/core/algorithms/FindNodesInWayFactory.cpp
+++ b/hoot-core/src/main/cpp/hoot/core/algorithms/FindNodesInWayFactory.cpp
@@ -22,7 +22,7 @@
  * This will properly maintain the copyright information. DigitalGlobe
  * copyrights will be updated automatically.
  *
- * @copyright Copyright (C) 2015, 2017, 2018, 2019 DigitalGlobe (http://www.digitalglobe.com/)
+ * @copyright Copyright (C) 2015, 2017, 2018, 2019, 2020 DigitalGlobe (http://www.digitalglobe.com/)
  */
 
 #include "FindNodesInWayFactory.h"
@@ -35,6 +35,8 @@ using namespace std;
 namespace hoot
 {
 
+int FindNodesInWayFactory::logWarnCount = 0;
+
 FindNodesInWayFactory::FindNodesInWayFactory(const ConstWayPtr& w)
 {
   addWay(w);
@@ -63,7 +65,17 @@ NodePtr FindNodesInWayFactory::createNode(const OsmMapPtr& map,
       {
         // Logging this as a warning, since it happens every once in awhile and life seems to go
         // on...
-        LOG_WARN("" << "Internal Problem: Two nodes were found with the same coordinate.");
+        const int logWarnMessageLimit = ConfigOptions().getLogWarnMessageLimit();
+        if (logWarnCount < logWarnMessageLimit)
+        {
+          LOG_WARN("" << "Internal Problem: Two nodes were found with the same coordinate.");
+        }
+        else if (logWarnCount == logWarnMessageLimit)
+        {
+          LOG_WARN(className() << ": " << Log::LOG_WARN_LIMIT_REACHED_MESSAGE);
+        }
+        logWarnCount++;
+
         LOG_VART(n);
       }
       result = nid;
Clone this wiki locally