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

git at osgeo.org git at osgeo.org
Sun Nov 24 17:55:39 PST 2024


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  b0cec4048213e2723e0217c7e3551eda788e5c7e (commit)
      from  930487a20b6b5860eba91f9719ce0881973defc2 (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 b0cec4048213e2723e0217c7e3551eda788e5c7e
Author: Martin Davis <mtnclimb at gmail.com>
Date:   Sun Nov 24 17:55:11 2024 -0800

    Improve RelateNG performance for A/L cases in prepared predicates (#1201)

diff --git a/include/geos/operation/relateng/RelateGeometry.h b/include/geos/operation/relateng/RelateGeometry.h
index 09753b682..d1282d52f 100644
--- a/include/geos/operation/relateng/RelateGeometry.h
+++ b/include/geos/operation/relateng/RelateGeometry.h
@@ -179,6 +179,10 @@ public:
             case Dimension::A: return hasAreas;
         }
         return false;
+    }    
+    
+    bool hasAreaAndLine() const {
+        return hasAreas && hasLines;
     }
 
     /**
diff --git a/src/operation/relateng/TopologyComputer.cpp b/src/operation/relateng/TopologyComputer.cpp
index 0b6782e42..e911bc6f8 100644
--- a/src/operation/relateng/TopologyComputer.cpp
+++ b/src/operation/relateng/TopologyComputer.cpp
@@ -132,11 +132,16 @@ TopologyComputer::getDimension(bool isA) const
 bool
 TopologyComputer::isSelfNodingRequired() const
 {
-    if (predicate.requireSelfNoding()) {
-        if (geomA.isSelfNodingRequired() ||
-            geomB.isSelfNodingRequired())
-        return true;
-    }
+    if (! predicate.requireSelfNoding())
+      return false;
+    
+    if (geomA.isSelfNodingRequired()) 
+      return true;
+    
+    //-- if B is a mixed GC with A and L require full noding
+    if (geomB.hasAreaAndLine())
+      return true;
+
     return false;
 }
 
diff --git a/tests/unit/operation/relateng/RelateNGGCTest.cpp b/tests/unit/operation/relateng/RelateNGGCTest.cpp
index c8405328a..7e78401c2 100644
--- a/tests/unit/operation/relateng/RelateNGGCTest.cpp
+++ b/tests/unit/operation/relateng/RelateNGGCTest.cpp
@@ -320,6 +320,10 @@ void object::test<23> ()
     std::string a = "POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0))";
     std::string b = "GEOMETRYCOLLECTION (POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0)), MULTIPOINT ((0 2), (0 5)))";
     checkEquals(a, b, true);
+    checkContainsWithin(a, b, true);
+    checkCoversCoveredBy(a, b, true);
+    checkContainsWithin(b, a, true);
+    checkCoversCoveredBy(b, a, true);
 }
 
 
@@ -331,6 +335,10 @@ void object::test<24> ()
     std::string a = "POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0))";
     std::string b = "GEOMETRYCOLLECTION (POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0)), LINESTRING (0 2, 0 5))";
     checkEquals(a, b, true);
+    checkContainsWithin(a, b, true);
+    checkCoversCoveredBy(a, b, true);
+    checkContainsWithin(b, a, true);
+    checkCoversCoveredBy(b, a, true);
 }
 
 
@@ -341,7 +349,10 @@ void object::test<25> ()
     std::string a = "POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0))";
     std::string b = "GEOMETRYCOLLECTION (POLYGON((0 0, 10 0, 10 10, 0 10, 0 0)),LINESTRING(0 2, 0 5, 5 5))";
     checkEquals(a, b, true);
-}
+    checkContainsWithin(a, b, true);
+    checkCoversCoveredBy(a, b, true);
+    checkContainsWithin(b, a, true);
+    checkCoversCoveredBy(b, a, true);}
 
 
 
diff --git a/tests/xmltester/tests/general/TestRelateGC.xml b/tests/xmltester/tests/general/TestRelateGC.xml
index f67b789a0..a83444a01 100644
--- a/tests/xmltester/tests/general/TestRelateGC.xml
+++ b/tests/xmltester/tests/general/TestRelateGC.xml
@@ -574,6 +574,17 @@ GEOMETRYCOLLECTION (POLYGON ((1 9, 5 9, 6 6, 1 5, 1 9), (2 6, 4 8, 6 6, 2 6)), P
   <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>
+
+  <test><op name="contains"   arg1="B" arg2="A"> true </op></test>
+  <test><op name="coveredBy"  arg1="B" arg2="A"> true </op></test>
+  <test><op name="covers"     arg1="B" arg2="A"> true </op></test>
+  <test><op name="crosses"    arg1="B" arg2="A"> false </op></test>
+  <test><op name="disjoint"   arg1="B" arg2="A"> false </op></test>
+  <test><op name="equalsTopo" arg1="B" arg2="A"> true </op></test>
+  <test><op name="intersects" arg1="B" arg2="A"> true </op></test>
+  <test><op name="overlaps"   arg1="B" arg2="A"> false </op></test>
+  <test><op name="touches"    arg1="B" arg2="A"> false </op></test>
+  <test><op name="within"     arg1="B" arg2="A"> true </op></test>
 </case>
 
 <case>
@@ -596,6 +607,17 @@ GEOMETRYCOLLECTION (POLYGON ((1 9, 5 9, 6 6, 1 5, 1 9), (2 6, 4 8, 6 6, 2 6)), P
   <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>
+
+  <test><op name="contains"   arg1="B" arg2="A"> true </op></test>
+  <test><op name="coveredBy"  arg1="B" arg2="A"> true </op></test>
+  <test><op name="covers"     arg1="B" arg2="A"> true </op></test>
+  <test><op name="crosses"    arg1="B" arg2="A"> false </op></test>
+  <test><op name="disjoint"   arg1="B" arg2="A"> false </op></test>
+  <test><op name="equalsTopo" arg1="B" arg2="A"> true </op></test>
+  <test><op name="intersects" arg1="B" arg2="A"> true </op></test>
+  <test><op name="overlaps"   arg1="B" arg2="A"> false </op></test>
+  <test><op name="touches"    arg1="B" arg2="A"> false </op></test>
+  <test><op name="within"     arg1="B" arg2="A"> true </op></test>
 </case>
 
 </run>

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

Summary of changes:
 include/geos/operation/relateng/RelateGeometry.h |  4 ++++
 src/operation/relateng/TopologyComputer.cpp      | 15 ++++++++++-----
 tests/unit/operation/relateng/RelateNGGCTest.cpp | 13 ++++++++++++-
 tests/xmltester/tests/general/TestRelateGC.xml   | 22 ++++++++++++++++++++++
 4 files changed, 48 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list