3 # Parse report and generate pbmtext commands for each country
4 # Now generates new positions as an average of all sectors.
7 if (scale=="") scale=1;
11 /^World size is [0-9]+ by [0-9]+./ {
14 system("ppmmake white " (width+1)*scale " " height*scale " | ppmtopgm | pgmtopbm >over.pbm");
17 /.*#.*name.*tech.*research.*education.*happiness.*cap-location/ {
21 name[$2]=substr($0,8,15);
39 if (dx>=width/2) dx -= width;
40 if (dy>=height/2) dy -= height;
41 if (dx<-width/2) dx += width;
42 if (dy<-height/2) dy += height;
43 cx[$2] += dx/(1+count[$2]);
44 cy[$2] += dy/(1+count[$2]);
56 system("pbmtext \"" name[i] "\" | pnmcrop >text.pbm");
57 system("pnmfile text.pbm >text.size");
58 getline < "text.size";
65 while (x<0) x += width;
66 while (y<0) y += height;
67 while (x>=width) x -= width;
68 while (y>=height) y -= height;
77 if (x+w>=width*scale) x=width*scale-w-1;
78 if (y+h>=height*scale) y=height*scale-h-1;
81 system("pnmpaste text.pbm " x " " y " over.pbm > over2.pbm");
82 system("cp over2.pbm over.pbm");