From 84819fee144b55d1389d02cc709d0efe291130cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Sat, 27 Mar 2021 13:01:21 +0200 Subject: [PATCH] prezentacija --- IV/Makefile | 3 +++ IV/referatui.txt | 4 ++- IV/slides-2021-03-29.txt | 57 ++++++++++++++++++++++++++++++++++++++++ IV/tests.sql | 12 ++++++--- IV/wm.sql | 31 ++++++++++++++++------ 5 files changed, 94 insertions(+), 13 deletions(-) create mode 100644 IV/slides-2021-03-29.txt diff --git a/IV/Makefile b/IV/Makefile index a48ed3d..9206595 100644 --- a/IV/Makefile +++ b/IV/Makefile @@ -20,6 +20,9 @@ clean-tables: ./db -c "drop table $$t"; \ done +slides-2021-03-29.pdf: slides-2021-03-29.txt + pandoc -t beamer -i $< -o $@ + .faux_filter-rivers: .faux_import-osm ./db -v where="$(WHERE)" -f aggregate-rivers.sql touch $@ diff --git a/IV/referatui.txt b/IV/referatui.txt index 479591f..f49f5d5 100644 --- a/IV/referatui.txt +++ b/IV/referatui.txt @@ -53,8 +53,10 @@ analizė Lietuvos upėms. Kitam kartui: - smulkiai surašyti darbo struktūrą ir atsiųsti dėstytojui. -Pristatymui reikės akcentuiti: +Pristatymui reikės akcentuoti: - naujumas - aktualumas - problema - max 15 skaidrių. + + diff --git a/IV/slides-2021-03-29.txt b/IV/slides-2021-03-29.txt new file mode 100644 index 0000000..35ac526 --- /dev/null +++ b/IV/slides-2021-03-29.txt @@ -0,0 +1,57 @@ +--- +title: Wang & Müller linijų generalizacijos algoritmo implementacija ir analizė Lietuvos upėms +author: +- Motiejus Jakštys +description: | + foo bar + + It consists of two paragraphs +date: 2021-03-29 +lang: lt-LT +... + +# Problema + +- Dabartiniai atvirai prieinami algoritmai + - Visvalingam-Whyatt + - Douglas-Peucker + +- Problemos + - nepritaikyti kartografiniams objektams + - prarandama geografinė teisybė + +- Alternatyvos + - egzistuoja teorinės + - nėra implementacijos + - neaiškūs parametrai + +# Aktualumas + +- Aprašyti Wang & Müller praktiniais parametrais. +- Iš GDR10 sukurti GDR50 ir GDR250 analogus +- Palyginti su GDR50 ir GDR250 + +# Naujumas + +- Tinkamo algoritmo tiesiog nėra; čia bus vienintelė, nauja implementacija. + +# Progresas + +Užduotis Laikas Statusas +------------------------------------------------------------- ------ -------- +Įlinkių atpažinimas 8 Padaryta +Silpnas pasislinkimas įlinkio gale 8 Padaryta +Įlinkio kirtimas kitu įlinkiu 8 Padaryta +Patikrinimas su Nemunu, Šalčia ir Visinčia 16 Padaryta +Matavimai: dydis ir forma 8 Progrese +Matavimas: izoliuoti, panaūs 8 - +Pašalinimo operatorius 8 - +Kombinavimo operatorius 8 - +Padinimo operatorius 8 - +Pritaikymas visoms Lietuvos upėms 8 - +MSc: proza 40 - +MSc: apipavidalinimas 4 - + +# Demonstracija + +# Klausimai diff --git a/IV/tests.sql b/IV/tests.sql index 0132424..19adc86 100644 --- a/IV/tests.sql +++ b/IV/tests.sql @@ -10,6 +10,9 @@ begin end if; end $$ LANGUAGE plpgsql; +drop table if exists debug_wm; +create table debug_wm(section text, name text, way geometry); + drop table if exists figures; create table figures (name text, way geometry); -- to "normalize" a new line when it's in `f`: @@ -26,9 +29,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)')); - -drop table if exists debug; -create table debug (i bigint, way geometry); +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, demo_bends1; @@ -51,9 +52,12 @@ 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 +drop table if exists bendattrs; +create table bendattrs (way geometry, area real, cmp real); +insert into bendattrs (way, area, cmp) select (bend_attrs(ways, true)).* from inflections; -- COMBINED -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))')); 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, true) from figures where name='multi-island'; diff --git a/IV/wm.sql b/IV/wm.sql index 8bc517b..50e9980 100644 --- a/IV/wm.sql +++ b/IV/wm.sql @@ -266,6 +266,21 @@ begin end $$ language plpgsql; +drop function if exists bend_attrs; +create function bend_attrs(bends geometry[], dbg boolean default false) returns table(polygon geometry, area real, cmp real) as $$ +declare + i int4; +begin + for i in 1..array_length(bends, 1) loop + select st_makepolygon(st_addpoint(bends[i], st_startpoint(bends[i]))) into polygon; + if dbg then + insert into debug_wm (section, name, way) values('bend_attrs', i, polygon); + end if; + return next; + end loop; +end; +$$ language plpgsql; + -- ST_SimplifyWM simplifies a given geometry using Wang & Müller's -- "Line Generalization Based on Analysis of Shape Characteristics" algorithm, -- 1998. @@ -289,10 +304,6 @@ begin raise 'Unknown geometry type %', l_type; end if; - if dbg then - drop table if exists debug_wm; - create table debug_wm(name text, way geometry); - end if; for i in 1..array_length(lines, 1) loop @@ -300,7 +311,8 @@ begin dbg_stage = 1; while mutated loop if dbg then - insert into debug_wm (name, way) values( + insert into debug_wm (section, name, way) values( + 'simplifywm', dbg_stage || 'afigures_' || i, lines[i] ); @@ -309,7 +321,8 @@ begin bends = detect_bends(lines[i]); if dbg then - insert into debug_wm(name, way) values( + insert into debug_wm(section, name, way) values( + 'simplifywm', dbg_stage || 'bbends_' || i || '_' || generate_subscripts(bends, 1), unnest(bends) ); @@ -318,7 +331,8 @@ begin bends = fix_gentle_inflections(bends); if dbg then - insert into debug_wm(name, way) values( + insert into debug_wm(section, name, way) values( + 'simplifywm', dbg_stage || 'cinflections' || i || '_' || generate_subscripts(bends, 1), unnest(bends) ); @@ -327,7 +341,8 @@ begin select * from self_crossing(bends) into bends, mutated; if dbg then - insert into debug_wm(name, way) values( + insert into debug_wm(section, name, way) values( + 'simplifywm', dbg_stage || 'dcrossings' || i || '_' || generate_subscripts(bends, 1), unnest(bends) );