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

Sandro Santilli strk at keybit.net
Thu Oct 29 01:56:03 PDT 2015


Author: strk
Date: 2015-10-29 01:56:03 -0700 (Thu, 29 Oct 2015)
New Revision: 14338

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

See #3351

Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2015-10-29 08:49:46 UTC (rev 14337)
+++ trunk/NEWS	2015-10-29 08:56:03 UTC (rev 14338)
@@ -5,7 +5,6 @@
  * Deprecated signatures *
  * New Features *
 
-
 PostGIS 2.2.0
 2015/10/07
 

Modified: trunk/liblwgeom/lwgeom_topo.c
===================================================================
--- trunk/liblwgeom/lwgeom_topo.c	2015-10-29 08:49:46 UTC (rev 14337)
+++ trunk/liblwgeom/lwgeom_topo.c	2015-10-29 08:56:03 UTC (rev 14338)
@@ -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: trunk/topology/test/regress/sqlmm.sql
===================================================================
--- trunk/topology/test/regress/sqlmm.sql	2015-10-29 08:49:46 UTC (rev 14337)
+++ trunk/topology/test/regress/sqlmm.sql	2015-10-29 08:56:03 UTC (rev 14338)
@@ -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: trunk/topology/test/regress/sqlmm_expected
===================================================================
--- trunk/topology/test/regress/sqlmm_expected	2015-10-29 08:49:46 UTC (rev 14337)
+++ trunk/topology/test/regress/sqlmm_expected	2015-10-29 08:56:03 UTC (rev 14338)
@@ -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