lithuanian yes

This commit is contained in:
Motiejus Jakštys 2019-11-29 00:46:31 +02:00
parent 06472316e0
commit 70565a8f37

View File

@ -8,49 +8,57 @@ from descartes import PolygonPatch
from measure import * from measure import *
offset = namedtuple('offset', ['width', 'direction', 'dashes', 'color']) juosta = namedtuple('juosta', ['plotis', 'kryptis', 'dashes', 'spalva'])
kelias = namedtuple('kelias', ['line', 'width', 'kat', 'dashes', 'color', 'offsets']) kelias = namedtuple('kelias', ['virsunes', 'plotis', 'kat', 'dashes', 'spalva', 'juostos'])
fig, ax = plt.subplots() fig, ax = plt.subplots()
a08 = kelias( a08 = kelias(
line=LineString([Points[i].xy for i in [1,2,3] ]), virsunes=[1,2,3],
width=A08_plotis, plotis=A08_plotis,
kat=KAT1, kat=KAT1,
dashes=[10,3,2,3], dashes=[10,3,2,3],
color='red', spalva='red',
offsets=( juostos=(
offset(L6+L5+L4, 'right', [100,20], 'lightgreen'), juosta(L6+L5+L4, 'right', (100,20), 'lightgreen'),
offset(L6+L5, 'right', [100,20], 'lightgreen'), juosta(L6+L5, 'right', (100,20), 'lightgreen'),
offset(L6, 'right', [1,0], 'black'), juosta(L6, 'right', (1,0), 'black'),
offset(L7, 'left', [1,0], 'black'), juosta(L7, 'left', (1,0), 'black'),
offset(L7+L8, 'left', [100,20], 'lightgreen'), juosta(L7+L8, 'left', (100,20), 'lightgreen'),
offset(L7+L8+L9, 'left', [100,20], 'lightgreen'), juosta(L7+L8+L9, 'left', (100,20), 'lightgreen'),
), ),
) )
for kelias in [a08]: a03 = kelias(
virsunes=[11,12,13,14,15,16,17,18],
plotis=A03_plotis,
kat=KAT3,
dashes=(1,0),
spalva='pink',
juostos=(
offset(L1, 'right', (100,20), 'pink'),
),
)
for kelias in [a08, a03]:
# ašis # ašis
ax.plot(*kelias.line.xy, linewidth=2, dashes=kelias.dashes, color=kelias.color, zorder=kelias.kat) kelias_line = LineString([Points[i].xy for i in kelias.virsunes ])
ax.plot(*kelias_line.xy, linewidth=2, dashes=kelias.dashes, color=kelias.spalva, zorder=kelias.kat)
# offset'ai # offset'ai
offset_multiplier = kelias.width/(kelias.offsets[0].width + kelias.offsets[-1].width) offset_multiplier = kelias.plotis/(kelias.juostos[0].plotis + kelias.juostos[-1].plotis)
offset_lines = [] offset_lines = []
for offset in kelias.offsets: for offset in kelias.juostos:
l = kelias.line.parallel_offset(offset.width * offset_multiplier, offset.direction, join_style=2) l = kelias_line.parallel_offset(offset.plotis * offset_multiplier, offset.kryptis, join_style=2)
offset_lines.append(l) offset_lines.append(l)
ax.plot(*l.xy, linewidth=.5, dashes=offset.dashes, color=offset.color, zorder=kelias.kat) ax.plot(*l.xy, linewidth=.5, dashes=offset.dashes, color=offset.spalva, zorder=kelias.kat)
# kelio poligonas su plotu # kelio poligonas su plotu
kelias_poly = np.vstack((offset_lines[0].coords, offset_lines[-1].coords)) kelias_poly = np.vstack((offset_lines[0].coords, offset_lines[-1].coords))
ax.add_patch(PolygonPatch(asPolygon(kelias_poly), fc='white', zorder=kelias.kat, linewidth=0)) ax.add_patch(PolygonPatch(asPolygon(kelias_poly), fc='white', zorder=kelias.kat, linewidth=0))
A03_l = LineString([Points[i].xy for i in [11,12,13,14,15,16,17,18] ])
A03_offsetR = A03_l.parallel_offset(A03_plotis, 'right', join_style=2)
ax.plot(*A03_l.xy, zorder=KAT3)
ax.plot(*A03_offsetR.xy, dashes=[5,5], zorder=KAT3)
A05_l = LineString([Points[i].xy for i in [4,5,6,7,8,9,10] ]) A05_l = LineString([Points[i].xy for i in [4,5,6,7,8,9,10] ])
A05_offsetL = A05_l.parallel_offset(L2, 'left', join_style=2) A05_offsetL = A05_l.parallel_offset(L2, 'left', join_style=2)
A05_offsetR = A05_l.parallel_offset(L3, 'right', join_style=2) A05_offsetR = A05_l.parallel_offset(L3, 'right', join_style=2)