diff --git a/II/Referatas/Makefile b/II/Referatas/Makefile index 65aed88..c0623e2 100644 --- a/II/Referatas/Makefile +++ b/II/Referatas/Makefile @@ -1,7 +1,7 @@ CROSSING=622916 6109267 626066 6111487 # xmin ymin xmax ymax -ZEIMENA_TOLERANCES = 100 125 250 500 1000 2000 4000 +ZEIMENA_TOLERANCES = 128 256 512 1024 2048 4096 SINEWAVE_TOLERANCES = 1 20 30 40 -CROSSING_TOLERANCES = 125 250 500 +CROSSING_TOLERANCES = 64 128 256 GEN1 = $(addsuffix .pdf, \ $(addprefix sinewave-douglas-,$(SINEWAVE_TOLERANCES)) \ $(addprefix sinewave-visvalingam-,$(SINEWAVE_TOLERANCES)) \ @@ -21,25 +21,25 @@ db/.faux_$(1)-$(2)-%: $(2).sql db/.faux_ready ./managedb -- --echo-all -v ON_ERROR_STOP=1 -v src=$(1) -v tolerance=$$* -v tbl=$(1)_$(2)_$$* -f $(2).sql touch $$@ $(1)-$(2)-%.pdf: layer2img.py db/.faux_$(1)-$(2)-% - ./layer2img.py --table=$(1)_$(2)_$$* --size=$(3) --outfile $$@ + ./layer2img.py --group2-table=$(1)_$(2)_$$* --size=$(3) --outfile $$@ endef define algo2overlay crossing-$(1)-$(2)-%.pdf: layer2img.py db/.faux_$(1)-$(2)-% - ./layer2img.py $(3) --table=$(1)_$(2)_$$* --overlay-table=$(1) --outfile $$@ + ./layer2img.py $(3) --group1-table=$(1) --group2-table=$(1)_$(2)_$$* --outfile $$@ endef define gpkg2pdf $(1): $(2) ./layer2img.py - ./layer2img.py $(3) --infile=$$< --outfile $(1) + ./layer2img.py $(3) --group1-infile=$$< --outfile $(1) endef $(eval $(call algo2img,sinewave,douglas,60x24)) $(eval $(call algo2img,sinewave,visvalingam,60x24)) $(eval $(call algo2img,zeimena,douglas,210x297)) $(eval $(call algo2img,zeimena,visvalingam,210x297)) -$(eval $(call gpkg2pdf,sinewave.pdf,sinewave.gpkg,,--size=52x12)) -$(eval $(call gpkg2pdf,zeimena.pdf,zeimena.gpkg rectangle.gpkg,--size=67x95 --overlay-infile rectangle.gpkg)) +$(eval $(call gpkg2pdf,sinewave.pdf,sinewave.gpkg,,--size=60x24)) +$(eval $(call gpkg2pdf,zeimena.pdf,zeimena.gpkg rectangle.gpkg,--size=67x95 --group2-infile rectangle.gpkg)) $(eval $(call gpkg2pdf,crossing.pdf,zeimena.gpkg,--size=105x74 --clip $(CROSSING))) $(eval $(call algo2overlay,zeimena,douglas,--size 297x210 --clip $(CROSSING))) $(eval $(call algo2overlay,zeimena,visvalingam,--size 297x210 --clip $(CROSSING))) diff --git a/II/Referatas/layer2img.py b/II/Referatas/layer2img.py index 470afca..1d2a9da 100755 --- a/II/Referatas/layer2img.py +++ b/II/Referatas/layer2img.py @@ -24,17 +24,17 @@ def plt_size(string): def parse_args(): parser = argparse.ArgumentParser( description='Convert geopackage to an image') - ingroup = parser.add_mutually_exclusive_group(required=True) - ingroup.add_argument('--infile') - ingroup.add_argument('--table') + group1 = parser.add_mutually_exclusive_group() + group1.add_argument('--group1-infile') + group1.add_argument('--group1-table') parser.add_argument('-o', '--outfile', metavar='') parser.add_argument( '--size', type=plt_size, help='Figure size in mm (WWxHH)') parser.add_argument( '--clip', type=float, nargs=4, metavar=BOUNDS) - overlay = parser.add_mutually_exclusive_group() - overlay.add_argument('--overlay-infile', type=str) - overlay.add_argument('--overlay-table', type=str) + group2 = parser.add_mutually_exclusive_group() + group2.add_argument('--group2-infile', type=str) + group2.add_argument('--group2-table', type=str) return parser.parse_args() @@ -49,20 +49,21 @@ def read_layer(maybe_table, maybe_file): def main(): args = parse_args() - primary = read_layer(args.table, args.infile) - overlay = read_layer(args.overlay_table, args.overlay_infile) + group1 = read_layer(args.group1_table, args.group1_infile) + group2 = read_layer(args.group2_table, args.group2_infile) rc('text', usetex=True) fig, ax = plt.subplots() if args.size: fig.set_size_inches(args.size) - primary.plot(ax=ax, color=PURPLE) if c := args.clip: ax.set_xlim(left=c[0], right=c[2]) ax.set_ylim(bottom=c[1], top=c[3]) - if overlay is not None: - overlay.plot(ax=ax, color=ORANGE) + if group1 is not None: + group1.plot(ax=ax, color=PURPLE) + if group2 is not None: + group2.plot(ax=ax, color=ORANGE) ax.axis('off') ax.margins(0, 0) diff --git a/II/Referatas/mj-referatas.tex b/II/Referatas/mj-referatas.tex index 8a3e7af..e32468e 100644 --- a/II/Referatas/mj-referatas.tex +++ b/II/Referatas/mj-referatas.tex @@ -207,29 +207,29 @@ bends on the original map should be retained. Douglas \& Peucker & Visvalingam-Whyatt \tabularnewline \hline - 125/15625 & - \includegraphics[width=\linewidth]{zeimena-douglas-125} & - \includegraphics[width=\linewidth]{zeimena-visvalingam-125} \tabularnewline \hline + 128/15625 & + \includegraphics[width=\linewidth]{zeimena-douglas-128} & + \includegraphics[width=\linewidth]{zeimena-visvalingam-128} \tabularnewline \hline - 250/62500 & - \includegraphics[width=.5\linewidth]{zeimena-douglas-250} & - \includegraphics[width=.5\linewidth]{zeimena-visvalingam-250} \tabularnewline \hline + 256/62560 & + \includegraphics[width=.5\linewidth]{zeimena-douglas-256} & + \includegraphics[width=.5\linewidth]{zeimena-visvalingam-256} \tabularnewline \hline - 500/250000 & - \includegraphics[width=.25\linewidth]{zeimena-douglas-500} & - \includegraphics[width=.25\linewidth]{zeimena-visvalingam-500} \tabularnewline \hline + 512/251200 & + \includegraphics[width=.25\linewidth]{zeimena-douglas-512} & + \includegraphics[width=.25\linewidth]{zeimena-visvalingam-512} \tabularnewline \hline - 1000/1000000 & - \includegraphics[width=.125\linewidth]{zeimena-douglas-1000} & - \includegraphics[width=.125\linewidth]{zeimena-visvalingam-1000} \tabularnewline \hline + 1024/1024000 & + \includegraphics[width=.125\linewidth]{zeimena-douglas-1024} & + \includegraphics[width=.125\linewidth]{zeimena-visvalingam-1024} \tabularnewline \hline - 2000/4000000 & - \includegraphics[width=.0625\linewidth]{zeimena-douglas-2000} & - \includegraphics[width=.0625\linewidth]{zeimena-visvalingam-2000} \tabularnewline \hline + 2048/4000000 & + \includegraphics[width=.0625\linewidth]{zeimena-douglas-2048} & + \includegraphics[width=.0625\linewidth]{zeimena-visvalingam-2048} \tabularnewline \hline - 4000/16000000 & - \includegraphics[width=.0625\linewidth]{zeimena-douglas-4000} & - \includegraphics[width=.0625\linewidth]{zeimena-visvalingam-4000} \tabularnewline \hline + 4096/16000000 & + \includegraphics[width=.0625\linewidth]{zeimena-douglas-4096} & + \includegraphics[width=.0625\linewidth]{zeimena-visvalingam-4096} \tabularnewline \hline \end{tabularx} \caption{{\DP} and {\VW} on Žeimena} \label{tab:comparison-zeimena} @@ -240,22 +240,23 @@ Let's zoom in to the river crossing area for some of the algorithms. \begin{figure}[h] \renewcommand{\tabularxcolumn}[1]{>{\center\small}m{#1}} - \begin{tabularx}{\textwidth}{ p{1.5cm} | X | X | } + \begin{tabularx}{\textwidth}{ p{2.1cm} | X | X | } Tolerance DP/VW & Douglas \& Peucker & Visvalingam-Whyatt \tabularnewline \hline + 64/4096 & + \includegraphics[width=\linewidth]{crossing-zeimena-douglas-64} & + \includegraphics[width=\linewidth]{crossing-zeimena-visvalingam-64} \tabularnewline \hline + 125/15625 & - \includegraphics[width=\linewidth]{crossing-zeimena-douglas-125} & - \includegraphics[width=\linewidth]{crossing-zeimena-visvalingam-125} \tabularnewline \hline + \includegraphics[width=\linewidth]{crossing-zeimena-douglas-128} & + \includegraphics[width=\linewidth]{crossing-zeimena-visvalingam-128} \tabularnewline \hline 250/62500 & - \includegraphics[width=.5\linewidth]{crossing-zeimena-douglas-250} & - \includegraphics[width=.5\linewidth]{crossing-zeimena-visvalingam-250} \tabularnewline \hline + \includegraphics[width=\linewidth]{crossing-zeimena-douglas-256} & + \includegraphics[width=\linewidth]{crossing-zeimena-visvalingam-256} \tabularnewline \hline - 500/250000 & - \includegraphics[width=.25\linewidth]{crossing-zeimena-douglas-500} & - \includegraphics[width=.25\linewidth]{crossing-zeimena-visvalingam-500} \tabularnewline \hline \end{tabularx} \caption{{\DP} and {\VW} on river crossing area} \label{tab:comparison-zoomed}