make tables
This commit is contained in:
parent
23341e16a0
commit
06472316e0
@ -1,32 +1,49 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
from collections import namedtuple
|
||||||
from shapely.geometry import LineString, asPolygon
|
from shapely.geometry import LineString, asPolygon
|
||||||
from descartes import PolygonPatch
|
from descartes import PolygonPatch
|
||||||
|
|
||||||
from measure import *
|
from measure import *
|
||||||
|
|
||||||
|
offset = namedtuple('offset', ['width', 'direction', 'dashes', 'color'])
|
||||||
|
kelias = namedtuple('kelias', ['line', 'width', 'kat', 'dashes', 'color', 'offsets'])
|
||||||
|
|
||||||
fig, ax = plt.subplots()
|
fig, ax = plt.subplots()
|
||||||
|
|
||||||
|
a08 = kelias(
|
||||||
# Kelias A08
|
line=LineString([Points[i].xy for i in [1,2,3] ]),
|
||||||
A08_l = LineString([Points[i].xy for i in [1,2,3] ])
|
width=A08_plotis,
|
||||||
A08_multi = A08_plotis/(L4+L5+L6+L7+L8+L9)
|
kat=KAT1,
|
||||||
def offset(width, direction):
|
dashes=[10,3,2,3],
|
||||||
return A08_l.parallel_offset(width * A08_multi, direction, join_style=2)
|
color='red',
|
||||||
offsets = (
|
offsets=(
|
||||||
(offset(L6+L5+L4, 'right'), [100,20], 'lightgreen'),
|
offset(L6+L5+L4, 'right', [100,20], 'lightgreen'),
|
||||||
(offset(L6+L5, 'right'), [100,20], 'lightgreen'),
|
offset(L6+L5, 'right', [100,20], 'lightgreen'),
|
||||||
(offset(L6, 'right'), [1,0], 'black'),
|
offset(L6, 'right', [1,0], 'black'),
|
||||||
(offset(L7, 'left'), [1,0], 'black'),
|
offset(L7, 'left', [1,0], 'black'),
|
||||||
(offset(L7+L8, 'left'), [100,20], 'lightgreen'),
|
offset(L7+L8, 'left', [100,20], 'lightgreen'),
|
||||||
(offset(L7+L8+L9, 'left'), [100,20], 'lightgreen'),
|
offset(L7+L8+L9, 'left', [100,20], 'lightgreen'),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
ax.plot(*A08_l.xy, linewidth=2, dashes=[10,3,2,3], color='red', zorder=KAT1)
|
|
||||||
for line, dashes, color in offsets:
|
for kelias in [a08]:
|
||||||
ax.plot(*line.xy, linewidth=.5, dashes=dashes, color=color, zorder=KAT1)
|
# ašis
|
||||||
A08_poly = np.vstack((offsets[0][0].coords, offsets[-1][0].coords))
|
ax.plot(*kelias.line.xy, linewidth=2, dashes=kelias.dashes, color=kelias.color, zorder=kelias.kat)
|
||||||
ax.add_patch(PolygonPatch(asPolygon(A08_poly), fc='white', zorder=KAT1, linewidth=0))
|
|
||||||
|
# offset'ai
|
||||||
|
offset_multiplier = kelias.width/(kelias.offsets[0].width + kelias.offsets[-1].width)
|
||||||
|
offset_lines = []
|
||||||
|
for offset in kelias.offsets:
|
||||||
|
l = kelias.line.parallel_offset(offset.width * offset_multiplier, offset.direction, join_style=2)
|
||||||
|
offset_lines.append(l)
|
||||||
|
ax.plot(*l.xy, linewidth=.5, dashes=offset.dashes, color=offset.color, zorder=kelias.kat)
|
||||||
|
# kelio poligonas su plotu
|
||||||
|
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))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
A03_l = LineString([Points[i].xy for i in [11,12,13,14,15,16,17,18] ])
|
A03_l = LineString([Points[i].xy for i in [11,12,13,14,15,16,17,18] ])
|
||||||
|
Loading…
Reference in New Issue
Block a user