From c9e5aa744a7a78638db6053758cc5017284bda8a Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Fri, 27 Jan 2012 14:22:32 +0000 Subject: [PATCH] More test for face splitting and inside holes git-svn-id: http://svn.osgeo.org/postgis/trunk@8944 b70326c6-7e19-0410-871a-916f4a2858ee --- topology/test/regress/st_addedgemodface.sql | 39 +++++++++++++++++++ .../test/regress/st_addedgemodface_expected | 31 ++++++++++++++- topology/test/regress/st_addedgenewfaces.sql | 39 +++++++++++++++++++ .../test/regress/st_addedgenewfaces_expected | 31 ++++++++++++++- 4 files changed, 138 insertions(+), 2 deletions(-) diff --git a/topology/test/regress/st_addedgemodface.sql b/topology/test/regress/st_addedgemodface.sql index 0199e0f34..728b06b56 100644 --- a/topology/test/regress/st_addedgemodface.sql +++ b/topology/test/regress/st_addedgemodface.sql @@ -375,6 +375,45 @@ SELECT 'T23', 'N' || node_id, containing_face FROM city_data.node WHERE node_id IN ( 27, 28, 29 ) ORDER BY node_id; +-- +-- Split a face containing an hole, this time with no ring continuity +-- This version goes clockwise +-- All involved faces contain isolated nodes +-- +SELECT 'T24-', 'N' || st_addisonode('city_data', 28, 'POINT(19.5 37.5)'), 28; +SELECT 'T24-', 'N' || st_addisonode('city_data', 28, 'POINT(19 38)'), 28; +SELECT 'T24-', 'N' || st_addisonode('city_data', 2, 'POINT(20.5 35)'), 2; +SELECT 'T24-', 'N' || st_addisonode('city_data', 28, 'POINT(20.5 34)'), 28; +SELECT 'T24-', 'N' || st_addisonode('city_data', 28, 'POINT(20.5 33)'), 28; + +INSERT INTO newedge SELECT 24, topology.st_addedgemodface('city_data', + 30, 30, 'LINESTRING(19.5 37.5, 24.5 37.5, 19.5 32.5, 19.5 37.5)'); +SELECT 'T24', 'E'||edge_id, next_left_edge, next_right_edge, + left_face, right_face FROM + city_data.edge WHERE edge_id IN ( + SELECT edge_id FROM newedge WHERE id IN (24, 23, 16) + UNION VALUES (2),(3) ) + ORDER BY edge_id; +SELECT 'T24', 'N' || node_id, containing_face FROM + city_data.node WHERE node_id IN ( 27, 30, 31, 32, 33, 34 ) + ORDER BY node_id; + +-- +-- Split a face containing an hole, this time with no ring continuity +-- This version goes counterclockwise +-- All involved faces contain isolated nodes +-- +INSERT INTO newedge SELECT 25, topology.st_addedgemodface('city_data', + 31, 31, 'LINESTRING(19 38, 19 31, 26 38, 19 38)'); +SELECT 'T25', 'E'||edge_id, next_left_edge, next_right_edge, + left_face, right_face FROM + city_data.edge WHERE edge_id IN ( + SELECT edge_id FROM newedge WHERE id IN (25, 24, 23, 16) + UNION VALUES (2),(3) ) + ORDER BY edge_id; +SELECT 'T25', 'N' || node_id, containing_face FROM + city_data.node WHERE node_id IN ( 27, 31, 32, 33, 34 ) + ORDER BY node_id; --------------------------------------------------------------------- -- Check new relations and faces status diff --git a/topology/test/regress/st_addedgemodface_expected b/topology/test/regress/st_addedgemodface_expected index ecf7409f1..cbe0badd8 100644 --- a/topology/test/regress/st_addedgemodface_expected +++ b/topology/test/regress/st_addedgemodface_expected @@ -116,6 +116,33 @@ T23|E49|48|2|29|28 T23|N27|28 T23|N28|23 T23|N29|29 +T24-|N30|28 +T24-|N31|28 +T24-|N32|2 +T24-|N33|28 +T24-|N34|28 +T24|E2|3|39|30|0 +T24|E3|-49|49|30|29 +T24|E42|42|-42|28|2 +T24|E49|48|2|29|30 +T24|E50|50|-50|30|28 +T24|N27|30 +T24|N30| +T24|N31|30 +T24|N32|2 +T24|N33|28 +T24|N34|30 +T25|E2|3|39|30|0 +T25|E3|-49|49|30|29 +T25|E42|42|-42|28|2 +T25|E49|48|2|29|30 +T25|E50|50|-50|31|28 +T25|E51|51|-51|31|30 +T25|N27|30 +T25|N31| +T25|N32|2 +T25|N33|28 +T25|N34|31 F3,F4|{3:3,3:4,3:10,3:16,3:17} F5,N4|{1:4,3:5,3:11} F0| @@ -146,6 +173,8 @@ F24|POLYGON((35 25,35 45,63 45,63 25,35 25)) F25|POLYGON((9 0,9 6,21 6,21 0,9 0)) F26|POLYGON((35 0,35 6,47 6,47 0,35 0)) F27|POLYGON((35 -4,35 6,47 6,47 -4,35 -4)) -F28|POLYGON((17 30,17 40,31 40,31 30,17 30)) +F28|POLYGON((19.5 32.5,19.5 37.5,24.5 37.5,24.5 32.5,19.5 32.5)) F29|POLYGON((25 30,25 37,29 37,29 30,25 30)) +F30|POLYGON((17 30,17 40,31 40,31 30,17 30)) +F31|POLYGON((19 31,19 38,26 38,26 31,19 31)) Topology 'city_data' dropped diff --git a/topology/test/regress/st_addedgenewfaces.sql b/topology/test/regress/st_addedgenewfaces.sql index 235aef352..fc9b081b8 100644 --- a/topology/test/regress/st_addedgenewfaces.sql +++ b/topology/test/regress/st_addedgenewfaces.sql @@ -375,6 +375,45 @@ SELECT 'T23', 'N' || node_id, containing_face FROM city_data.node WHERE node_id IN ( 27, 28, 29 ) ORDER BY node_id; +-- +-- Split a face containing an hole, this time with no ring continuity +-- This version goes clockwise +-- All involved faces contain isolated nodes +-- +SELECT 'T24-', 'N' || st_addisonode('city_data', 39, 'POINT(19.5 37.5)'), 39; +SELECT 'T24-', 'N' || st_addisonode('city_data', 39, 'POINT(19 38)'), 39; +SELECT 'T24-', 'N' || st_addisonode('city_data', 31, 'POINT(20.5 35)'), 31; +SELECT 'T24-', 'N' || st_addisonode('city_data', 39, 'POINT(20.5 34)'), 39; +SELECT 'T24-', 'N' || st_addisonode('city_data', 39, 'POINT(20.5 33)'), 39; + +INSERT INTO newedge SELECT 24, topology.st_addedgenewfaces('city_data', + 30, 30, 'LINESTRING(19.5 37.5, 24.5 37.5, 19.5 32.5, 19.5 37.5)'); +SELECT 'T24', 'E'||edge_id, next_left_edge, next_right_edge, + left_face, right_face FROM + city_data.edge WHERE edge_id IN ( + SELECT edge_id FROM newedge WHERE id IN (24, 23, 16) + UNION VALUES (2),(3) ) + ORDER BY edge_id; +SELECT 'T24', 'N' || node_id, containing_face FROM + city_data.node WHERE node_id IN ( 27, 30, 31, 32, 33, 34 ) + ORDER BY node_id; + +-- +-- Split a face containing an hole, this time with no ring continuity +-- This version goes counterclockwise +-- All involved faces contain isolated nodes +-- +INSERT INTO newedge SELECT 25, topology.st_addedgenewfaces('city_data', + 31, 31, 'LINESTRING(19 38, 19 31, 26 38, 19 38)'); +SELECT 'T25', 'E'||edge_id, next_left_edge, next_right_edge, + left_face, right_face FROM + city_data.edge WHERE edge_id IN ( + SELECT edge_id FROM newedge WHERE id IN (25, 24, 23, 16) + UNION VALUES (2),(3) ) + ORDER BY edge_id; +SELECT 'T25', 'N' || node_id, containing_face FROM + city_data.node WHERE node_id IN ( 27, 31, 32, 33, 34 ) + ORDER BY node_id; --------------------------------------------------------------------- -- Check new relations and faces status diff --git a/topology/test/regress/st_addedgenewfaces_expected b/topology/test/regress/st_addedgenewfaces_expected index 1debd775c..79079361a 100644 --- a/topology/test/regress/st_addedgenewfaces_expected +++ b/topology/test/regress/st_addedgenewfaces_expected @@ -116,6 +116,33 @@ T23|E49|48|2|40|39 T23|N27|39 T23|N28|37 T23|N29|40 +T24-|N30|39 +T24-|N31|39 +T24-|N32|31 +T24-|N33|39 +T24-|N34|39 +T24|E2|3|39|42|0 +T24|E3|-49|49|42|40 +T24|E42|42|-42|41|31 +T24|E49|48|2|40|42 +T24|E50|50|-50|42|41 +T24|N27|42 +T24|N30| +T24|N31|42 +T24|N32|31 +T24|N33|41 +T24|N34|42 +T25|E2|3|39|43|0 +T25|E3|-49|49|43|40 +T25|E42|42|-42|41|31 +T25|E49|48|2|40|43 +T25|E50|50|-50|44|41 +T25|E51|51|-51|44|43 +T25|N27|43 +T25|N31| +T25|N32|31 +T25|N33|41 +T25|N34|44 F3,F4|{3:10,3:11,3:22,3:24,3:25} F5,N4|{1:4,3:12,3:13} F0| @@ -146,6 +173,8 @@ F34|POLYGON((9 0,9 6,21 6,21 0,9 0)) F35|POLYGON((35 0,35 6,47 6,47 0,35 0)) F36|POLYGON((35 -4,35 6,47 6,47 -4,35 -4)) F37|POLYGON((25 34,25 35,27 35,27 34,25 34)) -F39|POLYGON((17 30,17 40,31 40,31 30,17 30)) F40|POLYGON((25 30,25 37,29 37,29 30,25 30)) +F41|POLYGON((19.5 32.5,19.5 37.5,24.5 37.5,24.5 32.5,19.5 32.5)) +F43|POLYGON((17 30,17 40,31 40,31 30,17 30)) +F44|POLYGON((19 31,19 38,26 38,26 31,19 31)) Topology 'city_data' dropped -- 2.40.0