|
#!/usr/bin/env python
|
|
from gimpfu import *
|
|
from numpy import r_
|
|
#0 St. Gallen
|
|
#1 Rorschach
|
|
#2 Rheintal
|
|
#3 Werdenberg
|
|
#4 Sargans
|
|
#5 See-Gaster
|
|
#6 Toggenburg
|
|
#7 Wil
|
|
#8 AR
|
|
#9 AI1
|
|
#10 AI2
|
|
#11 AI3
|
|
def Statistik_Relativ():
|
|
#positions of the regions
|
|
x=[870,1053,1212,1060,910,500,555,600,765,1014,1203,1266]
|
|
y=[340,225,453,900,1236,837,681,324,609,537,372,324]
|
|
Piraten=[55,11,12,12,2,12,8,10,14,2]#Jeweils neu einzugeben.
|
|
rel_Piraten=[]
|
|
Einwohner=[117007,40840,66522,35241,37255,62115,44875,70821,52561,15688]
|
|
for i in r_[0:10]:#Berechnung der rel. Piraten
|
|
rel_Piraten+=[1.0*Piraten[i]/Einwohner[i]]
|
|
dr=gimp-image-get-active-drawable
|
|
rel_Piraten+=[rel_Piraten[-1]]#Die beiden Werte sind da, da AI noch 2 Exklaven hat
|
|
rel_Piraten+=[rel_Piraten[-1]]
|
|
|
|
FarbeSG=(0,255,0)#Hier werden die Grundfarben definiert
|
|
FarbeAR=(0,0,255)
|
|
FarbeAI=(255,0,0)
|
|
|
|
FarbIndex=[0,0,0,0,0,0,0,0,1,2,2,2]#Indezes fuer Farbkodierung
|
|
Farbe=[FarbeSG,FarbeAR,FarbeAI]#Ansteuerungstupel fuer Schleife
|
|
|
|
for i in r_[0:12]:
|
|
if rel_Piraten <= 1:
|
|
opa = 30
|
|
elif rel_Piraten <=2:
|
|
opa = 50
|
|
elif rel_Piraten <=2:
|
|
opa = 70
|
|
elif rel_Piraten <=2:
|
|
opa = 85
|
|
else:
|
|
opa = 100
|
|
fill(x[i],y[i],Farbe[FarbIndex[i]],opa,dr)
|
|
|
|
def fill(x,y,col,opa,dr):
|
|
gimp-context-set-foreground
|
|
gimp-edit-bucket-fill(dr,0,NORMAL_MODE,0,0,False,False,0,x,y)
|
|
|
|
register(
|
|
"Skript_Relativ",
|
|
"Errechne Relative Statistik",
|
|
"errechnet die graphische Darstellung der Piratenverteilung der Sektion SGARAI",
|
|
"Dominik",
|
|
"Schildknecht",
|
|
"2012",
|
|
"...",
|
|
"*",
|
|
[
|
|
(PF_INT, "howmuch", "How much stuff?", 50)
|
|
],
|
|
[],
|
|
Skript_Relativ, menu="<Filter>/Python-Fu/")
|
|
|
|
main()
|