ishole := false;
END IF; -- }
- -- Update edges having new face on the left
+ -- Update edges bounding the old face
sql := 'UPDATE '
|| quote_ident(atopology)
|| '.edge_data SET left_face = CASE WHEN left_face = '
)::text )
|| ') AND ';
IF ishole THEN sql := sql || 'NOT '; END IF;
- sql := sql || 'ST_Contains(' || quote_literal(fan.shell::text) || '::geometry, geom)';
+ sql := sql || 'ST_Contains(' || quote_literal(fan.shell::text)
+ -- We only need to check a single point, but must not be an endpoint
+ || '::geometry, ST_Line_Interpolate_Point(geom, 0.2))';
#ifdef POSTGIS_TOPOLOGY_DEBUG
- RAISE DEBUG 'Updating edges binding old face';
+ RAISE DEBUG 'Updating edges bounding the old face';
#endif
EXECUTE sql;
UNION VALUES (4),(5) )
ORDER BY edge_id;
+--
+-- Split a face closing a ring inside a face
+-- and with the ring containing another edge
+--
+
+INSERT INTO newedge SELECT 27, topology.st_addedgemodface('city_data',
+ 5, 6, 'LINESTRING(36 38, 50 38, 57 33)');
+SELECT 'T27', '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 (27, 17, 18, 26)
+ UNION VALUES (4),(5) )
+ ORDER BY edge_id;
+
+--
+-- Split a face closing a ring inside a face
+-- and with the left ring containing another edge
+-- and forming an invalid polygon of this shape: <>---<>
+--
+-- See http://trac.osgeo.org/postgis/ticket/2025
+--
+
+INSERT INTO newedge SELECT 28, topology.st_addedgemodface('city_data',
+ 7, 7, 'LINESTRING(41 40, 38 40, 41 43, 41 40)');
+SELECT 'T28', '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 (26, 27, 28, 17, 18)
+ UNION VALUES (4),(5) )
+ ORDER BY edge_id;
+
+
---------------------------------------------------------------------
-- Check new relations and faces status
---------------------------------------------------------------------
SELECT 'F'||face_id, st_astext(mbr) FROM city_data.face ORDER BY face_id;
+
---------------------------------------------------------------------
-- Cleanups
---------------------------------------------------------------------
T26|E43|-44|44|32|0
T26|E44|-43|43|0|32
T26|E52|-5|4|32|24
+T27|E4|-52|53|24|33
+T27|E5|-4|5|33|33
+T27|E43|-44|44|33|0
+T27|E44|-43|43|0|33
+T27|E52|-53|4|32|24
+T27|E53|-5|52|33|32
+T28|E4|-52|53|24|34
+T28|E5|-4|54|34|34
+T28|E43|-44|44|34|0
+T28|E44|-43|43|0|34
+T28|E52|-53|4|32|24
+T28|E53|-5|52|34|32
+T28|E54|5|-54|34|33
F3,F4|{3:3,3:4,3:10,3:16,3:17}
F5,N4|{1:4,3:5,3:11}
F0|
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))
-F32|POLYGON((35 25,35 45,63 45,63 25,35 25))
+F32|POLYGON((36 33,36 38,57 38,57 33,36 33))
+F33|POLYGON((38 40,38 43,41 43,41 40,38 40))
+F34|POLYGON((35 25,35 45,63 45,63 25,35 25))
Topology 'city_data' dropped
UNION VALUES (4),(5) )
ORDER BY edge_id;
+--
+-- Split a face closing a ring inside a face
+-- and with the ring containing another edge
+--
+
+INSERT INTO newedge SELECT 27, topology.st_addedgenewfaces('city_data',
+ 5, 6, 'LINESTRING(36 38, 50 38, 57 33)');
+SELECT 'T27', '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 (27, 17, 18, 26)
+ UNION VALUES (4),(5) )
+ ORDER BY edge_id;
+
+--
+-- Split a face closing a ring inside a face
+-- and with the left ring containing another edge
+-- and forming an invalid polygon of this shape: <>---<>
+--
+-- See http://trac.osgeo.org/postgis/ticket/2025
+--
+
+INSERT INTO newedge SELECT 28, topology.st_addedgenewfaces('city_data',
+ 7, 7, 'LINESTRING(41 40, 38 40, 41 43, 41 40)');
+SELECT 'T28', '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 (26, 27, 28, 17, 18)
+ UNION VALUES (4),(5) )
+ ORDER BY edge_id;
+
---------------------------------------------------------------------
-- Check new relations and faces status
---------------------------------------------------------------------
T26|E43|-44|44|46|0
T26|E44|-43|43|0|46
T26|E52|-5|4|46|45
+T27|E4|-52|53|45|48
+T27|E5|-4|5|48|48
+T27|E43|-44|44|48|0
+T27|E44|-43|43|0|48
+T27|E52|-53|4|47|45
+T27|E53|-5|52|48|47
+T28|E4|-52|53|45|50
+T28|E5|-4|54|50|50
+T28|E43|-44|44|50|0
+T28|E44|-43|43|0|50
+T28|E52|-53|4|47|45
+T28|E53|-5|52|50|47
+T28|E54|5|-54|50|49
F3,F4|{3:10,3:11,3:22,3:24,3:25}
F5,N4|{1:4,3:12,3:13}
F0|
F43|POLYGON((17 30,17 40,31 40,31 30,17 30))
F44|POLYGON((19 31,19 38,26 38,26 31,19 31))
F45|POLYGON((36 28,36 38,57 38,57 28,36 28))
-F46|POLYGON((35 25,35 45,63 45,63 25,35 25))
+F47|POLYGON((36 33,36 38,57 38,57 33,36 33))
+F49|POLYGON((38 40,38 43,41 43,41 40,38 40))
+F50|POLYGON((35 25,35 45,63 45,63 25,35 25))
Topology 'city_data' dropped