Support faces with all edges on the same side, and test [RT-SIGTA]

git-svn-id: http://svn.osgeo.org/postgis/trunk@6474 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
Sandro Santilli 2010-12-22 18:45:07 +00:00
parent c63e74019e
commit 9d2b1faeb4
3 changed files with 38 additions and 15 deletions

View file

@ -420,24 +420,28 @@ BEGIN
--
-- Update all edges having this face on the left
--
EXECUTE 'UPDATE '
|| quote_ident(atopology)
|| '.edge_data SET left_face = '
|| quote_literal(faceid)
|| ' WHERE edge_id = ANY('
|| quote_literal(left_edges)
|| ') ';
IF left_edges IS NOT NULL THEN
EXECUTE 'UPDATE '
|| quote_ident(atopology)
|| '.edge_data SET left_face = '
|| quote_literal(faceid)
|| ' WHERE edge_id = ANY('
|| quote_literal(left_edges)
|| ') ';
END IF;
--
-- Update all edges having this face on the right
--
EXECUTE 'UPDATE '
|| quote_ident(atopology)
|| '.edge_data SET right_face = '
|| quote_literal(faceid)
|| ' WHERE edge_id = ANY('
|| quote_literal(right_edges)
|| ') ';
IF right_edges IS NOT NULL THEN
EXECUTE 'UPDATE '
|| quote_ident(atopology)
|| '.edge_data SET right_face = '
|| quote_literal(faceid)
|| ' WHERE edge_id = ANY('
|| quote_literal(right_edges)
|| ') ';
END IF;
RETURN faceid;

View file

@ -23,6 +23,16 @@ SELECT 'f1', topology.addFace('tt', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))');
-- Register the _same_ face again
SELECT 'f1*', topology.addFace('tt', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))');
-- Add 3 more edges closing a squre to the right,
-- all edges with same direction
SELECT 'e6', topology.addEdge('tt', 'LINESTRING(10 10, 20 10)');
SELECT 'e7', topology.addEdge('tt', 'LINESTRING(20 10, 20 0)');
SELECT 'e8', topology.addEdge('tt', 'LINESTRING(20 0, 10 0)');
-- Register a face with no holes matching all edges in the same direction
SELECT 'f2', topology.addFace('tt', 'POLYGON((10 10, 20 10, 20 0, 10 0, 10 10))');
-- Check added faces
SELECT face_id, mbr from tt.face ORDER by face_id;

View file

@ -9,11 +9,20 @@ WARNING: Not checking if face contains any edge
f1|1
WARNING: Not checking if face contains any edge
f1*|1
e6|6
e7|7
e8|8
WARNING: Not checking if face contains any edge
f2|2
0|
1|BOX(0 0,10 10)
2|BOX(10 0,20 10)
1|1|0
2|1|0
2|1|2
3|0|1
4|0|1
5|0|0
6|0|2
7|0|2
8|0|2
Topology 'tt' dropped