mirror of
https://git.osgeo.org/gitea/postgis/postgis
synced 2024-10-24 09:02:37 +00:00
Simplify face registration by the end of ST_AddEdgeNewFaces [RT-SIGTA]
git-svn-id: http://svn.osgeo.org/postgis/trunk@7271 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
parent
7e5e8423d8
commit
9568ec8e5d
|
@ -2440,45 +2440,36 @@ BEGIN
|
|||
INTO STRICT fan.post;
|
||||
|
||||
IF ST_NumGeometries(fan.pre) = ST_NumGeometries(fan.post) THEN
|
||||
-- all done, I hope
|
||||
-- No splits, all done
|
||||
RETURN newedge.edge_id;
|
||||
END IF;
|
||||
|
||||
RAISE NOTICE 'ST_AddEdgeNewFaces: edge % splitted face %',
|
||||
newedge.edge_id, newedge.left_face;
|
||||
|
||||
IF newedge.left_face != 0 THEN -- {
|
||||
|
||||
-- Set old face edges to zero to let AddFace do something with them
|
||||
EXECUTE 'UPDATE ' || quote_ident(atopology)
|
||||
|| '.edge_data SET left_face = 0 WHERE left_face = '
|
||||
|| newedge.left_face;
|
||||
EXECUTE 'UPDATE ' || quote_ident(atopology)
|
||||
|| '.edge_data SET right_face = 0 WHERE right_face = '
|
||||
|| newedge.left_face;
|
||||
|
||||
-- Now we call topology.AddFace for each of the two new
|
||||
-- faces. These are the ones that do contain the new edge
|
||||
-- Call topology.AddFace for every face containing the new edge
|
||||
-- The ORDER serves predictability of which face is added first
|
||||
FOR rec IN SELECT geom FROM ST_Dump(fan.post)
|
||||
WHERE ST_Contains(
|
||||
ST_Boundary(geom),
|
||||
ST_MakeLine(
|
||||
ST_StartPoint(newedge.cleangeom),
|
||||
ST_PointN(newedge.cleangeom, 2)
|
||||
)
|
||||
)
|
||||
ORDER BY ST_XMin(geom), ST_YMin(geom)
|
||||
LOOP -- {
|
||||
-- skip the polygons whose boundary does not contain
|
||||
-- the newly added edge
|
||||
IF NOT ST_Contains(ST_Boundary(rec.geom), acurve) THEN
|
||||
CONTINUE;
|
||||
END IF;
|
||||
|
||||
RAISE DEBUG 'Adding face %', ST_AsText(rec.geom);
|
||||
sql :=
|
||||
'SELECT topology.AddFace(' || quote_literal(atopology)
|
||||
|| ', ' || quote_literal(rec.geom::text) || ')';
|
||||
|| ', ' || quote_literal(rec.geom::text) || ', true)';
|
||||
EXECUTE sql INTO newface;
|
||||
newfaces := array_append(newfaces, newface);
|
||||
END LOOP; --}
|
||||
|
||||
RAISE DEBUG 'Added faces: %', newfaces;
|
||||
|
||||
IF newedge.left_face != 0 THEN -- {
|
||||
|
||||
-- NOT IN THE SPECS:
|
||||
-- update TopoGeometry compositions to substitute oldface with newfaces
|
||||
sql := 'UPDATE '
|
||||
|
@ -2509,26 +2500,6 @@ BEGIN
|
|||
|| '.face WHERE face_id = ' || newedge.left_face;
|
||||
EXECUTE sql;
|
||||
|
||||
ELSE -- }{
|
||||
|
||||
FOR rec IN SELECT (ST_Dump(fan.post)).geom
|
||||
LOOP -- {
|
||||
-- skip the polygons whose boundary does not contain
|
||||
-- the newly added edge
|
||||
IF NOT ST_Contains(ST_Boundary(rec.geom), acurve) THEN
|
||||
CONTINUE;
|
||||
END IF;
|
||||
|
||||
RAISE DEBUG 'Adding face %', ST_AsText(rec.geom);
|
||||
sql :=
|
||||
'SELECT topology.AddFace(' || quote_literal(atopology)
|
||||
|| ', ' || quote_literal(rec.geom::text) || ')';
|
||||
EXECUTE sql INTO newface;
|
||||
newfaces := array_append(newfaces, newface);
|
||||
END LOOP; --}
|
||||
|
||||
RAISE DEBUG 'Added faces: %', newfaces;
|
||||
|
||||
END IF; -- }
|
||||
|
||||
RETURN newedge.edge_id;
|
||||
|
|
Loading…
Reference in a new issue