[postgis-tickets] r14804 - Remove unused function

Sandro Santilli strk at keybit.net
Wed Mar 23 04:46:18 PDT 2016


Author: strk
Date: 2016-03-23 04:46:17 -0700 (Wed, 23 Mar 2016)
New Revision: 14804

Modified:
   trunk/topology/sql/sqlmm.sql.in
Log:
Remove unused function

Modified: trunk/topology/sql/sqlmm.sql.in
===================================================================
--- trunk/topology/sql/sqlmm.sql.in	2016-03-22 20:06:13 UTC (rev 14803)
+++ trunk/topology/sql/sqlmm.sql.in	2016-03-23 11:46:17 UTC (rev 14804)
@@ -306,205 +306,6 @@
   LANGUAGE 'c' VOLATILE;
 --} ST_ChangeEdgeGeom
 
---
--- _ST_AddFaceSplit
---
--- Add a split face by walking on the edge side.
---
--- @param atopology topology name
--- @param anedge edge id and walking side (left:positive right:negative)
--- @param oface the face in which the edge identifier is known to be
--- @param mbr_only do not create a new face but update MBR of the current
---
--- The created face, if any, will be at the left hand of the walking path
---
--- Return:
---  NULL: if mbr_only was requested
---     0: if the edge does not form a ring
---  NULL: if it is impossible to create a face on the requested side
---        ( new face on the side is the universe )
---   >0 : id of newly added face
---
--- {
-CREATE OR REPLACE FUNCTION topology._ST_AddFaceSplit(atopology varchar, anedge integer, oface integer, mbr_only bool)
-  RETURNS INTEGER AS
-$$
-DECLARE
-  fan RECORD;
-  newface INTEGER;
-  sql TEXT;
-  isccw BOOLEAN;
-  ishole BOOLEAN;
-
-BEGIN
-
-  IF oface = 0 AND mbr_only THEN
-#ifdef POSTGIS_TOPOLOGY_DEBUG
-    RAISE DEBUG 'Universal face has no MBR, doing nothing';
-#endif
-    RETURN NULL;
-  END IF;
-
-  SELECT null::int[] as newring_edges,
-         null::geometry as shell
-  INTO fan;
-
-  SELECT array_agg(edge)
-  FROM topology.getringedges(atopology, anedge)
-  INTO STRICT fan.newring_edges;
-
-#ifdef POSTGIS_TOPOLOGY_DEBUG
-  RAISE DEBUG 'ring: %', fan.newring_edges;
-#endif
-
-  -- You can't get to the other side of an edge forming a ring 
-  IF fan.newring_edges @> ARRAY[-anedge] THEN
-#ifdef POSTGIS_TOPOLOGY_DEBUG
-    RAISE DEBUG 'not a ring';
-#endif
-    RETURN 0;
-  END IF;
-
-#ifdef POSTGIS_TOPOLOGY_DEBUG
-  RAISE DEBUG 'Edge % split face %', anedge, oface;
-#endif
-
-  sql := 'WITH ids as ( select row_number() over () as seq, edge '
-    || 'from unnest($1) u(edge) ), edges AS ( select CASE WHEN i.edge < 0 '
-    || 'THEN ST_Reverse(e.geom) ELSE e.geom END as g FROM ids i left join '
-    || quote_ident(atopology) || '.edge_data e ON(e.edge_id = abs(i.edge)) '
-    || 'ORDER BY seq) SELECT ST_MakePolygon(ST_MakeLine(g.g)) FROM edges g';
-#ifdef POSTGIS_TOPOLOGY_DEBUG
-  RAISE DEBUG '%', sql;
-#endif
-  EXECUTE sql INTO fan.shell USING
-    fan.newring_edges
-  ;
-
-#ifdef POSTGIS_TOPOLOGY_DEBUG
-  RAISE DEBUG 'got shell'; 
-#endif
-
-  isccw := NOT ST_OrderingEquals(fan.shell, ST_ForceRHR(fan.shell));
-
-#ifdef POSTGIS_TOPOLOGY_DEBUG
-  RAISE DEBUG 'winding: %', CASE WHEN isccw THEN 'CCW' ELSE 'CW' END;
-#endif
-
-  IF oface = 0 THEN
-    IF NOT isccw THEN
-#ifdef POSTGIS_TOPOLOGY_DEBUG
-      RAISE DEBUG 'Not considering CW ring in universe face';
-#endif
-      RETURN NULL;
-    END IF;
-  END IF;
-
-  IF mbr_only AND oface != 0 THEN
-    -- Update old face mbr (nothing to do if we're opening an hole)
-    IF isccw THEN -- {
-      sql := 'UPDATE '
-        || quote_ident(atopology)
-        || '.face SET mbr = $1 WHERE face_id = $2';
-#ifdef POSTGIS_TOPOLOGY_DEBUG
-    	RAISE DEBUG 'Updating old face mbr'; 
-#endif
-    	EXECUTE sql USING
-        ST_Envelope(fan.shell),
-        oface
-      ;
-    END IF; -- }
-    RETURN NULL;
-  END IF;
-
-  IF oface != 0 AND NOT isccw THEN -- {
-    -- Face created an hole in an outer face
-    sql := 'INSERT INTO '
-      || quote_ident(atopology) || '.face(mbr) SELECT mbr FROM '
-      || quote_ident(atopology)
-      || '.face WHERE face_id = ' || oface
-      || ' RETURNING face_id';
-  ELSE
-    sql := 'INSERT INTO '
-      || quote_ident(atopology) || '.face(mbr) VALUES ($1) RETURNING face_id';
-  END IF; -- }
-
-  -- Insert new face
-#ifdef POSTGIS_TOPOLOGY_DEBUG
-  RAISE DEBUG 'Inserting new face'; 
-#endif
-  EXECUTE sql INTO STRICT newface USING ST_Envelope(fan.shell);
-
-  -- Update forward edges
-  sql := 'UPDATE ' || quote_ident(atopology) ||
-    '.edge_data SET left_face = $1 WHERE edge_id = ANY($3)'
-  ;
-#ifdef POSTGIS_TOPOLOGY_DEBUG
-  RAISE DEBUG 'Updating backward and forward edges in new ring: %', sql;
-#endif
-  EXECUTE sql USING newface, oface,
-    array(select +x from unnest(fan.newring_edges) u(x) where x > 0)
-  ;
-
-  -- Update backward edges
-  sql := 'UPDATE ' || quote_ident(atopology) ||
-    '.edge_data SET right_face = $1 WHERE edge_id = ANY($3)'
-  ;
-#ifdef POSTGIS_TOPOLOGY_DEBUG
-  RAISE DEBUG 'Updating backward edges in new ring: %', sql;
-#endif
-  EXECUTE sql USING newface, oface,
-    array(select -x from unnest(fan.newring_edges) u(x) where x < 0)
-  ;
-
-  IF oface != 0 AND NOT isccw THEN -- {
-    -- face shrinked, must update all non-contained edges and nodes
-#ifdef POSTGIS_TOPOLOGY_DEBUG
-    RAISE DEBUG 'Updating rings in former shell';
-#endif
-    ishole := true;
-  ELSE
-#ifdef POSTGIS_TOPOLOGY_DEBUG
-    RAISE DEBUG 'Updating contained edges';
-#endif
-    ishole := false;
-  END IF; -- }
-
-  -- Update edges bounding the old face
-  sql := 'UPDATE '
-    || quote_ident(atopology)
-    || '.edge_data SET left_face = CASE WHEN left_face = $2 THEN $3'
-    || ' ELSE left_face END, right_face = CASE WHEN right_face = $2 '
-    || ' THEN $3 ELSE right_face END WHERE ( left_face = $2 '
-    || ' OR right_face = $2 ) AND NOT edge_id = ANY ($4) AND ';
-  IF ishole THEN sql := sql || 'NOT '; END IF;
-  sql := sql || '($1 && geom AND _ST_Contains($1'
-    -- We only need to check a single point, but must not be an endpoint
-    || ', ST_LineInterpolatePoint(geom, 0.2)) )';
-#ifdef POSTGIS_TOPOLOGY_DEBUG
-  RAISE DEBUG 'Updating edges bounding the old face: %', sql;
-#endif
-  EXECUTE sql USING fan.shell, oface, newface,
-    array(select abs(x) from unnest(fan.newring_edges) u(x));
-
-  -- Update isolated nodes in new new face 
-  sql := 'UPDATE '
-    || quote_ident(atopology) || '.node SET containing_face = $2 '
-    || ' WHERE containing_face = $3 AND ';
-  IF ishole THEN sql := sql || 'NOT '; END IF;
-  sql := sql || 'ST_Contains($1, geom)';
-#ifdef POSTGIS_TOPOLOGY_DEBUG
-  RAISE DEBUG 'Updating isolated nodes in old face';
-#endif
-  EXECUTE sql USING fan.shell, newface, oface;
-
-  RETURN newface;
-
-END
-$$
-LANGUAGE 'plpgsql' VOLATILE;
---}
-
 --{
 -- Topo-Geo and Topo-Net 3: Routine Details
 -- X.3.12



More information about the postgis-tickets mailing list