whitespace

This commit is contained in:
Motiejus Jakštys 2021-05-19 22:57:46 +03:00 committed by Motiejus Jakštys
parent 509ec9e59f
commit aeb11dba92
3 changed files with 33 additions and 25 deletions

View File

@ -45,7 +45,7 @@ mj-msc-all.pdf: mj-msc.pdf version.tex $(ARCHIVABLES)
mv .tmp-$@ $@ mv .tmp-$@ $@
test-figures.pdf: layer2img.py tests.sql test-figures.pdf: layer2img.py tests.sql
python ./layer2img.py --group1-table=figures --outfile=$@ python ./layer2img.py --group1-table=figures --group1-arrows=yes --outfile=$@
.faux_test: tests.sql wm.sql .faux.db .faux_test: tests.sql wm.sql .faux.db
./db -f tests.sql ./db -f tests.sql

View File

@ -12,8 +12,8 @@ BOUNDS = ('xmin', 'ymin', 'xmax', 'ymax')
GREEN, ORANGE, PURPLE = '#1b9e77', '#d95f02', '#7570b3' GREEN, ORANGE, PURPLE = '#1b9e77', '#d95f02', '#7570b3'
PSQL_CREDS="host=127.0.0.1 dbname=osm user=osm password=osm" PSQL_CREDS="host=127.0.0.1 dbname=osm user=osm password=osm"
def arrowplot(axes, x, y, narrs=30, dspace=0.5, direc='pos', \ def arrowplot(axes, x, y, narrs=30, dspace=0.1, direc='pos', \
hl=0.3, hw=3, c='black'): hl=0.1, hw=5, c='black'):
''' narrs : Number of arrows that will be drawn along the curve ''' narrs : Number of arrows that will be drawn along the curve
dspace : Shift the position of the arrows along the curve. dspace : Shift the position of the arrows along the curve.
@ -114,18 +114,22 @@ def parse_args():
group1 = parser.add_mutually_exclusive_group() group1 = parser.add_mutually_exclusive_group()
group1.add_argument('--group1-infile') group1.add_argument('--group1-infile')
group1.add_argument('--group1-table') group1.add_argument('--group1-table')
parser.add_argument('-o', '--outfile', metavar='<file>') parser.add_argument('--group1-arrows', type=bool)
parser.add_argument(
'--size', type=plt_size, help='Figure size in mm (WWxHH)')
parser.add_argument( '--clip', type=float, nargs=4, metavar=BOUNDS)
group2 = parser.add_mutually_exclusive_group() group2 = parser.add_mutually_exclusive_group()
group2.add_argument('--group2-infile', type=str) group2.add_argument('--group2-infile', type=str)
group2.add_argument('--group2-table', type=str) group2.add_argument('--group2-table', type=str)
parser.add_argument('--group2-arrows', type=bool)
group3 = parser.add_mutually_exclusive_group() group3 = parser.add_mutually_exclusive_group()
group3.add_argument('--group3-infile', type=str) group3.add_argument('--group3-infile', type=str)
group3.add_argument('--group3-table', type=str) group3.add_argument('--group3-table', type=str)
parser.add_argument('--group3-arrows', type=bool)
parser.add_argument('-o', '--outfile', metavar='<file>')
parser.add_argument(
'--size', type=plt_size, help='Figure size in mm (WWxHH)')
parser.add_argument( '--clip', type=float, nargs=4, metavar=BOUNDS)
return parser.parse_args() return parser.parse_args()
@ -141,8 +145,8 @@ def add_lines(ax, group):
for g in group.to_dict()['way'].values(): for g in group.to_dict()['way'].values():
for geom in getattr(g, 'geoms', [g]): for geom in getattr(g, 'geoms', [g]):
x, y = zip(*geom.coords) x, y = zip(*geom.coords)
narrs = geom.length / 16 narrs = geom.length / 25
#arrowplot(ax, np.array(x), np.array(y), narrs=narrs) arrowplot(ax, np.array(x), np.array(y), narrs=narrs)
def main(): def main():
args = parse_args() args = parse_args()
@ -160,13 +164,13 @@ def main():
if group1 is not None: if group1 is not None:
group1.plot(ax=ax, color=ORANGE) group1.plot(ax=ax, color=ORANGE)
add_lines(ax, group1) args.group1_arrows and add_lines(ax, group1)
if group2 is not None: if group2 is not None:
group2.plot(ax=ax, color=PURPLE) group2.plot(ax=ax, color=PURPLE)
add_lines(ax, group2) args.group2_arrows and add_lines(ax, group1)
if group3 is not None: if group3 is not None:
group3.plot(ax=ax, color=GREEN) group3.plot(ax=ax, color=GREEN)
add_lines(ax, group3) args.group3_arrows and add_lines(ax, group1)
ax.axis('off') ax.axis('off')
ax.margins(0, 0) ax.margins(0, 0)

View File

@ -200,10 +200,14 @@ results have been manually calculated. The test suite executes parts of the
algorithm against a predefined set of geometries, and asserts that the output algorithm against a predefined set of geometries, and asserts that the output
matches the resulting hand-calculated geometry. matches the resulting hand-calculated geometry.
The full set of test geometries is visualized in figure~\ref{fig:test-figures}
on page~\pageref{fig:test-figures}. The figure includes arrows depicting
line direction.
\begin{figure}[H] \begin{figure}[H]
\centering \centering
\includegraphics[width=\linewidth]{test-figures} \includegraphics[width=\linewidth]{test-figures}
\caption{Visualized figures for automated text cases} \caption{line geometries for automated test cases}
\label{fig:test-figures} \label{fig:test-figures}
\end{figure} \end{figure}