[geos] 01/09: Add patch to fix empty GEOSSimplify return on inner ring collapse.
Bas Couwenberg
sebastic at debian.org
Tue Nov 28 20:01:54 UTC 2017
This is an automated email from the git hooks/post-receive script.
sebastic pushed a commit to branch master
in repository geos.
commit 703594d98ea2f441e8b97688e0c645f3f876da3e
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date: Tue Nov 28 20:08:55 2017 +0100
Add patch to fix empty GEOSSimplify return on inner ring collapse.
---
debian/changelog | 1 +
...EOSSimplify-return-on-inner-ring-collapse.patch | 110 +++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 112 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index 38dca16..b569511 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,7 @@ geos (3.5.1-4) UNRELEASED; urgency=medium
* Ignore test failures on problematic architectures only.
* Strip trailing whitespace from changelog, control & rules files.
+ * Add patch to fix empty GEOSSimplify return on inner ring collapse.
-- Bas Couwenberg <sebastic at debian.org> Fri, 20 Jan 2017 15:57:07 +0100
diff --git a/debian/patches/0001-Fix-empty-GEOSSimplify-return-on-inner-ring-collapse.patch b/debian/patches/0001-Fix-empty-GEOSSimplify-return-on-inner-ring-collapse.patch
new file mode 100644
index 0000000..ed5c02f
--- /dev/null
+++ b/debian/patches/0001-Fix-empty-GEOSSimplify-return-on-inner-ring-collapse.patch
@@ -0,0 +1,110 @@
+Description: 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
+Author: Even Rouault
+Origin: https://git.osgeo.org/gogs/geos/geos/commit/710ddbe48177c215f98dd5e90fb64460b35401a7
+Bug: https://trac.osgeo.org/geos/ticket/741
+
+--- 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);
+ };
+
+
+--- 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;
+ }
+
+--- a/src/simplify/DouglasPeuckerSimplifier.cpp
++++ b/src/simplify/DouglasPeuckerSimplifier.cpp
+@@ -89,6 +89,7 @@ DPTransformer::DPTransformer(double t)
+ :
+ distanceTolerance(t)
+ {
++ setSkipTransformedInvalidInteriorRings(true);
+ }
+
+ Geometry::AutoPtr
+--- 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
+
diff --git a/debian/patches/series b/debian/patches/series
index b70acfb..2d72de3 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,4 @@ libruby
ruby2
disable-docygen-html-timestamp
spelling-errors.patch
+0001-Fix-empty-GEOSSimplify-return-on-inner-ring-collapse.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/geos.git
More information about the Pkg-grass-devel
mailing list