[geos-commits] [SCM] geos branch svn-3.5 updated. 5c47024ce7bf530221e678bdb5db210296a4151c

git at osgeo.org git at osgeo.org
Tue Nov 28 10:53:35 PST 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "geos".

The branch, svn-3.5 has been updated
       via  5c47024ce7bf530221e678bdb5db210296a4151c (commit)
       via  710ddbe48177c215f98dd5e90fb64460b35401a7 (commit)
      from  8f35d3bafd3f96b850b460b8e23fd3df3afd168a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 5c47024ce7bf530221e678bdb5db210296a4151c
Merge: 8f35d3b 710ddbe
Author: Sandro Santilli <strk at kbt.io>
Date:   Tue Nov 28 10:53:35 2017 -0800

    Merge branch 'trac-741_geos-3.5' of sebastic/geos into svn-3.5


commit 710ddbe48177c215f98dd5e90fb64460b35401a7
Author: Sandro Santilli <strk at kbt.io>
Date:   Fri Dec 2 13:58:45 2016 +0000

    Fix empty GEOSSimplify return on inner ring collapse
    
    Patch by Even Rouault
    See #741
    
    git-svn-id: http://svn.osgeo.org/geos/trunk@4311 5242fede-7e19-0410-aef8-94bd7d2200fb

diff --git a/include/geos/geom/util/GeometryTransformer.h b/include/geos/geom/util/GeometryTransformer.h
index c2e93ba..f1467b9 100644
--- a/include/geos/geom/util/GeometryTransformer.h
+++ b/include/geos/geom/util/GeometryTransformer.h
@@ -99,6 +99,8 @@ public:
 
 	std::auto_ptr<Geometry> transform(const Geometry* nInputGeom);
 
+	void setSkipTransformedInvalidInteriorRings(bool b);
+
 protected:
 
 	const GeometryFactory* factory;
@@ -178,9 +180,14 @@ private:
 	 */
 	bool preserveType;
 
-    // Declare type as noncopyable
-    GeometryTransformer(const GeometryTransformer& other);
-    GeometryTransformer& operator=(const GeometryTransformer& rhs);
+	/**
+	 * <code>true</code> if transformed invalid interior rings should be skipped
+	 */
+	bool skipTransformedInvalidInteriorRings;
+
+	// Declare type as noncopyable
+	GeometryTransformer(const GeometryTransformer& other);
+	GeometryTransformer& operator=(const GeometryTransformer& rhs);
 };
 
 
diff --git a/src/geom/util/GeometryTransformer.cpp b/src/geom/util/GeometryTransformer.cpp
index 67fb91d..c027126 100644
--- a/src/geom/util/GeometryTransformer.cpp
+++ b/src/geom/util/GeometryTransformer.cpp
@@ -59,13 +59,19 @@ GeometryTransformer::GeometryTransformer()
 	pruneEmptyGeometry(true),
 	preserveGeometryCollectionType(true),
 	preserveCollections(false),
-	preserveType(false)
+	preserveType(false),
+	skipTransformedInvalidInteriorRings(false)
 {}
 
 GeometryTransformer::~GeometryTransformer()
 {
 }
 
+void GeometryTransformer::setSkipTransformedInvalidInteriorRings(bool b)
+{
+	skipTransformedInvalidInteriorRings = b;
+}
+
 /*public*/
 auto_ptr<Geometry>
 GeometryTransformer::transform(const Geometry* nInputGeom)
@@ -283,6 +289,8 @@ GeometryTransformer::transformPolygon(
 
 		if ( ! dynamic_cast<LinearRing*>(hole.get()) )
 		{
+			if ( skipTransformedInvalidInteriorRings )
+			    continue;
 			isAllValidLinearRings = false;
 		}
 
diff --git a/src/simplify/DouglasPeuckerSimplifier.cpp b/src/simplify/DouglasPeuckerSimplifier.cpp
index 64be39a..e963cd9 100644
--- a/src/simplify/DouglasPeuckerSimplifier.cpp
+++ b/src/simplify/DouglasPeuckerSimplifier.cpp
@@ -89,6 +89,7 @@ DPTransformer::DPTransformer(double t)
 	:
 	distanceTolerance(t)
 {
+	setSkipTransformedInvalidInteriorRings(true);
 }
 
 Geometry::AutoPtr
diff --git a/tests/unit/simplify/DouglasPeuckerSimplifierTest.cpp b/tests/unit/simplify/DouglasPeuckerSimplifierTest.cpp
index 8720158..4bb14e8 100644
--- a/tests/unit/simplify/DouglasPeuckerSimplifierTest.cpp
+++ b/tests/unit/simplify/DouglasPeuckerSimplifierTest.cpp
@@ -335,5 +335,26 @@ namespace tut
         //std::string const simplifiedWkt2 = wktwriter.write(simplified2.get());
 	}
 
+	// 13 - Polygon with inner ring whose extent is less than the simplify distance (#741)
+	template<>
+	template<>
+	void object::test<13>()
+	{
+		std::string wkt_in("POLYGON ((0 0,0 1,1 1,0 0),(0.1 0.1,0.2 0.1,0.2 0.2,0.1 0.1))");
+
+		std::string wkt_ex("POLYGON ((0 0,0 1,1 1,0 0))");
+
+		GeomPtr g(wktreader.read(wkt_in));
+
+		GeomPtr expected(wktreader.read(wkt_ex));
+
+		GeomPtr simplified = DouglasPeuckerSimplifier::simplify(
+			g.get(), 0.5);
+
+		ensure( simplified->isValid() );
+
+		ensure( simplified->equalsExact(expected.get()) );
+	}
+
 } // namespace tut
 

-----------------------------------------------------------------------

Summary of changes:
 include/geos/geom/util/GeometryTransformer.h       |   13 +++++++++---
 src/geom/util/GeometryTransformer.cpp              |   10 +++++++++-
 src/simplify/DouglasPeuckerSimplifier.cpp          |    1 +
 .../unit/simplify/DouglasPeuckerSimplifierTest.cpp |   21 ++++++++++++++++++++
 4 files changed, 41 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
geos


More information about the geos-commits mailing list