fix the incorrect test

main
Motiejus Jakštys 2021-05-19 22:57:47 +03:00 committed by Motiejus Jakštys
parent fb4a3eac6d
commit dc50ae173e
3 changed files with 7 additions and 37 deletions

View File

@ -27,9 +27,10 @@ clean:
.PHONY: clean-tables
clean-tables:
for t in $$(./db -c '\dt' | awk '/demo|debug|integ/{print $$3}'); do \
for t in $$(./db -c '\dt' | awk '/\y(demo_wm|debug_wm|figures)\y/{print $$3}'); do \
./db -c "drop table $$t"; \
done
-rm .faux_test
.PHONY: slides
slides: $(SLIDES)

View File

@ -33,35 +33,7 @@ insert into figures (name, way) values ('fig6-combi',
insert into figures (name, way) values ('inflection-1',ST_GeomFromText('LINESTRING(110 24,114 20,133 20,145 15,145 0,136 5,123 7,114 7,111 2)'));
insert into figures (name, way) values ('multi-island',ST_GeomFromText('MULTILINESTRING((-15 10,-10 10,-5 11,0 11,5 11,10 10,11 9,13 10,15 9),(-5 11,-2 15,0 16,2 15,5 11))'));
-- DETECT BENDS
drop table if exists bends;
create table bends (name text, ways geometry[]);
insert into bends select name, detect_bends(way, name) from figures;
-- FIX BEND INFLECTIONS
drop table if exists inflections, demo_inflections2;
create table inflections (name text, ways geometry[]);
insert into inflections select name, fix_gentle_inflections(ways) from bends;
create table demo_inflections2 (name text, i bigint, way geometry);
insert into demo_inflections2 select name, generate_subscripts(ways, 1), unnest(ways) from inflections;
-- SELF-LINE CROSSING
drop table if exists selfcrossing, demo_selfcrossing3;
create table selfcrossing (name text, ways geometry[], mutated boolean);
insert into selfcrossing select name, (self_crossing(ways)).* from inflections;
create table demo_selfcrossing3 (name text, i bigint, way geometry);
insert into demo_selfcrossing3 select name, generate_subscripts(ways, 1), unnest(ways) from selfcrossing;
-- BEND ATTRS
do $$
declare
recs t_bend_attrs[];
begin
select array(select bend_attrs(ways, name) from inflections) into recs;
end
$$ language plpgsql;
-- COMBINED
-- Run ST_SimplifyWM in debug mode
drop table if exists demo_wm;
create table demo_wm (name text, i bigint, way geometry);
insert into demo_wm (name, way) select name, ST_SimplifyWM(way, name) from figures;
@ -101,9 +73,6 @@ end $$ language plpgsql;
do $$
declare
elem geometry;
elems1 geometry[];
elems2 geometry[];
vcrossings geometry[];
mutated boolean;
begin

8
wm.sql
View File

@ -15,10 +15,10 @@ declare
cur_sign int4;
l_type text;
begin
--l_type = st_geometrytype(line);
--if l_type != 'ST_LineString' then
-- raise 'This function works with ST_LineString, got %', l_type;
--end if;
l_type = st_geometrytype(line);
if l_type != 'ST_LineString' then
raise 'This function works with ST_LineString, got %', l_type;
end if;
-- The last vertex is iterated over twice, because the algorithm uses 3
-- vertices to calculate the angle between them.