[geos-commits] [SCM] GEOS branch main updated. fcc74fd2e38e76ce292281a33f068b66c4f8c845

git at osgeo.org git at osgeo.org
Thu Nov 9 13:06:12 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, main has been updated
       via  fcc74fd2e38e76ce292281a33f068b66c4f8c845 (commit)
      from  4118b3bb4d47169a11c1228933ba3e8510e588c4 (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 fcc74fd2e38e76ce292281a33f068b66c4f8c845
Author: Martin Davis <mtnclimb at gmail.com>
Date:   Thu Nov 9 13:05:41 2023 -0800

    Fix relate computer for empty point elements (#989)

diff --git a/src/algorithm/PointLocator.cpp b/src/algorithm/PointLocator.cpp
index 04fbe31ea..7208a82a5 100644
--- a/src/algorithm/PointLocator.cpp
+++ b/src/algorithm/PointLocator.cpp
@@ -74,7 +74,12 @@ PointLocator::locate(const CoordinateXY& p, const Geometry* geom)
 void
 PointLocator::computeLocation(const CoordinateXY& p, const Geometry* geom)
 {
-
+    //-- handle empty elements
+    /*
+    if (geom->isEmpty()) {
+        return;
+    }
+*/
     GeometryTypeId geomTypeId = geom->getGeometryTypeId();
     switch (geomTypeId)
     {
diff --git a/src/geomgraph/GeometryGraph.cpp b/src/geomgraph/GeometryGraph.cpp
index a18b65b72..c00205b81 100644
--- a/src/geomgraph/GeometryGraph.cpp
+++ b/src/geomgraph/GeometryGraph.cpp
@@ -209,7 +209,10 @@ GeometryGraph::addCollection(const GeometryCollection* gc)
 {
     for(std::size_t i = 0, n = gc->getNumGeometries(); i < n; ++i) {
         const Geometry* g = gc->getGeometryN(i);
-        add(g);
+        //if (! g->isEmpty()) {
+            add(g);
+        //}
+        
     }
 }
 
diff --git a/tests/xmltester/tests/general/TestRelatePA.xml b/tests/xmltester/tests/general/TestRelatePA.xml
index 7d9e4c537..b186de01b 100644
--- a/tests/xmltester/tests/general/TestRelatePA.xml
+++ b/tests/xmltester/tests/general/TestRelatePA.xml
@@ -100,4 +100,54 @@
 </test>
 </case>
 
+<case>
+  <desc>mPA - empty Point element</desc>
+  <a>
+    MULTIPOINT(EMPTY,(0 0))
+  </a>
+  <b>
+    POLYGON ((1 0,0 1,-1 0,0 -1, 1 0))
+  </b>
+<test>
+  <op name="relate" arg3="0FFFFF212" arg1="A" arg2="B">
+    true
+  </op>
+</test>
+<test><op name="contains"   arg1="A" arg2="B"> false </op></test>
+<test><op name="coveredBy"  arg1="A" arg2="B"> true  </op></test>
+<test><op name="covers"     arg1="A" arg2="B"> false </op></test>
+<test><op name="crosses"    arg1="A" arg2="B"> false </op></test>
+<test><op name="disjoint"   arg1="A" arg2="B"> false </op></test>
+<test><op name="equalsTopo" arg1="A" arg2="B"> false </op></test>
+<test><op name="intersects" arg1="A" arg2="B"> true  </op></test>
+<test><op name="overlaps"   arg1="A" arg2="B"> false </op></test>
+<test><op name="touches"    arg1="A" arg2="B"> false </op></test>
+<test><op name="within"     arg1="A" arg2="B"> true  </op></test>
+</case>
+
+<case>
+  <desc>PmA - empty MultiPolygon element</desc>
+  <a>
+    POINT(0 0)
+  </a>
+  <b>
+    MULTIPOLYGON (EMPTY, ((1 0,0 1,-1 0,0 -1, 1 0)))
+  </b>
+<test>
+  <op name="relate" arg3="0FFFFF212" arg1="A" arg2="B">
+    true
+  </op>
+</test>
+<test><op name="contains"   arg1="A" arg2="B"> false </op></test>
+<test><op name="coveredBy"  arg1="A" arg2="B"> true  </op></test>
+<test><op name="covers"     arg1="A" arg2="B"> false </op></test>
+<test><op name="crosses"    arg1="A" arg2="B"> false </op></test>
+<test><op name="disjoint"   arg1="A" arg2="B"> false </op></test>
+<test><op name="equalsTopo" arg1="A" arg2="B"> false </op></test>
+<test><op name="intersects" arg1="A" arg2="B"> true  </op></test>
+<test><op name="overlaps"   arg1="A" arg2="B"> false </op></test>
+<test><op name="touches"    arg1="A" arg2="B"> false </op></test>
+<test><op name="within"     arg1="A" arg2="B"> true  </op></test>
+</case>
+
 </run>

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

Summary of changes:
 src/algorithm/PointLocator.cpp                 |  7 +++-
 src/geomgraph/GeometryGraph.cpp                |  5 ++-
 tests/xmltester/tests/general/TestRelatePA.xml | 50 ++++++++++++++++++++++++++
 3 files changed, 60 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list