diff --git a/II/Referatas/Makefile b/II/Referatas/Makefile index a2d5184..ff198a9 100644 --- a/II/Referatas/Makefile +++ b/II/Referatas/Makefile @@ -1,27 +1,31 @@ TOLERANCES = 100 125 250 500 1000 2000 4000 GEN = $(addsuffix .pdf, \ - $(addprefix douglas-,$(TOLERANCES)) \ - $(addprefix visvalingam-,$(TOLERANCES))) + $(addprefix zeimena-douglas-,$(TOLERANCES)) \ + $(addprefix zeimena-visvalingam-,$(TOLERANCES))) mj-referatas.pdf: mj-referatas.tex version.tex bib.bib zeimena-pretty.pdf $(GEN) latexmk -g -pdf $< define algo2img -db/.faux_$(1)-$(2): $(1).sql db/.faux_ready - ./managedb -- --echo-all -v ON_ERROR_STOP=1 -v tolerance=$(2) -f $(1).sql - touch db/.faux_$(1)-$(2) +db/.faux_$(1)-$(2)-$(3): $(2).sql db/.faux_ready + ./managedb -- --echo-all -v ON_ERROR_STOP=1 -v src=$(1) -v tolerance=$(3) -v tbl=$(1)_$(2)_$(3) -f $(2).sql + touch $$@ -$(1)-$(2).pdf: layer2img.py db/.faux_$(1)-$(2) - ./layer2img.py --table=$(1)_$(2) --size=52x74 --outfile $(1)-$(2).pdf +$(1)-$(2)-$(3).pdf: layer2img.py db/.faux_$(1)-$(2)-$(3) + ./layer2img.py --table=$(1)_$(2)_$(3) --size=52x74 --outfile $(1)-$(2)-$(3).pdf endef -$(foreach t,$(TOLERANCES),$(eval $(call algo2img,douglas,$(t)))) -$(foreach t,$(TOLERANCES),$(eval $(call algo2img,visvalingam,$(t)))) +$(foreach t,$(TOLERANCES),$(eval $(call algo2img,zeimena,douglas,$(t)))) +$(foreach t,$(TOLERANCES),$(eval $(call algo2img,zeimena,visvalingam,$(t)))) -db/.faux_ready: zeimena.gpkg managedb +sinewave.json: sinewave.py + ./sinewave.py + +db/.faux_ready: zeimena.gpkg sinewave.json managedb -./managedb stop; rm -fr db ./managedb init - ogr2ogr -f PostgreSQL "PG:host=127.0.0.1 user=osm dbname=osm" $< + ogr2ogr -f PostgreSQL "PG:host=127.0.0.1 user=osm dbname=osm" zeimena.gpkg + ogr2ogr -f PostgreSQL "PG:host=127.0.0.1 user=osm dbname=osm" sinewave.json touch $@ REF = $(shell git describe --tags) diff --git a/II/Referatas/douglas.sql b/II/Referatas/douglas.sql index 495ba67..ef997e2 100644 --- a/II/Referatas/douglas.sql +++ b/II/Referatas/douglas.sql @@ -1,14 +1,14 @@ -DROP TABLE IF EXISTS douglas_:tolerance; +DROP TABLE IF EXISTS :tbl; -CREATE TABLE douglas_:tolerance ( +CREATE TABLE :tbl ( fid serial NOT NULL, geom geometry(MULTILINESTRING, 3346) ); -INSERT INTO douglas_:tolerance (geom) ( +INSERT INTO :tbl (geom) ( SELECT ST_Simplify (ST_LineMerge (ST_Union (geom)), :tolerance) AS geoms FROM - zeimena); + :src); diff --git a/II/Referatas/mj-referatas.tex b/II/Referatas/mj-referatas.tex index ae9ec54..7a82948 100644 --- a/II/Referatas/mj-referatas.tex +++ b/II/Referatas/mj-referatas.tex @@ -173,28 +173,28 @@ retained. Visvalingam-Whyatt \tabularnewline \hline 125 & - \includegraphics[width=\linewidth]{douglas-125} & - \includegraphics[width=\linewidth]{visvalingam-125} \tabularnewline \hline + \includegraphics[width=\linewidth]{zeimena-douglas-125} & + \includegraphics[width=\linewidth]{zeimena-visvalingam-125} \tabularnewline \hline 250 & - \includegraphics[width=.5\linewidth]{douglas-250} & - \includegraphics[width=.5\linewidth]{visvalingam-250} \tabularnewline \hline + \includegraphics[width=.5\linewidth]{zeimena-douglas-250} & + \includegraphics[width=.5\linewidth]{zeimena-visvalingam-250} \tabularnewline \hline 500 & - \includegraphics[width=.25\linewidth]{douglas-500} & - \includegraphics[width=.25\linewidth]{visvalingam-500} \tabularnewline \hline + \includegraphics[width=.25\linewidth]{zeimena-douglas-500} & + \includegraphics[width=.25\linewidth]{zeimena-visvalingam-500} \tabularnewline \hline 1000 & - \includegraphics[width=.125\linewidth]{douglas-1000} & - \includegraphics[width=.125\linewidth]{visvalingam-1000} \tabularnewline \hline + \includegraphics[width=.125\linewidth]{zeimena-douglas-1000} & + \includegraphics[width=.125\linewidth]{zeimena-visvalingam-1000} \tabularnewline \hline 2000 & - \includegraphics[width=.0625\linewidth]{douglas-2000} & - \includegraphics[width=.0625\linewidth]{visvalingam-2000} \tabularnewline \hline + \includegraphics[width=.0625\linewidth]{zeimena-douglas-2000} & + \includegraphics[width=.0625\linewidth]{zeimena-visvalingam-2000} \tabularnewline \hline 4000 & - \includegraphics[width=.0625\linewidth]{douglas-4000} & - \includegraphics[width=.0625\linewidth]{visvalingam-4000} \tabularnewline \hline + \includegraphics[width=.0625\linewidth]{zeimena-douglas-4000} & + \includegraphics[width=.0625\linewidth]{zeimena-visvalingam-4000} \tabularnewline \hline \end{tabularx} \caption{{\DP} and {\VW} side-by-side visual comparison} \label{tab:dp-vs-vw} diff --git a/II/Referatas/sinewave.py b/II/Referatas/sinewave.py index 3f540ee..e718d90 100755 --- a/II/Referatas/sinewave.py +++ b/II/Referatas/sinewave.py @@ -14,7 +14,7 @@ TAILS = np.zeros(int(TAIL_LEN / INTERVAL)) def main(): sin_range = np.arange(-pi/4, SINE_LEN, INTERVAL) - amplitude = np.sin(sin_range * pi / 2) + 1 + amplitude = (np.sin(sin_range * pi / 2) + 1)*2 y = np.concatenate([TAILS, amplitude, TAILS]) x = np.arange(-TAIL_LEN - pi/4, SINE_LEN + TAIL_LEN, INTERVAL) geom = LineString(zip(x, y)) diff --git a/II/Referatas/visvalingam.sql b/II/Referatas/visvalingam.sql index fb841e8..340ce1d 100644 --- a/II/Referatas/visvalingam.sql +++ b/II/Referatas/visvalingam.sql @@ -1,14 +1,14 @@ -DROP TABLE IF EXISTS visvalingam_:tolerance; +DROP TABLE IF EXISTS :tbl; -CREATE TABLE visvalingam_:tolerance ( +CREATE TABLE :tbl ( fid serial NOT NULL, geom geometry(MULTILINESTRING, 3346) ); -INSERT INTO visvalingam_:tolerance (geom) ( +INSERT INTO :tbl (geom) ( SELECT ST_SimplifyVW (ST_LineMerge (ST_Union (geom)), :tolerance * :tolerance) AS geoms FROM - zeimena); + :src);