]> granicus.if.org Git - postgis/commitdiff
Fix test for ST_AddIsoEdge verifying "geometry intersects an edge" exception. Fix...
authorSandro Santilli <strk@keybit.net>
Mon, 23 May 2011 13:13:21 +0000 (13:13 +0000)
committerSandro Santilli <strk@keybit.net>
Mon, 23 May 2011 13:13:21 +0000 (13:13 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@7213 b70326c6-7e19-0410-871a-916f4a2858ee

topology/sql/sqlmm.sql
topology/test/regress/st_addisoedge.sql
topology/test/regress/st_addisoedge_expected

index b0c33ff2bdaf24267af8885eec0140807dbf6ad7..b93b04608e6d5ed7ad0ef37897332047b2b605d2 100644 (file)
@@ -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
index 2c1e4dbbe36171579e02c1aa792da4e2b3f54575..d566dafa6a066d63372f7dddabed80eae46e4273 100644 (file)
@@ -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)
index 78dabd108d2383f89b1937ef37ac7aadc2eaa23d..f62f1242dca40dc23f526c92459ac6ff26448e22 100644 (file)
@@ -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