Skip to content

v0.2.54..v0.2.55 changeset OsmMapWriterFactory.cpp

Garret Voltz edited this page Aug 14, 2020 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/io/OsmMapWriterFactory.cpp b/hoot-core/src/main/cpp/hoot/core/io/OsmMapWriterFactory.cpp
index c005412..0b1c619 100644
--- a/hoot-core/src/main/cpp/hoot/core/io/OsmMapWriterFactory.cpp
+++ b/hoot-core/src/main/cpp/hoot/core/io/OsmMapWriterFactory.cpp
@@ -36,6 +36,7 @@
 #include <hoot/core/util/StringUtils.h>
 #include <hoot/core/util/MapProjector.h>
 #include <hoot/core/conflate/network/DebugNetworkMapCreator.h>
+#include <hoot/core/visitors/RemoveMissingElementsVisitor.h>
 
 // Qt
 #include <QElapsedTimer>
@@ -178,7 +179,7 @@ void OsmMapWriterFactory::writeDebugMap(const ConstOsmMapPtr& map, const QString
     {
       debugMapFileName = debugMapFileName.replace(".osm", "-" + fileNumberStr + ".osm");
     }
-    LOG_DEBUG("Writing debug output to: " << debugMapFileName);
+    LOG_INFO("Writing debug output to: ..." << debugMapFileName.right(30));
     OsmMapPtr copy(new OsmMap(map));
 
     if (matcher)
@@ -188,6 +189,15 @@ void OsmMapWriterFactory::writeDebugMap(const ConstOsmMapPtr& map, const QString
     }
 
     MapProjector::projectToWgs84(copy);
+    if (ConfigOptions().getDebugMapsRemoveMissingElements())
+    {
+      // Don't remove elements recursively here. You can end up with a map unreadable in JOSM if
+      // you don't remove missing elements here. However, in some cases (like debugging cut and
+      // replace), you want to see them in the raw output to know things are working the way they
+      // should be.
+      RemoveMissingElementsVisitor missingElementsRemover;
+      copy->visitRw(missingElementsRemover);
+    }
     write(copy, debugMapFileName, true, true);
     _debugMapCount++;
   }
Clone this wiki locally