Merge branch 'master' of moriya.zapto.org:LCI/defi-rendu-legifrance

This commit is contained in:
TheDevKiller 2018-11-11 17:36:35 +01:00
commit 7ec3f36f46

View File

@ -3,17 +3,26 @@
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import mplleaflet import mplleaflet
import fetch import fetch
from tqdm import tqdm
import time
import math
def circlepolygon(radius, center, resolution=20):
points=[[center[0] + math.cos(((2*math.pi)/resolution)*i)*radius*1.15, center[1] + math.sin(((2*math.pi)/resolution)*i)*radius] for i in range(resolution)]
return points
def genplot(diclist): def genplot(diclist):
for index, area in enumerate(diclist): for area in tqdm(diclist, ncols=50):
if index in [210,223]:
continue
for figure in area['zone']: for figure in area['zone']:
if figure[0] == 'cercle' : if figure[0] == 'cercle' :
print("cercle") xcoords,ycoords=[],[]
for xaxis,yaxis in circlepolygon(figure[1]/100000, figure[2::], resolution=100):
xcoords.append(xaxis)
ycoords.append(yaxis)
xcoords.append(xcoords[0])
ycoords.append(ycoords[0])
plt.plot(xcoords,ycoords,'b')
plt.plot(figure[2],figure[3],'rs')
plt.fill(xcoords,ycoords,'g')
else: else:
print("polygone")
xcoords,ycoords=[],[] xcoords,ycoords=[],[]
for xaxis,yaxis in figure: for xaxis,yaxis in figure:
xcoords.append(xaxis) xcoords.append(xaxis)
@ -26,12 +35,6 @@ def genplot(diclist):
return plt return plt
#plt.plot([15,16,17,15],[6,7,18,6],'b')
#plt.plot(17,6,'b')
#plt.plot(16,7,'rs')
#plt.fill([15,16,17,15],[6,7,18,6])
#mplleaflet.show()
if __name__ == '__main__': if __name__ == '__main__':
plt=genplot(fetch.fetch()) genplot(fetch.fetch())
mplleaflet.show() mplleaflet.show()