[geos-commits] [SCM] GEOS branch 3.12 updated. f6c5515b754acf2e491de05bc6774a1b5f88e2fb

git at osgeo.org git at osgeo.org
Tue Dec 5 12:58:58 PST 2023


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, 3.12 has been updated
       via  f6c5515b754acf2e491de05bc6774a1b5f88e2fb (commit)
      from  5b60b76fc0dbab04ed2488f78c4239a8b82657b8 (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 f6c5515b754acf2e491de05bc6774a1b5f88e2fb
Author: Martin Davis <mtnclimb at gmail.com>
Date:   Tue Dec 5 12:58:39 2023 -0800

    Fix PreparedPolygonContains for GC with MultiPoint (#1008)

diff --git a/src/geom/prep/AbstractPreparedPolygonContains.cpp b/src/geom/prep/AbstractPreparedPolygonContains.cpp
index cfc87436c..86a0ad343 100644
--- a/src/geom/prep/AbstractPreparedPolygonContains.cpp
+++ b/src/geom/prep/AbstractPreparedPolygonContains.cpp
@@ -201,13 +201,12 @@ bool AbstractPreparedPolygonContains::evalPointTestGeom(const Geometry *geom, Lo
         return true;
     }
 
-    if (geom->getNumGeometries() > 1) {
-        // for MultiPoint, try to find at least one point
-        // in interior
-        return isAnyTestComponentInTargetInterior(geom);
+    // a single point must not be in interior
+    if (geom->getNumPoints() <= 1) {
+        return false;
     }
-
-    return false;
+    // for multiple points have to check all
+    return isAnyTestComponentInTargetInterior(geom);
 }
 
 //
diff --git a/tests/unit/geom/prep/PreparedGeometryTest.cpp b/tests/unit/geom/prep/PreparedGeometryTest.cpp
index efc5c4b82..f651f2a96 100644
--- a/tests/unit/geom/prep/PreparedGeometryTest.cpp
+++ b/tests/unit/geom/prep/PreparedGeometryTest.cpp
@@ -68,4 +68,34 @@ void object::test<1>
     ensure( pg1->covers(g2.get()));
 }
 
+// See https://trac.osgeo.org/postgis/ticket/5601
+template<>
+template<>
+void object::test<2>
+()
+{
+    g1 = reader.read( "LINESTRING(-1 0,0 0)" );
+    g2 = reader.read( "GEOMETRYCOLLECTION(MULTIPOINT(-1 0),LINESTRING(0 -1,1 0))" );
+
+    pg1 = prep::PreparedGeometryFactory::prepare(g1.get());
+
+    ensure(  g1->intersects(g2.get()) );
+    ensure( pg1->intersects(g2.get()) );
+}
+
+// See https://github.com/libgeos/geos/issues/1007
+template<>
+template<>
+void object::test<3>
+()
+{
+    g1 = reader.read( "MULTIPOLYGON(((-60 -50,-70 -50,-60 -40,-60 -50)))" );
+    g2 = reader.read( "GEOMETRYCOLLECTION(MULTIPOINT((-60 -50),(-63 -49)))" );
+
+    pg1 = prep::PreparedGeometryFactory::prepare(g1.get());
+
+    ensure(  g1->contains(g2.get()) );
+    ensure( pg1->contains(g2.get()) );
+}
+
 } // namespace tut

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

Summary of changes:
 src/geom/prep/AbstractPreparedPolygonContains.cpp | 11 ++++-----
 tests/unit/geom/prep/PreparedGeometryTest.cpp     | 30 +++++++++++++++++++++++
 2 files changed, 35 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list