Skip to content

v0.2.51..v0.2.52 changeset CleanCmd.cpp

Garret Voltz edited this page Jan 15, 2020 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/cmd/CleanCmd.cpp b/hoot-core/src/main/cpp/hoot/core/cmd/CleanCmd.cpp
index 4e8e2c4..c172bca 100644
--- a/hoot-core/src/main/cpp/hoot/core/cmd/CleanCmd.cpp
+++ b/hoot-core/src/main/cpp/hoot/core/cmd/CleanCmd.cpp
@@ -29,18 +29,24 @@
 #include <hoot/core/elements/OsmMap.h>
 #include <hoot/core/cmd/BaseCommand.h>
 #include <hoot/core/ops/MapCleaner.h>
-#include <hoot/core/algorithms/rubber-sheet/RubberSheet.h>
 #include <hoot/core/util/Factory.h>
 #include <hoot/core/util/Log.h>
 #include <hoot/core/util/MapProjector.h>
 #include <hoot/core/util/Settings.h>
 #include <hoot/core/io/IoUtils.h>
+#include <hoot/core/util/Progress.h>
+#include <hoot/core/util/StringUtils.h>
+
+// Tgs
+#include <tgs/System/Timer.h>
 
 using namespace std;
 
 namespace hoot
 {
 
+static const QString JOB_SOURCE = "Clean";
+
 class CleanCmd : public BaseCommand
 {
 public:
@@ -61,20 +67,38 @@ public:
       throw HootException(QString("%1 takes two parameters.").arg(getName()));
     }
 
+    Tgs::Timer timer;
+    Progress progress(
+      ConfigOptions().getJobId(),
+      JOB_SOURCE,
+      Progress::JobState::Running,
+      0.0,
+      // import, export, and cleaning tasks
+      1.0 / 3.0);
+
+    progress.set(0.0, Progress::JobState::Running, "Importing map...");
     OsmMapPtr map(new OsmMap());
     IoUtils::loadMap(map, args[0], true, Status::Unknown1);
 
-    MapCleaner().apply(map);
+    progress.set(1.0 / 3.0, Progress::JobState::Running, "Cleaning map...");
+    MapCleaner(progress).apply(map);
 
+    progress.set(2.0 / 3.0, Progress::JobState::Running, "Exporting map...");
     MapProjector::projectToWgs84(map);
     IoUtils::saveMap(map, args[1]);
 
+    double totalElapsed = timer.getElapsed();
+    progress.set(
+      1.0, Progress::JobState::Successful,
+      "Cleaning job completed using " +
+      QString::number(ConfigOptions().getMapCleanerTransforms().size()) +
+      " cleaning operations in " + StringUtils::millisecondsToDhms((qint64)(totalElapsed * 1000)));
+
     return 0;
   }
 };
 
 HOOT_FACTORY_REGISTER(Command, CleanCmd)
 
-
 }
 
Clone this wiki locally