]> granicus.if.org Git - postgis/commitdiff
Test that healing of two edges is forbidden if any topogeom is defined by only one...
authorSandro Santilli <strk@keybit.net>
Wed, 4 May 2011 18:20:11 +0000 (18:20 +0000)
committerSandro Santilli <strk@keybit.net>
Wed, 4 May 2011 18:20:11 +0000 (18:20 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@7088 b70326c6-7e19-0410-871a-916f4a2858ee

topology/sql/sqlmm.sql
topology/test/regress/st_modedgeheal.sql
topology/test/regress/st_modedgeheal_expected

index 5518af3d56c137ccab585636c5916876ff4c47df..bb9956c934946b10018c2eab0c44629d195d7cfb 100644 (file)
@@ -168,11 +168,9 @@ BEGIN
     || ' AND l.topology_id = ' || topoid
     || ' AND abs(r.element_id) IN (' || e1id || ',' || e2id || ') '
     || 'group by r.topogeo_id, r.layer_id, l.schema_name, l.table_name, '
-    || ' l.feature_column ) t WHERE t.elems && '
-    || quote_literal(eidary) 
-    || ' AND NOT t.elems @> '
+    || ' l.feature_column ) t WHERE NOT t.elems @> '
     || quote_literal(eidary);
-  RAISE DEBUG 'SQL: %', sql;
+  --RAISE DEBUG 'SQL: %', sql;
   FOR rec IN EXECUTE sql LOOP
     RAISE EXCEPTION 'TopoGeom % in layer % (%.%.%) cannot be represented healing edges % and %',
           rec.topogeo_id, rec.layer_id,
@@ -329,7 +327,6 @@ BEGIN
        -- We only take into considerations non-hierarchical
        -- TopoGeometry here, for obvious reasons.
        --
-
   -- Now we can safely drop composition rows involving second
   -- edge, as the first edge took its space.
 
index 9ecb82f9a4a4f44ce1884fc4497b2416c4679c5e..d4d9b649eaaad0b2cb683ef5919ef3d689ee328a 100644 (file)
@@ -55,7 +55,57 @@ SELECT 'N'||node_id FROM city_data.node;
 -- clean up
 SELECT topology.DropTopology('city_data');
 
--- TODO: add TopoGeometry tests !
+-------------------------------------------------------------------------
+-------------------------------------------------------------------------
+-------------------------------------------------------------------------
+
+-- Now test in presence of features 
+
+SELECT topology.CreateTopology('t') > 1;
+CREATE TABLE t.f(id varchar);
+SELECT topology.AddTopoGeometryColumn('t', 't', 'f','g', 'LINE');
+
+SELECT 'E'||topology.AddEdge('t', 'LINESTRING(2 2, 2  8)');        -- 1
+SELECT 'E'||topology.AddEdge('t', 'LINESTRING(2  8,  8  8)');      -- 2
+
+INSERT INTO t.f VALUES ('F+E1',
+  topology.CreateTopoGeom('t', 2, 1, '{{1,2}}')); 
+
+-- This should be forbidden, as F+E1 above could not be
+-- defined w/out one of the edges
+SELECT 'MH(1,2)', topology.ST_ModEdgeHeal('t', 1, 2);
+SELECT 'MH(2,1)', topology.ST_ModEdgeHeal('t', 2, 1);
+
+-- Now see how signed edges are updated
+
+--SELECT 'E'||topology.AddEdge('t', 'LINESTRING(0 0, 5 0)');         -- 3
+--SELECT 'E'||topology.AddEdge('t', 'LINESTRING(10 0, 5 0)');        -- 4
+--
+--INSERT INTO t.f VALUES ('F+E3-E4',
+--  topology.CreateTopoGeom('t', 2, 1, '{{3,2},{-4,2}}')); 
+--INSERT INTO t.f VALUES ('F-E3+E4',
+--  topology.CreateTopoGeom('t', 2, 1, '{{-3,2},{4,2}}')); 
+--
+--SELECT r.topogeo_id, r.element_id
+--  FROM t.relation r, t.f f WHERE 
+--  r.layer_id = layer_id(f.g) AND r.topogeo_id = id(f.g)
+--  ORDER BY r.layer_id, r.topogeo_id;
+--
+---- This is fine, but will have to tweak definition of
+---- 'F+E3-E4' and 'F-E3+E4'
+--SELECT 'MH(3,4)', topology.ST_ModEdgeHeal('t', 3, 4);
+--
+--SELECT r.topogeo_id, r.element_id
+--  FROM t.relation r, t.f f WHERE 
+--  r.layer_id = layer_id(f.g) AND r.topogeo_id = id(f.g)
+--  ORDER BY r.layer_id, r.topogeo_id;
+
+SELECT topology.DropTopology('t');
+
+-------------------------------------------------------------------------
+-------------------------------------------------------------------------
+-------------------------------------------------------------------------
+
 -- TODO: test registered but unexistent topology
 -- TODO: test registered but corrupted topology
 --       (missing node, edge, relation...)
index 392a65788fa5f963de0d35094875ae04691fc563..b19e2e3d000fe734ca428fd4b78f74bb20c5b59f 100644 (file)
@@ -101,3 +101,10 @@ N20
 N21
 N22
 Topology 'city_data' dropped
+t
+1
+E1
+E2
+ERROR:  TopoGeom 1 in layer 1 (t.f.g) cannot be represented healing edges 1 and 2
+ERROR:  TopoGeom 1 in layer 1 (t.f.g) cannot be represented healing edges 2 and 1
+Topology 't' dropped