SetOfBoroughs soB; public class SetOfBoroughs { String[] boroughNames = new String[33]; Borough[] boroughs; PShape parent; SetOfBoroughs(){ boroughNames[0] = "City of London"; boroughNames[1] = "City of Westminster"; boroughNames[2] = "Kensington and Chelsea"; boroughNames[3] = "Hammersmith and Fulham"; boroughNames[4] = "Wandsworth"; boroughNames[5] = "Lambeth"; boroughNames[6] = "Southwark"; boroughNames[7] = "Tower Hamlets"; boroughNames[8] = "Hackney"; boroughNames[9] = "Islington"; boroughNames[10] = "Camden"; boroughNames[11] = "Brent"; boroughNames[12] = "Ealing"; boroughNames[13] = "Hounslow"; boroughNames[14] = "Kingston upon Thames"; boroughNames[15] = "Merton"; boroughNames[16] = "Sutton"; boroughNames[17] = "Croydon"; boroughNames[18] = "Bromley"; boroughNames[19] = "Lewisham"; boroughNames[20] = "Greenwich"; boroughNames[21] = "Bexley"; boroughNames[22] = "Havering"; boroughNames[23] = "Barking and Dagenham"; boroughNames[24] = "Redbridge"; boroughNames[25] = "Newham"; boroughNames[26] = "Waltham Forest"; boroughNames[27] = "Haringey"; boroughNames[28] = "Enfield"; boroughNames[29] = "Barnet"; boroughNames[30] = "Harrow"; boroughNames[31] = "Hillingdon"; boroughNames[32] = "Richmond upon Thames"; boroughs = new Borough[33]; //locations[0] = new PVector(300,300); parent = loadShape("All_Boroughs.svg"); for (int i = 0; i < 33; i++) { boroughs[i] = new Borough(boroughNames[i], parent); } } void drawBoroughs(){ for (int i = 0; i < 33; i++) { //boroughs[i].updateColor(BOROUGH SCORE); 101 - 3305 boroughs[i].drawBorough(); } } } public class Borough { String name; PShape shape; color colour; //PVector v; float scale; Borough(String aName, PShape parentShape){ name = aName; shape = parentShape.getChild(aName); colour = color(255,255,255); scale = 1.0; shape.disableStyle(); //v = location; } Integer normalizeScore(Integer score){ if (score < 0) { score = 0; } else if (score > 255) { score = 255; } return score; } Integer scoreToColor(Integer score){ // score is from 101 to 3305 or something. // level of colour = 20; float levelOfColor = 20; float pLA = (3305 - 101)/levelOfColor; float pLB = (255 - 0)/levelOfColor; float ret = (score/pLA)*(pLB); Integer put = (int)Math.floor(ret); Integer retInt = normalizeScore(put); return retInt; } void updateColor(Integer score){ colour = color(0,scoreToColor(score),0); } void drawBorough(){ shapeMode(CORNER); fill(colour); shape(shape, 0, 0, displayWidth, displayHeight+200); System.out.println(shape.getVertexCount()); // } } void setup(){ soB = new SetOfBoroughs(); orientation(LANDSCAPE); size(displayWidth, displayHeight); background(51); } void draw(){ soB.drawBoroughs(); }