Skip to content

v0.2.55..v0.2.56 changeset ConvertCmd.cpp

Garret Voltz edited this page Aug 14, 2020 · 3 revisions
diff --git a/hoot-core/src/main/cpp/hoot/core/cmd/ConvertCmd.cpp b/hoot-core/src/main/cpp/hoot/core/cmd/ConvertCmd.cpp
index cc88a84..5710376 100644
--- a/hoot-core/src/main/cpp/hoot/core/cmd/ConvertCmd.cpp
+++ b/hoot-core/src/main/cpp/hoot/core/cmd/ConvertCmd.cpp
@@ -35,6 +35,7 @@
 #include <hoot/core/util/ConfigOptions.h>
 #include <hoot/core/util/StringUtils.h>
 #include <hoot/core/util/ConfigUtils.h>
+#include <hoot/core/ops/MapCropper.h>
 
 // Qt
 #include <QElapsedTimer>
@@ -51,7 +52,7 @@ public:
 
   static string className() { return "hoot::ConvertCmd"; }
 
-  ConvertCmd() {}
+  ConvertCmd() = default;
 
   virtual QString getName() const override { return "convert"; }
 
@@ -73,6 +74,17 @@ public:
       throw HootException(QString("%1 takes at least two parameters.").arg(getName()));
     }
 
+    ConfigOptions configOpts(conf());
+
+    if (configOpts.getConvertOps().contains(QString::fromStdString(MapCropper::className())) &&
+        configOpts.getCropBounds().trimmed().isEmpty())
+    {
+      throw IllegalArgumentException(
+        "When using " + QString::fromStdString(MapCropper::className()) +
+        " with the convert command, the " + configOpts.getCropBoundsKey() +
+        " option must be specified.");
+    }
+
     QStringList inputs;
     QString output;
     int argIndex = 0;
Clone this wiki locally