]> granicus.if.org Git - postgis/commitdiff
Test passing polygons with holes to topology.AddFace [RT-SIGTA]
authorSandro Santilli <strk@keybit.net>
Fri, 18 Feb 2011 14:58:41 +0000 (14:58 +0000)
committerSandro Santilli <strk@keybit.net>
Fri, 18 Feb 2011 14:58:41 +0000 (14:58 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@6845 b70326c6-7e19-0410-871a-916f4a2858ee

topology/test/regress/addface.sql
topology/test/regress/addface_expected
topology/test/regress/createtopogeom_expected

index 214652be3a1240245d8aef055e2ea7cd11ef6a66..b05af3dc731f5974393122dc26628adc924267c6 100644 (file)
@@ -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');
index 73c4035933b9fad6238e9bab89c8b0fb44fddd62..ed6d8ec2bb38f24268ce569f3530b16a217f594e 100644 (file)
@@ -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
index c6811bef9b9b6733f12cacff9d145361f3ac018e..127a113b8e746e7231875165478b88eb40886944 100644 (file)
@@ -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