From 2a0f721b58a3280f151df095ef6cb8a9f063ba25 Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Fri, 13 Jan 2017 15:13:54 +0100 Subject: [PATCH] support geos 3.6.1 --- src/osgEarthSymbology/GEOS | 3 ++- src/osgEarthSymbology/GEOS.cpp | 13 ++----------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/osgEarthSymbology/GEOS b/src/osgEarthSymbology/GEOS index b695bb7de..0184f6422 100644 --- a/src/osgEarthSymbology/GEOS +++ b/src/osgEarthSymbology/GEOS @@ -26,6 +26,7 @@ #include #include #include +#include namespace osgEarth { namespace Symbology { @@ -45,7 +46,7 @@ namespace osgEarth { namespace Symbology void disposeGeometry(geos::geom::Geometry* input); protected: - geos::geom::GeometryFactory* _factory; + geos::geom::GeometryFactory::unique_ptr _factory; }; } } // namespace osgEarth::Features diff --git a/src/osgEarthSymbology/GEOS.cpp b/src/osgEarthSymbology/GEOS.cpp index cf04e3309..d87bf461f 100644 --- a/src/osgEarthSymbology/GEOS.cpp +++ b/src/osgEarthSymbology/GEOS.cpp @@ -212,7 +212,7 @@ GEOSContext::GEOSContext() geos::geom::PrecisionModel* pm = new geos::geom::PrecisionModel(geom::PrecisionModel::FLOATING); // Factory will clone the PM - _factory = new geos::geom::GeometryFactory( pm ); + _factory = geos::geom::GeometryFactory::create( pm ); // Delete the template. delete pm; @@ -220,7 +220,6 @@ GEOSContext::GEOSContext() GEOSContext::~GEOSContext() { - delete _factory; } geom::Geometry* @@ -229,12 +228,7 @@ GEOSContext::importGeometry(const Symbology::Geometry* input) geom::Geometry* output = 0L; if ( input && input->isValid() ) { - output = import( input, _factory ); - - // if output is ok, it will have a pointer to f. this is probably a leak. - // TODO: Check whether this is a leak!! -gw - //if ( !output ) - // delete f; + output = import( input, _factory.get() ); } return output; } @@ -327,10 +321,7 @@ GEOSContext::disposeGeometry(geom::Geometry* input) { if (input) { - geom::GeometryFactory* f = const_cast(input->getFactory()); _factory->destroyGeometry(input); - if ( f != _factory ) - delete f; } } -- 2.12.0