[postgis-tickets] [SCM] PostGIS branch main updated. 3.1.0rc1-267-gdf3d193

git at osgeo.org git at osgeo.org
Mon Jul 5 13:26:05 PDT 2021


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 "PostGIS".

The branch, main has been updated
       via  df3d193fd137a82196c3afa1af1d37bb719cc756 (commit)
      from  c909a660377709699f7a1529d990a00c2f276593 (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 df3d193fd137a82196c3afa1af1d37bb719cc756
Author: Sandro Santilli <strk at kbt.io>
Date:   Mon Jul 5 22:25:16 2021 +0200

    Use a nested loop for face checks
    
    Simplifies code and improves the odds of using prepared geometries

diff --git a/topology/test/regress/legacy_invalid_expected b/topology/test/regress/legacy_invalid_expected
index 9a1b831..1cb4222 100644
--- a/topology/test/regress/legacy_invalid_expected
+++ b/topology/test/regress/legacy_invalid_expected
@@ -15,11 +15,11 @@ edge crosses edge|30|32
 edge start node geometry mis-match|30|4
 edge end node geometry mis-match|30|3
 face without edges|10|
+face within face|2|11
+face overlaps face|2|12
 face has wrong mbr|3|
 face has wrong mbr|6|
 face has no rings|10|
-face within face|11|2
-face overlaps face|2|12
 not-isolated node has not-null containing_face|4|
 edge not covered by both its side faces|27|
 edge not covered by both its side faces|28|
@@ -27,6 +27,6 @@ edge not covered by both its side faces|30|
 #4936|missing_count|4
 #4936|missing|face has no rings|10|
 #4936|missing|face overlaps face|2|12
-#4936|missing|face within face|11|2
+#4936|missing|face within face|2|11
 #4936|missing|face without edges|10|
 Topology 'invalid_topology' dropped
diff --git a/topology/topology.sql.in b/topology/topology.sql.in
index 9156136..bb9e884 100644
--- a/topology/topology.sql.in
+++ b/topology/topology.sql.in
@@ -1787,47 +1787,42 @@ BEGIN
       RETURN NEXT retrec;
     END IF;
 
-  END LOOP; --}
-
-  -- Scan the table looking for overlap or containment
-  -- TODO: do this check as part of the earlier loop
-  RAISE DEBUG 'Checking for face-in-face';
-  FOR rec IN
-    SELECT
-      f1.geom,
-      f1.face_id as id1,
-      f2.face_id as id2,
-      ST_Relate(f1.geom, f2.geom) as im
-    FROM
-      face_check f1,
-      face_check f2
-      WHERE f1.face_id < f2.face_id
-      AND f1.geom && f2.geom
-  LOOP --{
+    FOR rec2 IN
+      SELECT
+        geom,
+        face_id,
+        ST_Relate(rec.geom, geom) as im
+      FROM
+        face_check
+        WHERE face_id > rec.face_id
+        AND geom && rec.geom
+    LOOP --{
+
+      -- Face overlap
+      IF ST_RelateMatch(rec2.im, 'T*T***T**') THEN
+        retrec.error = 'face overlaps face';
+        retrec.id1 = rec.face_id;
+        retrec.id2 = rec2.face_id;
+        RETURN NEXT retrec;
+      END IF;
 
-    -- Face overlap
-    IF ST_RelateMatch(rec.im, 'T*T***T**') THEN
-    retrec.error = 'face overlaps face';
-    retrec.id1 = rec.id1;
-    retrec.id2 = rec.id2;
-    RETURN NEXT retrec;
-    END IF;
+      -- Face 1 is within face 2
+      IF ST_RelateMatch(rec2.im, 'T*F**F***') THEN
+        retrec.error = 'face within face';
+        retrec.id1 = rec.face_id;
+        retrec.id2 = rec2.face_id;
+        RETURN NEXT retrec;
+      END IF;
 
-    -- Face 1 is within face 2
-    IF ST_RelateMatch(rec.im, 'T*F**F***') THEN
-    retrec.error = 'face within face';
-    retrec.id1 = rec.id1;
-    retrec.id2 = rec.id2;
-    RETURN NEXT retrec;
-    END IF;
+      -- Face 1 contains face 2
+      IF ST_RelateMatch(rec2.im, 'T*****FF*') THEN
+        retrec.error = 'face within face';
+        retrec.id1 = rec.face_id;
+        retrec.id2 = rec2.face_id;
+        RETURN NEXT retrec;
+      END IF;
 
-    -- Face 1 contains face 2
-    IF ST_RelateMatch(rec.im, 'T*****FF*') THEN
-    retrec.error = 'face within face';
-    retrec.id1 = rec.id2;
-    retrec.id2 = rec.id1;
-    RETURN NEXT retrec;
-    END IF;
+    END LOOP; --}
 
   END LOOP; --}
 

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

Summary of changes:
 topology/test/regress/legacy_invalid_expected |  6 +--
 topology/topology.sql.in                      | 71 +++++++++++++--------------
 2 files changed, 36 insertions(+), 41 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list