remove some debug statements
This commit is contained in:
parent
f94bcdbba8
commit
86cdb8a005
16
IV/test.sql
16
IV/test.sql
@ -1,12 +1,7 @@
|
|||||||
\i wm.sql
|
\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
|
-- 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
|
begin
|
||||||
if expected = actual or (expected is null and actual is null) then
|
if expected = actual or (expected is null and actual is null) then
|
||||||
--do nothing
|
--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)
|
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(
|
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)));
|
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_debug where name in (select distinct name from wm_figures);
|
||||||
delete from wm_demo 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, .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');
|
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;
|
drop function if exists wm_debug_get;
|
||||||
create function wm_debug_get(
|
create function wm_debug_get( _stage text, _name text, OUT ways geometry[]) as $$
|
||||||
_stage text,
|
|
||||||
_name text,
|
|
||||||
OUT ways geometry[]
|
|
||||||
) as $$
|
|
||||||
declare
|
declare
|
||||||
begin
|
begin
|
||||||
ways = array((select way from wm_debug where stage=_stage and name=_name order by id));
|
ways = array((select way from wm_debug where stage=_stage and name=_name order by id));
|
||||||
@ -75,7 +64,6 @@ end $$ language plpgsql;
|
|||||||
do $$
|
do $$
|
||||||
declare fig6b1 geometry;
|
declare fig6b1 geometry;
|
||||||
declare fig6b2 geometry;
|
declare fig6b2 geometry;
|
||||||
|
|
||||||
declare sclong geometry;
|
declare sclong geometry;
|
||||||
declare scshort geometry;
|
declare scshort geometry;
|
||||||
begin
|
begin
|
||||||
|
29
IV/wm.sql
29
IV/wm.sql
@ -539,25 +539,17 @@ begin
|
|||||||
end if;
|
end if;
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
if st_intersects(tmpbendattr.bend, tmpint) then
|
continue bendloop when st_intersects(tmpbendattr.bend, tmpint);
|
||||||
insert into wm_manual(name, way) values
|
|
||||||
('intersecter', tmpbendattr.bend),
|
|
||||||
('intersectee', tmpint);
|
|
||||||
raise notice '[%] % intersects with %', dbggen, i, i+n;
|
|
||||||
continue bendloop;
|
|
||||||
end if;
|
|
||||||
end loop;
|
end loop;
|
||||||
|
|
||||||
-- no intersections within intersect_patience. Mutate bend.
|
-- No intersections within intersect_patience, mutate bend!
|
||||||
mutated = true;
|
mutated = true;
|
||||||
bendattrs[i] = tmpbendattr;
|
bendattrs[i] = tmpbendattr;
|
||||||
|
|
||||||
-- remove last vertex of the previous bend and
|
-- remove last vertex of the previous bend and first vertex of the next
|
||||||
-- first vertex of the next bend, because bends always
|
-- bend, because bends always share a line segment together this is
|
||||||
-- share a line segment together
|
-- duplicated in a few places, because PostGIS does not allow (?)
|
||||||
-- this is duplicated in a few places, because PostGIS
|
-- mutating an array when passed to a function.
|
||||||
-- does not allow (?) mutating an array when passed to a
|
|
||||||
-- function.
|
|
||||||
tmpbendattr.bend = st_removepoint(
|
tmpbendattr.bend = st_removepoint(
|
||||||
bendattrs[i-1].bend,
|
bendattrs[i-1].bend,
|
||||||
st_npoints(bendattrs[i-1].bend)-1
|
st_npoints(bendattrs[i-1].bend)-1
|
||||||
@ -807,10 +799,11 @@ begin
|
|||||||
end loop;
|
end loop;
|
||||||
lines[i] = st_linemerge(st_union(bends));
|
lines[i] = st_linemerge(st_union(bends));
|
||||||
if st_geometrytype(lines[i]) != 'ST_LineString' then
|
if st_geometrytype(lines[i]) != 'ST_LineString' then
|
||||||
insert into wm_manual(name, way)
|
-- For manual debugging:
|
||||||
select 'non-linestring-' || a.path[1], a.geom
|
--insert into wm_manual(name, way)
|
||||||
from st_dump(lines[i]) a
|
--select 'non-linestring-' || a.path[1], a.geom
|
||||||
order by a.path[1];
|
--from st_dump(lines[i]) a
|
||||||
|
--order by a.path[1];
|
||||||
raise 'Got % (in %) instead of ST_LineString. '
|
raise 'Got % (in %) instead of ST_LineString. '
|
||||||
'Does the exaggerated bend intersect with the line? '
|
'Does the exaggerated bend intersect with the line? '
|
||||||
'If so, try increasing intersect_patience.',
|
'If so, try increasing intersect_patience.',
|
||||||
|
Loading…
Reference in New Issue
Block a user