pggeodb.nancy.inra.fr/db_robot - db_robot on pggeodb.nancy.inra.fr
Previous topic Chapter index Next topic

Function: getringedges

 

 

Schema

topology

 

Owner

albenard

 

Descriptions

args: atopology, aring, max_edges=null - Returns the ordered set of signed edge identifiers met by walking on ana given edge side.

 

Options

Option

Value

Returns

Set of topology.getfaceedges_returntype

Language

plpgsql

Parameters

atopology varchar

anedge integer

maxedges integer = NULL::integer

 

Definition

CREATE OR REPLACE FUNCTION topology.getringedges (
 atopology varchar,
 anedge integer,
 maxedges integer = NULL::integer
)
RETURNS SETOF topology.getfaceedges_returntype AS
$span$
DECLARE

 rec RECORD;
 retrec topology.GetFaceEdges_ReturnType;
 n int;
 sql text;
BEGIN
 sql := 'WITH RECURSIVE edgering AS ( SELECT '
   || anedge
   || ' as signed_edge_id, edge_id, next_left_edge, next_right_edge FROM '
   || quote_ident(atopology)
   || '.edge_data WHERE edge_id = '
   || abs(anedge)
   || ' UNION '
   || ' SELECT CASE WHEN p.signed_edge_id < 0 THEN p.next_right_edge '
   || ' ELSE p.next_left_edge END, e.edge_id, e.next_left_edge, e.next_right_edge '
   || ' FROM ' || quote_ident(atopology)
   || '.edge_data e, edgering p WHERE e.edge_id = CASE WHEN p.signed_edge_id < 0 '
   || 'THEN abs(p.next_right_edge) ELSE abs(p.next_left_edge) END ) SELECT * FROM edgering';

 n := 1;
 FOR rec IN EXECUTE sql
 LOOP
   retrec.sequence := n;
   retrec.edge := rec.signed_edge_id;
   RETURN NEXT retrec;

   n := n + 1;

   IF n > maxedges THEN
     RAISE EXCEPTION
'Max traversing limit hit: %', maxedges;
   END IF;
 END LOOP;

END
$span$
LANGUAGE
'plpgsql'
STABLE
CALLED ON NULL INPUT
SECURITY INVOKER
COST
100 ROWS 1000;

COMMENT ON FUNCTION topology.getringedges(atopology varchar, anedge integer, maxedges integer)
IS 'args: atopology, aring, max_edges=null - Returns the ordered set of signed edge identifiers met by walking on ana given edge side.';

This file was generated with SQL Manager for PostgreSQL (www.pgsqlmanager.com) at 26/02/2014 11:51
Previous topic Chapter index Next topic