add demo prefix to demo tables

This commit is contained in:
Motiejus Jakštys 2021-05-19 22:57:45 +03:00 committed by Motiejus Jakštys
parent 5c38035b19
commit 74055de9a3

View File

@ -19,11 +19,11 @@ insert into figures (name, way) values ('fig5',ST_GeomFromText('LINESTRING(0 39,
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 ('inflection-1',ST_GeomFromText('LINESTRING(110 24,114 20,133 20,145 15,145 0,136 5,123 7,114 7,111 2)'));
-- DETECT BENDS -- DETECT BENDS
drop table if exists abends, bends; drop table if exists bends, demo_bends;
create table abends (name text, ways geometry[]); create table bends (name text, ways geometry[]);
insert into abends select f.name, detect_bends(f.way) from figures f; insert into bends select f.name, detect_bends(f.way) from figures f;
create table bends (name text, i bigint, way geometry); create table demo_bends (name text, i bigint, way geometry);
insert into bends select a.name, generate_subscripts(a.ways, 1), unnest(a.ways) from abends a; insert into demo_bends select a.name, generate_subscripts(a.ways, 1), unnest(a.ways) from bends a;
do $$ do $$
declare declare
@ -41,11 +41,11 @@ begin
end $$ language plpgsql; end $$ language plpgsql;
-- FIX BEND INFLECTIONS -- FIX BEND INFLECTIONS
drop table if exists ainflections, inflections; drop table if exists inflections, demo_inflections;
create table ainflections (name text, ways geometry[]); create table inflections (name text, ways geometry[]);
insert into ainflections select a.name, fix_gentle_inflections(a.ways) from abends a; insert into inflections select a.name, fix_gentle_inflections(a.ways) from bends a;
create table inflections (name text, i bigint, way geometry); create table demo_inflections (name text, i bigint, way geometry);
insert into inflections select a.name, generate_subscripts(a.ways, 1), unnest(a.ways) from ainflections a; insert into demo_inflections select a.name, generate_subscripts(a.ways, 1), unnest(a.ways) from inflections a;
do $$ do $$
declare declare
@ -53,8 +53,7 @@ declare
vinflections geometry[]; vinflections geometry[];
begin begin
-- fig5 -- fig5
select detect_bends((select way from figures where name='fig5')) into vbends; select fix_gentle_inflections((select ways from bends where name='fig5')) into vinflections;
select fix_gentle_inflections(vbends) into vinflections;
perform assert_equals('LINESTRING(0 39,19 52,27 77)', st_astext(vinflections[1])); perform assert_equals('LINESTRING(0 39,19 52,27 77)', st_astext(vinflections[1]));
perform assert_equals('LINESTRING(19 52,27 77,26 104,41 115,49 115,65 103,65 75,53 45)', st_astext(vinflections[2])); perform assert_equals('LINESTRING(19 52,27 77,26 104,41 115,49 115,65 103,65 75,53 45)', st_astext(vinflections[2]));
perform assert_equals('LINESTRING(65 75,53 45,63 15,91 0)', st_astext(vinflections[3])); perform assert_equals('LINESTRING(65 75,53 45,63 15,91 0)', st_astext(vinflections[3]));