Skip to content

v0.2.54..v0.2.55 changeset MapProjector.cpp

Garret Voltz edited this page Aug 14, 2020 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/util/MapProjector.cpp b/hoot-core/src/main/cpp/hoot/core/util/MapProjector.cpp
index 0434142..b4b54b3 100644
--- a/hoot-core/src/main/cpp/hoot/core/util/MapProjector.cpp
+++ b/hoot-core/src/main/cpp/hoot/core/util/MapProjector.cpp
@@ -53,8 +53,6 @@ namespace hoot
 
 int MapProjector::logWarnCount = 0;
 
-std::shared_ptr<MapProjector> MapProjector::_theInstance;
-
 class DisableCplErrors
 {
 public:
@@ -113,11 +111,9 @@ void ReprojectCoordinateFilter::project(Coordinate* c) const
 
 MapProjector& MapProjector::getInstance()
 {
-  if (!_theInstance.get())
-  {
-    _theInstance.reset(new MapProjector());
-  }
-  return *_theInstance;
+  //  Local static singleton instance
+  static MapProjector instance;
+  return instance;
 }
 
 bool MapProjector::_angleLessThan(const MapProjector::PlanarTestResult& p1,
@@ -624,7 +620,7 @@ void MapProjector::projectToPlanar(const std::shared_ptr<OsmMap>& map)
   {
     LOG_DEBUG("Projecting to planar...");
     OGREnvelope env = CalculateMapBoundsVisitor::getBounds(map);
-    LOG_VARD(GeometryUtils::toEnvelope(env));
+    LOG_VART(GeometryUtils::toEnvelope(env));
     projectToPlanar(map, env);
   }
 }
Clone this wiki locally