/*** Main data structures ***/ Table2 locationTable; // Name and lab numbers of everyone Scientist[] weitzlab; // An array of "Scientists" String roomNames[]; // The "names" of the rooms, in numerical order boolean[][] fullMatrix; // Rows are rooms, columns are scientsts int pplRooms[]; // The number of people in a room /*** Highlighting variables ***/ boolean hiNames[]; // Whether to highlight a name boolean hiRooms[]; // Whether to highlight a room boolean boolRooms; // If true, highlight all the rooms for a given scientist boolean boolSci; // If true, highlight all the people and rooms in a group boolean boolBWG, boolMF, boolSC; // Whether the particular research group is active boolean boolPD, boolGrad, boolVisit, boolUG, boolOther; /*** Data intput/output ***/ PImage mapImage; // The map of the Wetiz labs String[] rows; // An array use for reading from the file int numScientists; // The total number of scientists int numRooms; // The toal number of rooms int hMax; // needed for determining mouse selections PFont plotFont; PFont plotFontMed; PFont plotFontBig; int radius = 36; float closestDist = MAX_FLOAT; void setup() { println("Loading room info..."); size(820, 540); mapImage = loadImage("WeitzMap2.jpg"); locationTable = new Table2("locations.tsv"); numRooms = locationTable.getRowCount(); roomNames = new String[numRooms]; rows = loadStrings("WeitzLocationData.csv"); numScientists = rows.length; hiRooms = new boolean[numRooms]; hiNames = new boolean[numScientists]; fullMatrix = new boolean[numRooms][numScientists]; pplRooms = new int[numRooms]; boolRooms = false; for (int i=0; i < numRooms; i++) { String rn = locationTable.getRowName(i); print(i + ". " + rn + ", "); roomNames[i] = rn; for (int j = 0; j < numScientists; j++) { fullMatrix[i][j] = false; } hiRooms[i] = false; pplRooms[i] = 0; } readInput(); } void readInput() { println(); println("Reading scientist info..."); weitzlab = new Scientist[numScientists]; String sciLastName; String sciFirstName; String sciCategory; String[] sciRooms; String[] sciGroups; for (int i=0; i 0) { hiRooms[ri] = true; } } for (int j=0; j 720) && (mouseY < hMax)) { boolRooms = true; int height = 540/numScientists; int hiNum = mouseY/height; hiNames[hiNum] = true; } // Otherwise, see which room is selected else { String currentRoom = "none"; int currentRoomIndex = -1; for (int j=0; j 0) { int xPos = locationTable.getInt(ri, 1); int yPos = locationTable.getInt(ri, 2); float d = dist(xPos, yPos, mouseX, mouseY); if ((d < radius) && (d < closestDist)) { closestDist = d; currentRoom = strRoom; currentRoomIndex = ri; hiRooms[j] = true; } } } if (currentRoomIndex > -1) { boolSci = true; for (int j = 0; j < numScientists; j++) { if (fullMatrix[currentRoomIndex][j]) { hiNames[j] = true; } } } else if (currentRoomIndex < 0) { boolSci = true; if ((mouseX > 520) && (mouseX < 700)) { if ((mouseY > 310) && (mouseY < 320)) { boolBWG = true; } else if ((mouseY > 330) && (mouseY < 350)) { boolMF = true; } else if ((mouseY > 350) && (mouseY < 370)) { boolSC = true; } else { boolBWG = false; boolMF = false; boolSC = false; } for (int j = 0; j < numScientists; j++) { if ((boolBWG) && (weitzlab[j].groups[0].equals("BWG"))) hiNames[j] = true; else if ((boolMF) && (weitzlab[j].groups[0].equals("MF"))) hiNames[j] = true; else if ((boolSC) && (weitzlab[j].groups[0].equals("SC"))) hiNames[j] = true; } if ((mouseY > 390) && (mouseY < 410)) { boolVisit = true; } else if ((mouseY > 410) && (mouseY < 430)) { boolPD = true; } else if ((mouseY > 430) && (mouseY < 450)) { boolGrad = true; } else if ((mouseY > 450) && (mouseY < 470)) { boolUG = true; } else if ((mouseY > 470) && (mouseY < 490)) { boolOther = true; } for (int j = 0; j < numScientists; j++) { if ((boolVisit) && (weitzlab[j].category.equals("visitor"))) hiNames[j] = true; else if ((boolPD) && (weitzlab[j].category.equals("post-doc"))) hiNames[j] = true; else if ((boolGrad) && (weitzlab[j].category.equals("grad student"))) hiNames[j] = true; else if ((boolUG) && (weitzlab[j].category.equals("undergraduate"))) hiNames[j] = true; else if (boolOther && !(weitzlab[j].category.equals("visitor") || (weitzlab[j].category.equals("post-doc")) || (weitzlab[j].category.equals("grad student")) || (weitzlab[j].category.equals("undergraduate")))) hiNames[j] = true; } } } } }