]> granicus.if.org Git - postgis/commitdiff
Document ST_ChangeEdgeGeom, revise function to confirm to new plpgsql coding standard...
authorRegina Obe <lr@pcorp.us>
Tue, 24 May 2011 03:03:41 +0000 (03:03 +0000)
committerRegina Obe <lr@pcorp.us>
Tue, 24 May 2011 03:03:41 +0000 (03:03 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@7216 b70326c6-7e19-0410-871a-916f4a2858ee

doc/extras_topology.xml
topology/sql/sqlmm.sql

index f7a60e1c4e70112b1b8c01b866f7f1f306891957..bf1667201f0cffca2dd57a05058e125e3a0e954b 100644 (file)
@@ -1606,6 +1606,57 @@ Updates all existing joined edges and relationships accordingly.
                        </refsection>
                </refentry>
                
+               <refentry id="ST_ChangeEdgeGeom">
+                       <refnamediv>
+                               <refname>ST_ChangeEdgeGeom</refname>
+                       
+                               <refpurpose>Changes the linestring that define the specified edge. Will raise an error if the start and end points are not the same as the original or the new linestring
+                               crosses an existing edge (not add end points) or new linestring is not simple.</refpurpose>
+                       </refnamediv>
+               
+                       <refsynopsisdiv>
+                               <funcsynopsis>
+                                       <funcprototype>
+                                       <funcdef>integer <function>ST_ChangeEdgeGeom</function></funcdef>
+                                       <paramdef><type>varchar </type> <parameter>atopology</parameter></paramdef>
+                                       <paramdef><type>integer </type> <parameter>anedge</parameter></paramdef>
+                                       <paramdef><type>geometry </type> <parameter>acurve</parameter></paramdef>
+                                       </funcprototype>
+                               </funcsynopsis>
+                       </refsynopsisdiv>
+               
+                       <refsection>
+                <title>Description</title>
+            
+                <para>Changes the linestring that defines the specified edge. Will raise an error if the start and end points are not the same as the original or the new linestring
+                               crosses an existing edge (except at end points) or intersects another edge.</para>
+                <para>If any arguments are null, the given edge does not exist in the <varname>node</varname> table of the topology schema) ,
+                    the <varname>acurve</varname> is not a <varname>LINESTRING</varname>, the <varname>anode</varname> and <varname>anothernode</varname> are not the start 
+                    and endpoints of <varname>acurve</varname> then an error is thrown.</para>
+                <para>If the spatial reference system (srid) of the <varname>acurve</varname> geometry is not the same as the topology an exception is thrown.</para>
+                <para>If the new <varname>acurve</varname> is not simple, then an error is thrown.</para>
+             
+                <!-- use this format if new function -->
+                <para>Availability: 1.x </para>
+                <para>&sqlmm_compliant; SQL-MM: Topo-Geo and Topo-Net 3: Routine Details X.3.6</para>
+                       </refsection>
+               
+               
+                       <refsection>
+                               <title>Examples</title>
+                                SELECT topology.ST_ChangeEdgeGeom('ma_topo', 1,  ST_GeomFromText('LINESTRING(227591.9 893900.4,227622.6 893844.3,227641.6 893816.6,
+ 227704.5 893778.5)', 26986) );
+ ----
+ Edge 1 changed
+                       </refsection>
+               
+                       <!-- Optionally add a "See Also" section -->
+                       <refsection>
+                               <title>See Also</title>
+                               <para><xref linkend="ST_AddEdge"/></para>
+                       </refsection>
+               </refentry>
+               
                <refentry id="ST_ModEdgeSplit">
                        <refnamediv>
                                <refname>ST_ModEdgeSplit</refname>
@@ -1662,9 +1713,9 @@ SELECT topology.ST_ModEdgeSplit('ma_topo',  3, ST_SetSRID(ST_Point(227594,893910
                        <refsection>
                                <title>See Also</title>
                                <para>
-                               <xref linkend="ST_NewEdgesSplit"/>
-                               <xref linkend="ST_ModEdgeHeal"/>
-                               <xref linkend="ST_NewEdgeHeal"/>
+                               <xref linkend="ST_NewEdgesSplit"/>,
+                               <xref linkend="ST_ModEdgeHeal"/>,
+                               <xref linkend="ST_NewEdgeHeal"/>,
                                <xref linkend="AddEdge"/>
                                </para>
                        </refsection>
index 30b6e69f8edefd8d02a0f041a7cc2ddfd87d3faf..462694c29565ca1b9d20fa1f917807a24d2fce2e 100644 (file)
@@ -1721,13 +1721,10 @@ LANGUAGE 'plpgsql' VOLATILE;
 --
 --  ST_ChangeEdgeGeom(atopology, anedge, acurve)
 -- 
-CREATE OR REPLACE FUNCTION topology.ST_ChangeEdgeGeom(varchar, integer, geometry)
+CREATE OR REPLACE FUNCTION topology.ST_ChangeEdgeGeom(atopology varchar, anedge integer, acurve geometry)
        RETURNS TEXT AS
 $$
 DECLARE
-       atopology ALIAS FOR $1;
-       anedge ALIAS FOR $2;
-       acurve ALIAS FOR $3;
        aface INTEGER;
        face GEOMETRY;
        snodegeom GEOMETRY;
@@ -1809,8 +1806,7 @@ BEGIN
        -- 
        FOR rec IN EXECUTE 'SELECT node_id FROM '
                || quote_ident(atopology) || '.node
-               WHERE geom && ' || quote_literal(acurve::text) || '::geometry
-               AND ST_Within(geom, ' || quote_literal(acurve::text) || '::geometry)'
+               WHERE ST_Within(geom, ' || quote_literal(acurve::text) || '::geometry)'
        LOOP
                RAISE EXCEPTION
                'SQL/MM Spatial exception - geometry crosses a node';
@@ -1822,8 +1818,6 @@ BEGIN
        FOR rec IN EXECUTE 'SELECT * FROM '
                || quote_ident(atopology) || '.edge_data '
                || ' WHERE edge_id != ' || anedge
-               || ' AND geom && '
-               || quote_literal(acurve::text) || '::geometry '
                || ' AND ST_Intersects(geom, '
                || quote_literal(acurve::text) || '::geometry)'
        LOOP