remove some debug statements
This commit is contained in:
parent
0130eeee14
commit
50614c6e24
16
test.sql
16
test.sql
@ -1,12 +1,7 @@
|
||||
\i wm.sql
|
||||
|
||||
--do $$
|
||||
--begin
|
||||
-- SET AUTOCOMMIT TO ON;
|
||||
--end $$ language plpgsql;
|
||||
|
||||
-- https://stackoverflow.com/questions/19982373/which-tools-libraries-do-you-use-to-unit-test-your-pl-pgsql
|
||||
CREATE OR REPLACE FUNCTION assert_equals(expected anyelement, actual anyelement) RETURNS void AS $$
|
||||
create or replace function assert_equals(expected anyelement, actual anyelement) returns void as $$
|
||||
begin
|
||||
if expected = actual or (expected is null and actual is null) then
|
||||
--do nothing
|
||||
@ -51,22 +46,16 @@ insert into wm_figures (name, way) values ('fig6-combi', ST_Union(
|
||||
ST_Translate((select way from wm_figures where name='fig6'), 80, 90)
|
||||
));
|
||||
|
||||
-- TODO: there is a bug and it does not go through `self_crossing` function.
|
||||
insert into wm_figures (name, way) values ('selfcrossing-1-rev',ST_Reverse(
|
||||
ST_Translate((select way from wm_figures where name='selfcrossing-1'), 0, 60)));
|
||||
|
||||
|
||||
delete from wm_debug where name in (select distinct name from wm_figures);
|
||||
delete from wm_demo where name in (select distinct name from wm_figures);
|
||||
insert into wm_demo (name, way) select name, ST_SimplifyWM(way, .1, null, name) from wm_figures where name not in ('fig8', 'isolated-1');
|
||||
insert into wm_demo (name, way) select name, ST_SimplifyWM(way, 14, null, name) from wm_figures where name in ('fig8', 'isolated-1', 'isolated-2');
|
||||
|
||||
drop function if exists wm_debug_get;
|
||||
create function wm_debug_get(
|
||||
_stage text,
|
||||
_name text,
|
||||
OUT ways geometry[]
|
||||
) as $$
|
||||
create function wm_debug_get( _stage text, _name text, OUT ways geometry[]) as $$
|
||||
declare
|
||||
begin
|
||||
ways = array((select way from wm_debug where stage=_stage and name=_name order by id));
|
||||
@ -75,7 +64,6 @@ end $$ language plpgsql;
|
||||
do $$
|
||||
declare fig6b1 geometry;
|
||||
declare fig6b2 geometry;
|
||||
|
||||
declare sclong geometry;
|
||||
declare scshort geometry;
|
||||
begin
|
||||
|
29
wm.sql
29
wm.sql
@ -539,25 +539,17 @@ begin
|
||||
end if;
|
||||
end if;
|
||||
|
||||
if st_intersects(tmpbendattr.bend, tmpint) then
|
||||
insert into wm_manual(name, way) values
|
||||
('intersecter', tmpbendattr.bend),
|
||||
('intersectee', tmpint);
|
||||
raise notice '[%] % intersects with %', dbggen, i, i+n;
|
||||
continue bendloop;
|
||||
end if;
|
||||
continue bendloop when st_intersects(tmpbendattr.bend, tmpint);
|
||||
end loop;
|
||||
|
||||
-- no intersections within intersect_patience. Mutate bend.
|
||||
-- No intersections within intersect_patience, mutate bend!
|
||||
mutated = true;
|
||||
bendattrs[i] = tmpbendattr;
|
||||
|
||||
-- remove last vertex of the previous bend and
|
||||
-- first vertex of the next bend, because bends always
|
||||
-- share a line segment together
|
||||
-- this is duplicated in a few places, because PostGIS
|
||||
-- does not allow (?) mutating an array when passed to a
|
||||
-- function.
|
||||
-- remove last vertex of the previous bend and first vertex of the next
|
||||
-- bend, because bends always share a line segment together this is
|
||||
-- duplicated in a few places, because PostGIS does not allow (?)
|
||||
-- mutating an array when passed to a function.
|
||||
tmpbendattr.bend = st_removepoint(
|
||||
bendattrs[i-1].bend,
|
||||
st_npoints(bendattrs[i-1].bend)-1
|
||||
@ -807,10 +799,11 @@ begin
|
||||
end loop;
|
||||
lines[i] = st_linemerge(st_union(bends));
|
||||
if st_geometrytype(lines[i]) != 'ST_LineString' then
|
||||
insert into wm_manual(name, way)
|
||||
select 'non-linestring-' || a.path[1], a.geom
|
||||
from st_dump(lines[i]) a
|
||||
order by a.path[1];
|
||||
-- For manual debugging:
|
||||
--insert into wm_manual(name, way)
|
||||
--select 'non-linestring-' || a.path[1], a.geom
|
||||
--from st_dump(lines[i]) a
|
||||
--order by a.path[1];
|
||||
raise 'Got % (in %) instead of ST_LineString. '
|
||||
'Does the exaggerated bend intersect with the line? '
|
||||
'If so, try increasing intersect_patience.',
|
||||
|
Loading…
Reference in New Issue
Block a user