check more carefully for intersections

This commit is contained in:
Motiejus Jakštys 2021-05-19 22:57:51 +03:00 committed by Motiejus Jakštys
parent e0d0b90331
commit e25499668e
2 changed files with 9 additions and 3 deletions

View File

@ -125,8 +125,7 @@ begin
('salvis-visvalingam-' || i, geom2), ('salvis-visvalingam-' || i, geom2),
('salvis-visvalingam-' || i || '-chaikin', st_chaikinsmoothing(geom2, 5)); ('salvis-visvalingam-' || i || '-chaikin', st_chaikinsmoothing(geom2, 5));
end loop; end loop;
--foreach i in array array[75, 375] loop foreach i in array array[75, 375] loop
foreach i in array array[75] loop
geom3 = st_simplifywm((select way from wm_visuals where name='salvis'), i, 50, 'salvis-wm-' || i); geom3 = st_simplifywm((select way from wm_visuals where name='salvis'), i, 50, 'salvis-wm-' || i);
insert into wm_visuals(name, way) values insert into wm_visuals(name, way) values
('salvis-wm-' || i, geom3); ('salvis-wm-' || i, geom3);

9
wm.sql
View File

@ -531,12 +531,20 @@ begin
continue when st_intersects(bend, continue when st_intersects(bend,
st_removepoint(st_removepoint(bends[i-1], n-1), n-2)); st_removepoint(st_removepoint(bends[i-1], n-1), n-2));
end if; end if;
if n > 2 then
tmpint = st_intersection(bend, st_removepoint(bends[i-1], n-1));
continue when st_npoints(tmpint) > 1;
end if;
n = st_npoints(bends[i+1]); n = st_npoints(bends[i+1]);
if n > 3 then if n > 3 then
continue when st_intersects(bend, continue when st_intersects(bend,
st_removepoint(st_removepoint(bends[i+1], 0), 0)); st_removepoint(st_removepoint(bends[i+1], 0), 0));
end if; end if;
if n > 2 then
tmpint = st_intersection(bend, st_removepoint(bends[i+1], 0));
continue when st_npoints(tmpint) > 1;
end if;
for n in -intersect_patience+1..intersect_patience-1 loop for n in -intersect_patience+1..intersect_patience-1 loop
continue when n in (-1, 0, 1); continue when n in (-1, 0, 1);
@ -727,7 +735,6 @@ begin
mutated = true; mutated = true;
gen = 1; gen = 1;
raise notice 'dbgname: %, gen: %', dbgname, gen;
while mutated loop while mutated loop
if dbgname is not null then if dbgname is not null then
insert into wm_debug (stage, name, gen, nbend, way) values( insert into wm_debug (stage, name, gen, nbend, way) values(