from basins.region import Polygon
from basins.basin import SimplePolygonalBasin, ComposedBasin, SimpleBasin

p0 = Polygon([25.504760742187496,25.4278564453125,26.004638671875,25.9716796875],[39.9897471840457,39.50827899034114,39.51251701659638,40.052847601823984])
p1 = Polygon([24.862060546875,24.8785400390625,25.3289794921875,25.356445312499996,25.86181640625,25.839843749999996],[40.713955826286046,40.43440488077008,40.413496049701955,40.271143686084194,40.283716270542584,40.730608477796636])
p2 = Polygon([24.4500732421875,24.4500732421875,23.994140624999996,24.005126953125,25.0927734375,25.037841796875,25.55419921875,25.565185546874996,25.2740478515625,25.2740478515625],[40.34235741658335,40.019201307686785,40.02340800226773,39.78321267821705,39.78321267821705,40.002371935876475,40.03182061333687,40.19146303804063,40.195659093364654,40.34235741658335])
p3 = Polygon([24.0655517578125,25.3125,25.3289794921875,25.960693359374996,25.988159179687496,24.6258544921875,24.5819091796875,24.0655517578125],[39.715638134796336,39.73253798438173,39.39799959542146,39.41922073655956,38.61687046392973,38.58252615935333,39.02345139405935,39.027718840211605])

frontal = SimplePolygonalBasin('frontal', p0,'Frontal Area')
samotra = SimplePolygonalBasin('samotra', p1,'Samothraky Anticyclonic Area')
lemnos  = SimplePolygonalBasin('lemnos',  p2,'North of Lemnos Area')
lw      = SimplePolygonalBasin('lw',      p3,'LW Area')

P    = ComposedBasin('P',[frontal, samotra, lemnos, lw])

if __name__ == "__main__":

    import matplotlib.pyplot as pl
    fig,ax=pl.subplots()
    
    color=['b','r','g','c']
    for isub, sub in enumerate(P):
        ax.plot(sub.region.border_longitudes, sub.region.border_latitudes, color[isub], label=sub.extended_name)
    ax.legend()
    
    fig.show()
