From: Sandro Santilli Date: Fri, 18 Feb 2011 14:58:41 +0000 (+0000) Subject: Test passing polygons with holes to topology.AddFace [RT-SIGTA] X-Git-Tag: 2.0.0alpha1~1955 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=79e3fdbacc5d14befe69a5b984a158189c91524c;p=postgis Test passing polygons with holes to topology.AddFace [RT-SIGTA] git-svn-id: http://svn.osgeo.org/postgis/trunk@6845 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/topology/test/regress/addface.sql b/topology/test/regress/addface.sql index 214652be3..b05af3dc7 100644 --- a/topology/test/regress/addface.sql +++ b/topology/test/regress/addface.sql @@ -50,3 +50,60 @@ SELECT 'MiX-e3', topology.addEdge('Ul', 'LINESTRING(0 10, 10 10)'); SELECT 'MiX-e4', topology.addEdge('Ul', 'LINESTRING(0 0, 0 10)'); SELECT 'MiX-f1', topology.addFace('Ul', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'); SELECT topology.DropTopology('Ul'); + +-- Test polygons with holes +SELECT topology.CreateTopology('t2') > 0; + +-- Edges forming two squares +SELECT 't2.e1', topology.addEdge('t2', 'LINESTRING(0 0, 10 0)'); +SELECT 't2.e2', topology.addEdge('t2', 'LINESTRING(10 0, 10 10)'); +SELECT 't2.e3', topology.addEdge('t2', 'LINESTRING(0 10, 10 10)'); +SELECT 't2.e4', topology.addEdge('t2', 'LINESTRING(0 0, 0 10)'); +SELECT 't2.e5', topology.addEdge('t2', 'LINESTRING(10 10, 20 10)'); +SELECT 't2.e6', topology.addEdge('t2', 'LINESTRING(20 10, 20 0)'); +SELECT 't2.e7', topology.addEdge('t2', 'LINESTRING(20 0, 10 0)'); + +-- Clockwise hole within the square on the left +SELECT 't2.e8', topology.addEdge('t2', 'LINESTRING(1 1, 1 2, 2 2, 2 1, 1 1)'); +-- Counter-clockwise hole within the square on the left +SELECT 't2.e9', topology.addEdge('t2', 'LINESTRING(3 1,4 1,4 2,3 2,3 1)'); + +-- Multi-edge hole within the square on the right +SELECT 't2.e10', topology.addEdge('t2', 'LINESTRING(12 2, 14 2, 14 4)'); +SELECT 't2.e11', topology.addEdge('t2', 'LINESTRING(12 2, 12 4, 14 4)'); + +-- Register left face with two holes +SELECT 't2.f1', topology.addFace('t2', +'POLYGON((0 0,10 0,10 10,0 10,0 0), + (1 1,2 1,2 2,1 2,1 1), + (3 1,3 2,4 2,4 1,3 1))' +); + +-- Register right face with one hole +SELECT 't2.f2', topology.addFace('t2', +'POLYGON((20 0,10 0,10 10,20 10,20 0), + (12 2,14 2,14 4,12 4, 12 2))' +); + +-- Register left hole in left square +SELECT 't2.f3', topology.addFace('t2', +'POLYGON((1 1,2 1,2 2,1 2,1 1))' +); + +-- Register right hole in left square +SELECT 't2.f4', topology.addFace('t2', +'POLYGON((3 1,4 1,4 2,3 2,3 1))' +); + +-- Register hole in right face +SELECT 't2.f5', topology.addFace('t2', +'POLYGON((12 2,12 4,14 4,14 2,12 2))' +); + +-- Check added faces +SELECT face_id, Box2d(mbr) from t2.face ORDER by face_id; + +-- Check linking +SELECT edge_id, left_face, right_face from t2.edge ORDER by edge_id; + +SELECT topology.DropTopology('t2'); diff --git a/topology/test/regress/addface_expected b/topology/test/regress/addface_expected index 73c403593..ed6d8ec2b 100644 --- a/topology/test/regress/addface_expected +++ b/topology/test/regress/addface_expected @@ -37,3 +37,48 @@ WARNING: Not checking if face contains any edge WARNING: Not updating next_{left,right}_face fields of face boundary edges MiX-f1|1 Topology 'Ul' dropped +t +t2.e1|1 +t2.e2|2 +t2.e3|3 +t2.e4|4 +t2.e5|5 +t2.e6|6 +t2.e7|7 +t2.e8|8 +t2.e9|9 +t2.e10|10 +t2.e11|11 +WARNING: Not checking if face contains any edge +WARNING: Not updating next_{left,right}_face fields of face boundary edges +t2.f1|1 +WARNING: Not checking if face contains any edge +WARNING: Not updating next_{left,right}_face fields of face boundary edges +t2.f2|2 +WARNING: Not checking if face contains any edge +WARNING: Not updating next_{left,right}_face fields of face boundary edges +t2.f3|3 +WARNING: Not checking if face contains any edge +WARNING: Not updating next_{left,right}_face fields of face boundary edges +t2.f4|4 +WARNING: Not checking if face contains any edge +WARNING: Not updating next_{left,right}_face fields of face boundary edges +t2.f5|5 +0| +1|BOX(0 0,10 10) +2|BOX(10 0,20 10) +3|BOX(1 1,2 2) +4|BOX(3 1,4 2) +5|BOX(12 2,14 4) +1|1|0 +2|1|2 +3|0|1 +4|0|1 +5|0|2 +6|0|2 +7|0|2 +8|1|3 +9|4|1 +10|5|2 +11|2|5 +Topology 't2' dropped diff --git a/topology/test/regress/createtopogeom_expected b/topology/test/regress/createtopogeom_expected index c6811bef9..127a113b8 100644 --- a/topology/test/regress/createtopogeom_expected +++ b/topology/test/regress/createtopogeom_expected @@ -7,5 +7,5 @@ ERROR: A Layer of type 1 cannot contain a TopoGeometry of type 4 ERROR: Node 78 does not exist in topology MiX PL/pgSQL function "createtopogeom" line 91 at EXECUTE statement n1|1 -(15,1,2,1) +(16,1,2,1) Topology 'MiX' dropped