whitespace
This commit is contained in:
parent
509ec9e59f
commit
aeb11dba92
2
Makefile
2
Makefile
@ -45,7 +45,7 @@ mj-msc-all.pdf: mj-msc.pdf version.tex $(ARCHIVABLES)
|
||||
mv .tmp-$@ $@
|
||||
|
||||
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
|
||||
./db -f tests.sql
|
||||
|
26
layer2img.py
26
layer2img.py
@ -12,8 +12,8 @@ BOUNDS = ('xmin', 'ymin', 'xmax', 'ymax')
|
||||
GREEN, ORANGE, PURPLE = '#1b9e77', '#d95f02', '#7570b3'
|
||||
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', \
|
||||
hl=0.3, hw=3, c='black'):
|
||||
def arrowplot(axes, x, y, narrs=30, dspace=0.1, direc='pos', \
|
||||
hl=0.1, hw=5, c='black'):
|
||||
''' narrs : Number of arrows that will be drawn 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.add_argument('--group1-infile')
|
||||
group1.add_argument('--group1-table')
|
||||
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)
|
||||
parser.add_argument('--group1-arrows', type=bool)
|
||||
|
||||
group2 = parser.add_mutually_exclusive_group()
|
||||
group2.add_argument('--group2-infile', type=str)
|
||||
group2.add_argument('--group2-table', type=str)
|
||||
parser.add_argument('--group2-arrows', type=bool)
|
||||
|
||||
group3 = parser.add_mutually_exclusive_group()
|
||||
group3.add_argument('--group3-infile', 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()
|
||||
|
||||
|
||||
@ -141,8 +145,8 @@ def add_lines(ax, group):
|
||||
for g in group.to_dict()['way'].values():
|
||||
for geom in getattr(g, 'geoms', [g]):
|
||||
x, y = zip(*geom.coords)
|
||||
narrs = geom.length / 16
|
||||
#arrowplot(ax, np.array(x), np.array(y), narrs=narrs)
|
||||
narrs = geom.length / 25
|
||||
arrowplot(ax, np.array(x), np.array(y), narrs=narrs)
|
||||
|
||||
def main():
|
||||
args = parse_args()
|
||||
@ -160,13 +164,13 @@ def main():
|
||||
|
||||
if group1 is not None:
|
||||
group1.plot(ax=ax, color=ORANGE)
|
||||
add_lines(ax, group1)
|
||||
args.group1_arrows and add_lines(ax, group1)
|
||||
if group2 is not None:
|
||||
group2.plot(ax=ax, color=PURPLE)
|
||||
add_lines(ax, group2)
|
||||
args.group2_arrows and add_lines(ax, group1)
|
||||
if group3 is not None:
|
||||
group3.plot(ax=ax, color=GREEN)
|
||||
add_lines(ax, group3)
|
||||
args.group3_arrows and add_lines(ax, group1)
|
||||
|
||||
ax.axis('off')
|
||||
ax.margins(0, 0)
|
||||
|
@ -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
|
||||
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]
|
||||
\centering
|
||||
\includegraphics[width=\linewidth]{test-figures}
|
||||
\caption{Visualized figures for automated text cases}
|
||||
\caption{line geometries for automated test cases}
|
||||
\label{fig:test-figures}
|
||||
\end{figure}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user