[geos-commits] [SCM] GEOS branch 3.10 updated. e00254f4bb92dac8a377b684a187d4a4ced007e5

git at osgeo.org git at osgeo.org
Tue Dec 5 13:02:56 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.10 has been updated
       via  e00254f4bb92dac8a377b684a187d4a4ced007e5 (commit)
      from  ba32d54f981ff0509cbb125d17b9a067135882dd (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 e00254f4bb92dac8a377b684a187d4a4ced007e5
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