[postgis-tickets] r14337 - Set endpoints isolation in lwt_RemIsoEdge (ST_RemoveIsoEdge)

Sandro Santilli strk at keybit.net
Thu Oct 29 01:49:46 PDT 2015


Author: strk
Date: 2015-10-29 01:49:46 -0700 (Thu, 29 Oct 2015)
New Revision: 14337

Modified:
   branches/2.2/NEWS
   branches/2.2/liblwgeom/lwgeom_topo.c
   branches/2.2/topology/test/regress/sqlmm.sql
   branches/2.2/topology/test/regress/sqlmm_expected
Log:
Set endpoints isolation in lwt_RemIsoEdge (ST_RemoveIsoEdge)

See #3351

Modified: branches/2.2/NEWS
===================================================================
--- branches/2.2/NEWS	2015-10-29 08:37:37 UTC (rev 14336)
+++ branches/2.2/NEWS	2015-10-29 08:49:46 UTC (rev 14337)
@@ -3,6 +3,8 @@
 
  * Bug Fixes *
 
+  - #3351, set endnodes isolation on ST_RemoveIsoEdge
+           (and lwt_RemIsoEdge)
   - #3349, Fix installation path of postgis_topology scripts
   - #3329, Fix robustness regression in TopoGeo_addPoint
   - #3321, Fix performance regression in topology loading

Modified: branches/2.2/liblwgeom/lwgeom_topo.c
===================================================================
--- branches/2.2/liblwgeom/lwgeom_topo.c	2015-10-29 08:37:37 UTC (rev 14336)
+++ branches/2.2/liblwgeom/lwgeom_topo.c	2015-10-29 08:49:46 UTC (rev 14337)
@@ -3691,6 +3691,8 @@
   LWT_ISO_EDGE deledge;
   LWT_ISO_EDGE *edge;
   LWT_ELEMID nid[2];
+  LWT_ISO_NODE upd_node[2];
+  LWT_ELEMID containing_face;
   int n = 1;
   int i;
 
@@ -3722,6 +3724,7 @@
     lwerror("SQL/MM Spatial exception - not isolated edge");
     return -1;
   }
+  containing_face = edge[0].face_left;
 
   nid[0] = edge[0].start_node;
   nid[1] = edge[0].end_node;
@@ -3756,6 +3759,22 @@
     return -1;
   }
 
+  upd_node[0].node_id = nid[0];
+  upd_node[0].containing_face = containing_face;
+  n = 1;
+  if ( nid[1] != nid[0] ) {
+    upd_node[1].node_id = nid[1];
+    upd_node[1].containing_face = containing_face;
+    ++n;
+  }
+  n = lwt_be_updateNodesById(topo, upd_node, n,
+                               LWT_COL_NODE_CONTAINING_FACE);
+  if ( n == -1 )
+  {
+    lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
+    return -1;
+  }
+
   /* TODO: notify to caller about edge being removed ?
    * See https://trac.osgeo.org/postgis/ticket/3248
    */

Modified: branches/2.2/topology/test/regress/sqlmm.sql
===================================================================
--- branches/2.2/topology/test/regress/sqlmm.sql	2015-10-29 08:37:37 UTC (rev 14336)
+++ branches/2.2/topology/test/regress/sqlmm.sql	2015-10-29 08:49:46 UTC (rev 14337)
@@ -135,7 +135,26 @@
 -------------------------------------------------------------
 SELECT '-- ST_RemoveIsoEdge ---------------------';
 
+CREATE TEMP TABLE edge1_endnodes AS
+  WITH edge AS (
+    SELECT start_node,end_node
+    FROM sqlmm_topology.edge_data
+    WHERE edge_id = 1
+  )
+  SELECT start_node id FROM edge UNION
+  SELECT end_node FROM edge;
+SELECT '#3351.1', node_id, containing_face
+ FROM sqlmm_topology.node where node_id in (
+    SELECT id FROM edge1_endnodes
+  )
+ ORDER BY node_id;
 SELECT topology.ST_RemoveIsoEdge('sqlmm_topology', 1);
+SELECT '#3351.2', node_id, containing_face
+ FROM sqlmm_topology.node where node_id in (
+    SELECT id FROM edge1_endnodes
+  )
+ ORDER BY node_id;
+DROP TABLE edge1_endnodes;
 
 -------------------------------------------------------------
 -- ST_NewEdgesSplit

Modified: branches/2.2/topology/test/regress/sqlmm_expected
===================================================================
--- branches/2.2/topology/test/regress/sqlmm_expected	2015-10-29 08:37:37 UTC (rev 14336)
+++ branches/2.2/topology/test/regress/sqlmm_expected	2015-10-29 08:49:46 UTC (rev 14337)
@@ -47,7 +47,11 @@
 Isolated Node 8 moved to location 7,11
 Isolated Node 8 moved to location 7,10
 -- ST_RemoveIsoEdge ---------------------
+#3351.1|4|
+#3351.1|5|
 Isolated edge 1 removed
+#3351.2|4|0
+#3351.2|5|0
 -- ST_NewEdgesSplit  ---------------------
 9
 Topology 'sqlmm_topology' dropped



More information about the postgis-tickets mailing list