remove debug statements

main
Motiejus Jakštys 2021-05-19 22:57:49 +03:00 committed by Motiejus Jakštys
parent c4f92296c0
commit 4c57b8f1d4
1 changed files with 2 additions and 11 deletions

13
wm.sql
View File

@ -22,7 +22,6 @@ declare
begin begin
l_type = st_geometrytype(line); l_type = st_geometrytype(line);
if l_type != 'ST_LineString' then if l_type != 'ST_LineString' then
raise notice 'Got non-LineString: %', st_summary(line);
raise 'This function works with ST_LineString, got %', l_type; raise 'This function works with ST_LineString, got %', l_type;
end if; end if;
@ -415,24 +414,20 @@ declare
points geometry[]; points geometry[];
begin begin
if size = 0 then if size = 0 then
raise 'unable to exaggerate a zero-area bend'; raise 'invalid input: zero-area bend';
end if; end if;
midpoint = st_lineinterpolatepoint(st_makeline( midpoint = st_lineinterpolatepoint(st_makeline(
st_pointn(bend, 1), st_pointn(bend, 1),
st_pointn(bend, -1) st_pointn(bend, -1)
), .5); ), .5);
insert into wm_manual (name, way) values ('midpoint', midpoint);
while size < desired_size loop while size < desired_size loop
splitbend = wm_st_split(bend, st_lineinterpolatepoint(bend, .5)); splitbend = wm_st_split(bend, st_lineinterpolatepoint(bend, .5));
-- Convert bend to LINESTRINGM, where M is the fraction by how -- Convert bend to LINESTRINGM, where M is the fraction by how
-- much the point will be prolonged: -- much the point will be prolonged:
-- 1. draw a line between midpoint and the point on the bend. -- 1. draw a line between midpoint and the point on the bend.
-- 2. multiply the line length by M. Midpoint stays intact. -- 2. multiply the line length by M. Midpoint stays intact.
-- 3. the new set of lines form a new bend. -- 3. the new set of lines form a new bend.
-- Uses linear interpolation; can be updated to gaussian or similar; -- Uses linear interpolation; can be updated to gaussian or similar;
-- then interpolate manually instead of relying on st_addmeasure. -- then interpolate manually instead of relying on st_addmeasure.
bendm = st_collect( bendm = st_collect(
@ -498,7 +493,6 @@ declare
begin begin
mutated = false; mutated = false;
for i in 1..array_length(bendattrs, 1) loop for i in 1..array_length(bendattrs, 1) loop
if bendattrs[i].isolated and bendattrs[i].adjsize < desired_size then if bendattrs[i].isolated and bendattrs[i].adjsize < desired_size then
mutated = true; mutated = true;
tmpbendattr.bend = wm_exaggerate_bend( tmpbendattr.bend = wm_exaggerate_bend(
@ -528,11 +522,8 @@ begin
); );
end if; end if;
end if; end if;
end loop; end loop;
end $$ language plpgsql;
end
$$ language plpgsql;
create function wm_elimination( create function wm_elimination(
INOUT bendattrs wm_t_bend_attrs[], INOUT bendattrs wm_t_bend_attrs[],