[postgis-tickets] [SCM] PostGIS branch master updated. 3.3.0rc2-314-gef4e85d47

git at osgeo.org git at osgeo.org
Thu Nov 3 01:28:47 PDT 2022


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, master has been updated
       via  ef4e85d475a4fd790ce0ecfbc5d6e70bbde6012b (commit)
      from  2405b53478cd52dd6525fd53ce2da0cd30d817da (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 ef4e85d475a4fd790ce0ecfbc5d6e70bbde6012b
Author: Sandro Santilli <strk at kbt.io>
Date:   Fri Oct 28 18:35:05 2022 +0200

    Fix bogus target of closed linestring scroll in TopoGeo_addLineString
    
    References #5081 in master branch (3.4.0dev)
    Includes regression testcase

diff --git a/liblwgeom/lwgeom_topo.c b/liblwgeom/lwgeom_topo.c
index 479a65386..a4ca8532f 100644
--- a/liblwgeom/lwgeom_topo.c
+++ b/liblwgeom/lwgeom_topo.c
@@ -18,7 +18,7 @@
  *
  **********************************************************************
  *
- * Copyright (C) 2015-2021 Sandro Santilli <strk at kbt.io>
+ * Copyright (C) 2015-2022 Sandro Santilli <strk at kbt.io>
  *
  **********************************************************************/
 
@@ -5819,9 +5819,22 @@ _lwt_AddLine(LWT_TOPOLOGY* topo, LWLINE* line, double tol, int* nedges,
     lwgeom_free(xset);
     xset = tmp;
 
+    /*
+     * Here we union the (linemerged) intersection with
+     * the difference (new lines)
+     */
+    LWDEBUG(1, "Unioning difference and (linemerged) intersection");
+    noded = lwgeom_union(diff, xset);
+    LWDEBUGG(1, noded, "Diff-Xset Unioned");
+    lwgeom_free(xset);
+    lwgeom_free(diff);
+
+    /* will not release the geoms array */
+    lwcollection_release(col);
+
     if ( input_was_closed )
     {{
-      LWLINE *scrolled = lwgeom_as_lwline(xset);
+      LWLINE *scrolled = lwgeom_as_lwline(noded);
       if (scrolled) {
         if ( lwline_is_closed(scrolled) ) {
           ptarray_scroll_in_place(scrolled->points, &originalStartPoint);
@@ -5836,18 +5849,6 @@ _lwt_AddLine(LWT_TOPOLOGY* topo, LWLINE* line, double tol, int* nedges,
     }}
 
 
-    /*
-     * Here we union the (linemerged) intersection with
-     * the difference (new lines)
-     */
-    LWDEBUG(1, "Unioning difference and (linemerged) intersection");
-    noded = lwgeom_union(diff, xset);
-    LWDEBUGG(1, noded, "Diff-Xset Unioned");
-    lwgeom_free(xset);
-    lwgeom_free(diff);
-
-    /* will not release the geoms array */
-    lwcollection_release(col);
   }}
 
 
diff --git a/topology/test/regress/topogeo_addlinestring.sql b/topology/test/regress/topogeo_addlinestring.sql
index 7a9a871ca..e9f4b6f95 100644
--- a/topology/test/regress/topogeo_addlinestring.sql
+++ b/topology/test/regress/topogeo_addlinestring.sql
@@ -467,3 +467,26 @@ AND NOT ST_Equals(
     )
   );
 SELECT NULL FROM topology.DropTopology('b4941');
+
+-- See https://trac.osgeo.org/postgis/ticket/5081
+SELECT NULL FROM CreateTopology('b5081');
+SELECT 'b5081.0', 'E' || TopoGeo_addLinestring('b5081', $$
+  LINESTRING(0 0, 10 10,10 -10,0 0)
+$$);
+
+SELECT 'b5081.1', count(*) > 1 FROM (
+  SELECT TopoGeo_addLinestring('b5081', $$
+    LINESTRING(
+      -10 0,
+      0 0, 10 10,10 -10,0 0,
+      -10 0
+    )
+  $$)
+) foo;
+SELECT 'b5081', 'dangling_edges', count(*)
+  FROM b5081.edge
+  WHERE left_face = right_face;
+SELECT 'b5081', 'faces', count(*)
+  FROM b5081.face
+  WHERE face_id > 0;
+SELECT NULL FROM topology.DropTopology('b5081');
diff --git a/topology/test/regress/topogeo_addlinestring_expected b/topology/test/regress/topogeo_addlinestring_expected
index 8b9e06aae..26b18f000 100644
--- a/topology/test/regress/topogeo_addlinestring_expected
+++ b/topology/test/regress/topogeo_addlinestring_expected
@@ -219,3 +219,7 @@ t2175.3|1
 b4941|outer_ring|1
 b4941|inner_ring|1
 b4941|crossing_line|5
+b5081.0|E1
+b5081.1|t
+b5081|dangling_edges|1
+b5081|faces|1

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

Summary of changes:
 liblwgeom/lwgeom_topo.c                            | 29 +++++++++++-----------
 topology/test/regress/topogeo_addlinestring.sql    | 23 +++++++++++++++++
 .../test/regress/topogeo_addlinestring_expected    |  4 +++
 3 files changed, 42 insertions(+), 14 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list