Test that healing of two edges is forbidden if any topogeom is defined by only one of them [RT-SIGTA]

git-svn-id: http://svn.osgeo.org/postgis/trunk@7088 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
Sandro Santilli 2011-05-04 18:20:11 +00:00
parent 5cc632dd81
commit ce9f044415
3 changed files with 60 additions and 6 deletions

View 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.

View 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...)

View 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