extend source by adding algorithm
This commit is contained in:
parent
6d9897652f
commit
996b03fb93
@ -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)
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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}
|
||||
|
@ -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))
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user