[geos-commits] [SCM] GEOS branch master updated. 694aa42d9e0905ac44809a79da0afac34f9fb1c7

git at osgeo.org git at osgeo.org
Fri Dec 14 13:37:10 PST 2018


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, master has been updated
       via  694aa42d9e0905ac44809a79da0afac34f9fb1c7 (commit)
      from  beefe21a9e30da64d09daa2f3d831f276a91141c (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 694aa42d9e0905ac44809a79da0afac34f9fb1c7
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Fri Dec 14 13:36:51 2018 -0800

    Improve optimization of contains and covers for mixed dimension cases
    JTS a797ee259886c15fcae9436e87b790152afe314f

diff --git a/src/geom/Geometry.cpp b/src/geom/Geometry.cpp
index b2970c5..065a09f 100644
--- a/src/geom/Geometry.cpp
+++ b/src/geom/Geometry.cpp
@@ -350,7 +350,14 @@ Geometry::intersects(const Geometry *g) const
 bool
 Geometry::covers(const Geometry* g) const
 {
-    if (getDimension() == 1 && g->getDimension() == 2) {
+    // optimization - lower dimension cannot cover areas
+    if (g->getDimension() == 2 && getDimension() < 2) {
+        return false;
+    }
+
+    // optimization - P cannot cover a non-zero-length L
+    // Note that a point can cover a zero-length lineal geometry
+    if (g->getDimension() == 1 && getDimension() < 1 && g->getLength() > 0.0) {
         return false;
     }
 
@@ -394,7 +401,15 @@ Geometry::within(const Geometry *g) const
 bool
 Geometry::contains(const Geometry *g) const
 {
-    if (getDimension() == 1 && g->getDimension() == 2) {
+    // optimization - lower dimension cannot contain areas
+    if (g->getDimension() == 2 && getDimension() < 2) {
+        return false;
+    }
+
+    // optimization - P cannot contain a non-zero-length L
+    // Note that a point can contain a zero-length lineal geometry,
+    // since the line has no boundary due to Mod-2 Boundary Rule
+    if (g->getDimension() == 1 && getDimension() < 1 && g->getLength() > 0.0) {
         return false;
     }
 

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

Summary of changes:
 src/geom/Geometry.cpp | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list