Skip to content

v0.2.48..v0.2.49 changeset DataConverter.cpp

Garret Voltz edited this page Oct 2, 2019 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/io/DataConverter.cpp b/hoot-core/src/main/cpp/hoot/core/io/DataConverter.cpp
index eced310..c425a05 100644
--- a/hoot-core/src/main/cpp/hoot/core/io/DataConverter.cpp
+++ b/hoot-core/src/main/cpp/hoot/core/io/DataConverter.cpp
@@ -48,6 +48,7 @@
 #include <hoot/core/visitors/SchemaTranslationVisitor.h>
 #include <hoot/core/ops/BuildingPartMergeOp.h>
 #include <hoot/core/ops/MergeNearbyNodes.h>
+#include <hoot/core/ops/BuildingOutlineUpdateOp.h>
 
 // std
 #include <vector>
@@ -576,15 +577,31 @@ void DataConverter::_convertFromOgr(const QStringList& inputs, const QString& ou
   _convertOps.removeAll(QString::fromStdString(SchemaTranslationVisitor::className()));
   LOG_VARD(_convertOps);
 
-  // The ordering for these added ops matters.
-  if (ConfigOptions().getOgr2osmSimplifyComplexBuildings())
+  // The ordering for these added ops matters. Let's run them after any user specified convert ops
+  // to avoid unnecessary processing time.
+  if (ConfigOptions().getOgr2osmMergeNearbyNodes())
   {
-    _convertOps.prepend(QString::fromStdString(BuildingPartMergeOp::className()));
+    if (!_convertOps.contains(QString::fromStdString(MergeNearbyNodes::className())))
+    {
+      _convertOps.append(QString::fromStdString(MergeNearbyNodes::className()));
+    }
   }
-  if (ConfigOptions().getOgr2osmMergeNearbyNodes())
+  if (ConfigOptions().getOgr2osmSimplifyComplexBuildings())
   {
-    _convertOps.prepend(QString::fromStdString(MergeNearbyNodes::className()));
+    // Building outline updating needs to happen after building part merging, or we can end up with
+    // role verification warnings in JOSM.
+      if (!_convertOps.contains(QString::fromStdString(BuildingPartMergeOp::className())))
+      {
+        _convertOps.append(QString::fromStdString(BuildingPartMergeOp::className()));
+      }
+    if (!_convertOps.contains(QString::fromStdString(BuildingOutlineUpdateOp::className())))
+    {
+      _convertOps.append(QString::fromStdString(BuildingOutlineUpdateOp::className()));
+    }
   }
+  // Inclined to do this, but there could be some workflows where the same op needs to be called
+  // more than once.
+  //_convertOps.removeDuplicates();
   LOG_VARD(_convertOps);
 
   // The number of task steps here must be updated as you add/remove job steps in the logic.
@@ -633,9 +650,10 @@ void DataConverter::_convertFromOgr(const QStringList& inputs, const QString& ou
   LOG_INFO(
     "Read " << StringUtils::formatLargeNumber(map->getElementCount()) <<
     " elements from input in: " << StringUtils::secondsToDhms(timer.elapsed()) << ".");
+  // turn this on for debugging only
+  //OsmMapWriterFactory::writeDebugMap(map, "after-convert-from-ogr");
   currentTask++;
 
-  MapProjector::projectToPlanar(map);
   if (_convertOps.size() > 0)
   {
     NamedOp convertOps(_convertOps);
Clone this wiki locally