diff --git a/Makefile b/Makefile index b12420b..8670cf8 100644 --- a/Makefile +++ b/Makefile @@ -96,33 +96,34 @@ fig5-gentle-inflection-after_1SELECT = wm_debug where name='fig5' AND stage='cin fig5-gentle-inflection-after_2SELECT = wm_debug where name='fig5' AND stage='cinflections-polygon' AND gen=1 fig5-gentle-inflection-after_2CMAP = 1 -inflection-1-gentle-inflection-before_SIZE = A5 +inflection-1-gentle-inflection-before_WIDTHDIV = 2 inflection-1-gentle-inflection-before_1SELECT = wm_debug where name='inflection-1' AND stage='bbends' AND gen=1 inflection-1-gentle-inflection-before_2SELECT = wm_debug where name='inflection-1' AND stage='bbends-polygon' AND gen=1 inflection-1-gentle-inflection-before_2CMAP = 1 -inflection-1-gentle-inflection-after_SIZE = A5 +inflection-1-gentle-inflection-after_WIDTHDIV = 2 inflection-1-gentle-inflection-after_1SELECT = wm_debug where name='inflection-1' AND stage='cinflections' AND gen=1 inflection-1-gentle-inflection-after_2SELECT = wm_debug where name='inflection-1' AND stage='cinflections-polygon' AND gen=1 inflection-1-gentle-inflection-after_2CMAP = 1 -fig6-selfcrossing-before_SIZE = A7 +fig6-selfcrossing-before_WIDTHDIV = 2 fig6-selfcrossing-before_1SELECT = wm_debug where name='fig6' AND stage='bbends' AND gen=1 fig6-selfcrossing-before_2SELECT = wm_visuals where name='fig6-baseline' fig6-selfcrossing-before_2LINESTYLE = dotted fig6-selfcrossing-before_3SELECT = wm_visuals where name='fig6-newline' -fig6-selfcrossing-after_SIZE = A7 +fig6-selfcrossing-after_WIDTHDIV = 2 fig6-selfcrossing-after_1SELECT = wm_debug where name='fig6' AND stage='dcrossings' AND gen=1 -selfcrossing-1-before_SIZE = A7 +selfcrossing-1-before_WIDTHDIV = 2 selfcrossing-1-before_1SELECT = wm_debug where name='selfcrossing-1' AND stage='bbends' AND gen=1 selfcrossing-1-before_2SELECT = wm_visuals where name='selfcrossing-1-baseline' selfcrossing-1-before_2LINESTYLE = dotted selfcrossing-1-before_3SELECT = wm_visuals where name='selfcrossing-1-newline' -selfcrossing-1-after_SIZE = A7 +selfcrossing-1-after_WIDTHDIV = 2 selfcrossing-1-after_1SELECT = wm_debug where name='selfcrossing-1' AND stage='dcrossings' AND gen=1 selfcrossing-1-after_2SELECT = wm_debug where name='selfcrossing-1' AND stage='bbends' AND gen=1 selfcrossing-1-after_2LINESTYLE = invisible + .faux_test-rivers: tests-rivers.sql wm.sql .faux_db ./db -f $< touch $@ diff --git a/layer2img.py b/layer2img.py index 1dda684..7b62ec5 100644 --- a/layer2img.py +++ b/layer2img.py @@ -10,17 +10,20 @@ from matplotlib import rc CMAP = 'tab20c' BOUNDS = ('xmin', 'ymin', 'xmax', 'ymax') -INCH = 25.4 # mm +INCH_MM = 25.4 # mm BLACK, GREEN, ORANGE, PURPLE = '#000000', '#1b9e77', '#d95f02', '#7570b3' PSQL_CREDS = "host=127.0.0.1 dbname=osm user=osm password=osm" +# see `NOTICE` in the LaTeX document; this is the width of the main text block. +TEXTWIDTH_CM = 12.12364 +TEXTWIDTH_INCH = TEXTWIDTH_CM * 10 / INCH_MM def plt_size(string): if not string: return None try: w, h = string.split("x") - return float(w) / INCH, float(h) / INCH + return float(w) / INCH_MM, float(h) / INCH_MM except Exception as e: raise argparse.ArgumentTypeError from e @@ -87,7 +90,8 @@ def main(): if args.size: fig.set_size_inches(args.size) else: - fig.set_figwidth(8.27 / args.widthdiv) + w = TEXTWIDTH_INCH / args.widthdiv + fig.set_figwidth(TEXTWIDTH_INCH / args.widthdiv) if c := args.clip: ax.set_xlim(left=c[0], right=c[2]) ax.set_ylim(bottom=c[1], top=c[3]) diff --git a/mj-msc.tex b/mj-msc.tex index d64997e..0324902 100644 --- a/mj-msc.tex +++ b/mj-msc.tex @@ -81,10 +81,12 @@ Current open-source line generalization solutions have their roots in \section{Introduction} \label{sec:introduction} -\begin{itemize} - \item Text width in pt: \prntlen{\textwidth} - \item Text width in cm: {\printinunitsof{cm}\prntlen{\textwidth}} -\end{itemize} +\iffalse +NOTICE: this value should be copied to layer2img.py:TEXTWIDTH, so dimensions +of inline images are reasonable. + +Text width in cm: {\printinunitsof{cm}\prntlen{\textwidth}} +\fi When creating small-scale maps, often the detail of the data source is greater than desired for the map. This becomes especially acute for natural features @@ -357,12 +359,12 @@ when a single vertex is moved outwards the end of the bend. \begin{figure}[h] \centering - \begin{subfigure}[b]{.49\textwidth} + \begin{subfigure}[b]{.45\textwidth} \includegraphics[width=\textwidth]{fig5-gentle-inflection-before} \caption{Before applying the inflection rule} \end{subfigure} \hfill - \begin{subfigure}[b]{.49\textwidth} + \begin{subfigure}[b]{.45\textwidth} \includegraphics[width=\textwidth]{fig5-gentle-inflection-after} \caption{After applying the inflection rule} \end{subfigure} @@ -425,12 +427,12 @@ following the rules of the article. \begin{figure}[h] \centering - \begin{subfigure}[b]{.4\textwidth} + \begin{subfigure}[b]{.45\textwidth} \includegraphics[width=\textwidth]{fig6-selfcrossing-before} \caption{Bend's baseline (dotted) is crossing a neighboring bend} \end{subfigure} \hfill - \begin{subfigure}[b]{.4\textwidth} + \begin{subfigure}[b]{.45\textwidth} \includegraphics[width=\textwidth]{fig6-selfcrossing-after} \caption{Self-crossing removed following the algorithm} \end{subfigure} @@ -445,12 +447,12 @@ figure~\onpage{fig:selfcrossing-1-non-neighbor}. \begin{figure}[h] \centering - \begin{subfigure}[b]{.4\textwidth} + \begin{subfigure}[b]{.45\textwidth} \includegraphics[width=\textwidth]{selfcrossing-1-before} \caption{Bend's baseline (dotted) is crossing a non-neighboring bend} \end{subfigure} \hfill - \begin{subfigure}[b]{.4\textwidth} + \begin{subfigure}[b]{.45\textwidth} \includegraphics[width=\textwidth]{selfcrossing-1-after} \caption{Self-crossing removed following the algorithm} \end{subfigure}