From 812b6df02b405038afd7f1cd89f3ff71af0b8a4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Fri, 29 Nov 2019 00:59:37 +0200 Subject: [PATCH] griovys --- Karto/assignment4/draw.py | 63 ++++++++++++++++++++++++++------------- 1 file changed, 43 insertions(+), 20 deletions(-) diff --git a/Karto/assignment4/draw.py b/Karto/assignment4/draw.py index 4b5d053..0db66fb 100755 --- a/Karto/assignment4/draw.py +++ b/Karto/assignment4/draw.py @@ -11,21 +11,36 @@ from measure import * juosta = namedtuple('juosta', ['plotis', 'kryptis', 'dashes', 'spalva']) kelias = namedtuple('kelias', ['virsunes', 'plotis', 'kat', 'dashes', 'spalva', 'juostos']) -fig, ax = plt.subplots() +CONTINUOUS = (1,0) +DASHDOTX2 = (10,3,2,3) +DASHED = (100,20) + a08 = kelias( virsunes=[1,2,3], plotis=A08_plotis, kat=KAT1, - dashes=[10,3,2,3], + dashes=DASHDOTX2, spalva='red', juostos=( - juosta(L6+L5+L4, 'right', (100,20), 'lightgreen'), - juosta(L6+L5, 'right', (100,20), 'lightgreen'), - juosta(L6, 'right', (1,0), 'black'), - juosta(L7, 'left', (1,0), 'black'), - juosta(L7+L8, 'left', (100,20), 'lightgreen'), - juosta(L7+L8+L9, 'left', (100,20), 'lightgreen'), + juosta(L6+L5+L4, 'right', DASHED, 'lightgreen'), + juosta(L6+L5, 'right', DASHED, 'lightgreen'), + juosta(L6, 'right', CONTINUOUS, 'black'), + juosta(L7, 'left', CONTINUOUS, 'black'), + juosta(L7+L8, 'left', DASHED, 'lightgreen'), + juosta(L7+L8+L9, 'left', DASHED, 'lightgreen'), + ), +) + +a05 = kelias( + virsunes=[4,5,6,7,8,9,10], + plotis=A05_plotis, + kat=KAT2, + dashes=DASHDOTX2, + spalva='red', + juostos=( + juosta(L3, 'right', CONTINUOUS, 'brown'), + juosta(L2, 'left', CONTINUOUS, 'brown'), ), ) @@ -33,16 +48,33 @@ a03 = kelias( virsunes=[11,12,13,14,15,16,17,18], plotis=A03_plotis, kat=KAT3, - dashes=(1,0), + dashes=CONTINUOUS, spalva='pink', juostos=( - offset(L1, 'right', (100,20), 'pink'), + juosta(L1, 'right', DASHED, 'pink'), + ), +) + +g11 = kelias( + virsunes=[19,20,21,22,23], + plotis=G11_plotis, + kat=KAT4, + dashes=CONTINUOUS, + spalva='red', + juostos=( + juosta(L10+L11, 'right', CONTINUOUS, 'blue'), + juosta(L11, 'right', CONTINUOUS, 'lightblue'), + juosta(L12, 'left', CONTINUOUS, 'lightblue'), + juosta(L12+L13, 'left', CONTINUOUS, 'blue'), ), ) +# implementacija +fig, ax = plt.subplots() +ax.set_title('Užliejamų plotų brėžinys') -for kelias in [a08, a03]: +for kelias in [a08, a05, a03, g11]: # ašis 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) @@ -59,13 +91,4 @@ for kelias in [a08, a03]: ax.add_patch(PolygonPatch(asPolygon(kelias_poly), fc='white', zorder=kelias.kat, linewidth=0)) -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_offsetR = A05_l.parallel_offset(L3, 'right', join_style=2) -ax.plot(*A05_l.xy, zorder=KAT2) -ax.plot(*A05_offsetL.xy, dashes=[5,5], zorder=KAT2) -ax.plot(*A05_offsetR.xy, dashes=[5,5], zorder=KAT2) - -ax.set_title('Užliejamų plotų brėžinys') - plt.show()