Skip to content

v0.2.49..v0.2.50 changeset DiffCmd.cpp

Garret Voltz edited this page Nov 6, 2019 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/cmd/DiffCmd.cpp b/hoot-core/src/main/cpp/hoot/core/cmd/DiffCmd.cpp
index e7a49d0..c995c3a 100644
--- a/hoot-core/src/main/cpp/hoot/core/cmd/DiffCmd.cpp
+++ b/hoot-core/src/main/cpp/hoot/core/cmd/DiffCmd.cpp
@@ -33,7 +33,7 @@
 #include <hoot/core/util/Settings.h>
 #include <hoot/core/elements/OsmMap.h>
 #include <hoot/core/util/Log.h>
-#include <hoot/core/util/IoUtils.h>
+#include <hoot/core/io/IoUtils.h>
 
 using namespace std;
 
@@ -69,6 +69,20 @@ public:
       mapCompare.setUseDateTime();
     }
 
+    if (args.contains("--error-limit"))
+    {
+      const int errorLimitIndex = args.indexOf("--error-limit");
+      bool ok = false;
+      const int errorLimit = args.at(errorLimitIndex + 1).trimmed().toInt(&ok);
+      if (!ok)
+      {
+        throw IllegalArgumentException("Invalid error limit: " + args.at(errorLimitIndex + 1));
+      }
+      args.removeAt(errorLimitIndex + 1);
+      args.removeAt(errorLimitIndex);
+      mapCompare.setErrorLimit(errorLimit);
+    }
+
     if (args.size() != 2)
     {
       cout << getHelp() << endl << endl;
@@ -77,6 +91,8 @@ public:
 
     OsmMapPtr map1(new OsmMap());
     IoUtils::loadMap(map1, args[0], true, Status::Unknown1);
+    //  Some maps that don't have IDs cooked in will fail comparison if the IDs aren't reset
+    OsmMap::resetCounters();
     OsmMapPtr map2(new OsmMap());
     IoUtils::loadMap(map2, args[1], true, Status::Unknown1);
 
Clone this wiki locally