From: Sandro Santilli Date: Mon, 23 May 2011 13:13:21 +0000 (+0000) Subject: Fix test for ST_AddIsoEdge verifying "geometry intersects an edge" exception. Fix... X-Git-Tag: 2.0.0alpha1~1600 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e87586fdb1f197aa46b91f177632b98c8296f76b;p=postgis Fix test for ST_AddIsoEdge verifying "geometry intersects an edge" exception. Fix exception message raised when attempting to insert a closed edge. Update regress test accoringly. git-svn-id: http://svn.osgeo.org/postgis/trunk@7213 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/topology/sql/sqlmm.sql b/topology/sql/sqlmm.sql index b0c33ff2b..b93b04608 100644 --- a/topology/sql/sqlmm.sql +++ b/topology/sql/sqlmm.sql @@ -1575,8 +1575,13 @@ BEGIN END LOOP; IF count < 2 THEN - RAISE EXCEPTION - 'SQL/MM Spatial exception - non-existent node'; + IF count = 1 AND anode = anothernode THEN + RAISE EXCEPTION + 'Closed edges would not be isolated, try ST_AddEdgeNewFaces'; + ELSE + RAISE EXCEPTION + 'SQL/MM Spatial exception - non-existent node'; + END IF; END IF; @@ -1654,17 +1659,15 @@ BEGIN 'SQL/MM Spatial exception - geometry crosses a node'; END LOOP; - -- - -- o) Check if curve intersects any other edge - -- - FOR rec IN EXECUTE 'SELECT * FROM ' - || quote_ident(atopology) || '.edge_data - WHERE geom && ' || quote_literal(acurve::text) || '::geometry - AND ST_Intersects(geom, ' || quote_literal(acurve::text) || '::geometry)' - LOOP - RAISE EXCEPTION - 'SQL/MM Spatial exception - geometry intersects an edge'; - END LOOP; + -- + -- o) Check if curve intersects any other edge + -- + FOR rec IN EXECUTE 'SELECT * FROM ' + || quote_ident(atopology) || '.edge_data + WHERE ST_Intersects(geom, ' || quote_literal(acurve::text) || '::geometry)' + LOOP + RAISE EXCEPTION 'SQL/MM Spatial exception - geometry intersects an edge'; + END LOOP; -- -- Get new edge id from sequence diff --git a/topology/test/regress/st_addisoedge.sql b/topology/test/regress/st_addisoedge.sql index 2c1e4dbbe..d566dafa6 100644 --- a/topology/test/regress/st_addisoedge.sql +++ b/topology/test/regress/st_addisoedge.sql @@ -57,9 +57,13 @@ SELECT topology.ST_AddIsoEdge('sqlmm_topology', SELECT topology.ST_AddIsoEdge('sqlmm_topology', 5, 6, 'LINESTRING(10 10, 20 10)'); +-- Not isolated edge (shares endpoint with self) +SELECT topology.ST_AddIsoEdge('sqlmm_topology', + 3, 3, 'LINESTRING(5 0, 4 -2, 6 -2, 5 0)'); + -- Edge intersection (geometry intersects an edge) SELECT topology.ST_AddIsoEdge('sqlmm_topology', - 1, 2, 'LINESTRING(0 0, 2 20, 10 0)'); + 3, 6, 'LINESTRING(5 0, 20 10)'); -- TODO: check closed edge (not-isolated I guess...) -- on different faces (TODO req. nodes contained in face) diff --git a/topology/test/regress/st_addisoedge_expected b/topology/test/regress/st_addisoedge_expected index 78dabd108..f62f1242d 100644 --- a/topology/test/regress/st_addisoedge_expected +++ b/topology/test/regress/st_addisoedge_expected @@ -25,5 +25,6 @@ N5| N6|0 ERROR: SQL/MM Spatial exception - not isolated node ERROR: SQL/MM Spatial exception - not isolated node -ERROR: SQL/MM Spatial exception - not isolated node +ERROR: Closed edges would not be isolated, try ST_AddEdgeNewFaces +ERROR: SQL/MM Spatial exception - geometry intersects an edge Topology 'sqlmm_topology' dropped