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

Function: _asgmledge

 

 

Schema

topology

 

Owner

albenard

 

Descriptions

There is no description for function _asgmledge

 

Options

Option

Value

Returns

text

Language

plpgsql

Parameters

edge_id integer

start_node integer

end_node integer

line public.geometry

visitedtable pg_catalog.regclass

nsprefix_in text

prec integer

options integer

idprefix text

gmlver integer

 

Definition

CREATE OR REPLACE FUNCTION topology._asgmledge (
 edge_id integer,
 start_node integer,
 end_node integer,
 line public.geometry,
 visitedtable pg_catalog.regclass,
 nsprefix_in text,
 prec integer,
 options integer,
 idprefix text,
 gmlver integer
)
RETURNS text AS
$span$
DECLARE

 visited bool;
 nsprefix text;
 gml text;
BEGIN

 nsprefix := 'gml:';
 IF nsprefix_in IS NOT NULL THEN
   IF
nsprefix_in = '' THEN
     nsprefix = nsprefix_in;
   ELSE
     nsprefix = nsprefix_in || ':';
   END IF;
 END IF;

 gml := '<' || nsprefix || 'Edge ' || nsprefix
   || 'id="' || idprefix || 'E' || edge_id || '">';

 -- Start node
 gml = gml || '<' || nsprefix || 'directedNode orientation="-"';
 -- Do visited bookkeeping if visitedTable was given
 visited = NULL;
 IF visitedTable IS NOT NULL THEN
   EXECUTE
'SELECT true FROM '
           || visitedTable::text
           || ' WHERE element_type = 1 AND element_id = '
           || start_node LIMIT 1 INTO visited;
   IF visited IS NOT NULL THEN
     gml = gml || ' xlink:href="#' || idprefix || 'N' || start_node || '" />';
   ELSE
     -- Mark as visited
     EXECUTE 'INSERT INTO ' || visitedTable::text
       || '(element_type, element_id) VALUES (1, '
       || start_node || ')';
   END IF;
 END IF;
 IF visited IS NULL THEN
   gml = gml || '>';
   gml = gml || topology._AsGMLNode(start_node, NULL, nsprefix_in,
                                    prec, options, idprefix, gmlver);
   gml = gml || '</' || nsprefix || 'directedNode>';
 END IF;

 -- End node
 gml = gml || '<' || nsprefix || 'directedNode';
 -- Do visited bookkeeping if visitedTable was given
 visited = NULL;
 IF visitedTable IS NOT NULL THEN
   EXECUTE
'SELECT true FROM '
           || visitedTable::text
           || ' WHERE element_type = 1 AND element_id = '
           || end_node LIMIT 1 INTO visited;
   IF visited IS NOT NULL THEN
     gml = gml || ' xlink:href="#' || idprefix || 'N' || end_node || '" />';
   ELSE
     -- Mark as visited
     EXECUTE 'INSERT INTO ' || visitedTable::text
       || '(element_type, element_id) VALUES (1, '
       || end_node || ')';
   END IF;
 END IF;
 IF visited IS NULL THEN
   gml = gml || '>';
   gml = gml || topology._AsGMLNode(end_node, NULL, nsprefix_in,
                                    prec, options, idprefix, gmlver);
   gml = gml || '</' || nsprefix || 'directedNode>';
 END IF;

 IF line IS NOT NULL THEN
   gml = gml || '<' || nsprefix || 'curveProperty>'
             || ST_AsGML(gmlver, line, prec, options, nsprefix_in)
             || '</' || nsprefix || 'curveProperty>';
 END IF;

 gml = gml || '</' || nsprefix || 'Edge>';

 RETURN gml;
END
$span$
LANGUAGE
'plpgsql'
VOLATILE
CALLED ON NULL INPUT
SECURITY INVOKER
COST
100;

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