fullscreen void IntroPage1() {
imageMode(CORNER);
image(introImage1, 0, 0, width, height);
}
void IntroPage2(){
image(introImage2, 0, 0, width, height);
}
String[] data;
String[] dataLine;
String[] dataByDate;
String[] dataByDateLinePrev, dataByDateLine, dataByDateLineNext;
PFont font1, font1a, font2, font3;
color yellow = color(255, 204, 0);
boolean introPage1 = true;
boolean introPage2 = false;
PImage lear, introImage1, introImage2;
float page = 2;
void setup() {
size(1000, 750);
smooth();
font1 = loadFont("EurostileT-Medi-10.vlw");
font1a = loadFont("EurostileT-Medi-14.vlw");
font2 = loadFont("EurostileT-Medi-24.vlw");
font3 = loadFont("EurostileT-Medi-48.vlw");
data = loadStrings("Finding Guide_Final Format.txt");
dataByDate = loadStrings("Finding Guide_Final Format_ByDate.txt");
lear = loadImage("Edward Lear.png");
introImage1 = loadImage("introPage_1.jpg");
introImage2 = loadImage("introPage_2.jpg");
home = new HomeButton(width - 70, 40);
LoadSeries();
}
void draw() {
background(255);
if (introPage1) {
IntroPage1();
}
else if(introPage2){
IntroPage2();
}
else if (page == 2) {
SeriesChooser();
}
else if (page == 2.1) {
SeriesAnalysis();
checkCursor();
}
}
int[] seriesLengths = new int[73];
String[] seriesNames = new String[73];
float[] dimTotal = new float[73];
void LoadSeries() {
for (int i = 0; i < 73; i++) {
String[] seriesList = loadStrings("series_" + i + ".txt");
seriesLengths[i] = int(seriesList.length);
String[] seriesNameLine = split(seriesList[0], '\t');
seriesNames[i] = seriesNameLine[1];
dimTotal[i] = 0.0;
for (int j = 0; j < seriesList.length; j++) {
String[] seriesLine = split(seriesList[j], '\t');
float[] dimensionsAdd = float(trim(split(seriesLine[7], 'x')));
if (dimensionsAdd.length > 1) {
dimTotal[i] = dimensionsAdd[0] * dimensionsAdd[1] + dimTotal[i];
}
}
}
}
int keyLast;
int keyCount;
int buttonStatePrev1 = 1;
int seriesChosen;
HomeButton home;
void mouseClicked() {
if (introPage1) {
introPage1 = !introPage1;
introPage2 = !introPage2;
}
else if (introPage2) {
introPage2 = !introPage2;
}
else if (page == 2) {
seriesChosen = (mouseX - 18)/13;
seriesChosen = constrain(seriesChosen, 0, 72);
seriesLoaded = loadStrings("series_" + seriesChosen + ".txt");
page = 2.1;
}
else if (page == 2.1) {
if (home.mouseOver()) page = 2;
}
}
void checkCursor() {
boolean hand = false;
home.display();
hand = hand || home.mouseOver();
cursor(hand ? HAND : ARROW);
}
class HomeButton {
float xPos, yPos;
HomeButton(float x, float y) {
xPos = x;
yPos = y;
}
void display() {
stroke(0);
strokeWeight(2);
fill(mouseOver() ? 150 : 50);
rectMode(CORNER);
rect(xPos, yPos, 60, 25);
fill(mouseOver() ? 50 : 150);
textFont(font1a);
textAlign(CENTER, CENTER);
text("HOME", xPos + 30, yPos + 12);
}
boolean mouseOver() {
return mouseX > xPos && mouseX < xPos + 60 && mouseY > yPos && mouseY < yPos + 25;
}
void clicked() {
page = 2;
}
}
String[] seriesLoaded;
int[] randomXY = new int[120];
String imageName = "";
String imageNamePrevPrev = "x";
String imageNamePrev = "x";
String imageNamePrevNext = "x";
PImage existingDrawingPrev, existingDrawing, existingDrawingNext;
color circleFill, textFill;
void SeriesAnalysis() {
//SERIES TITLE
String[] seriesTitle = split(seriesLoaded[0], '\t');
fill(150);
textFont(font2);
textAlign(LEFT, TOP);
text(seriesTitle[1], 5, 5);
for (int i = 0; i < seriesLoaded.length; i++) {
String[] loadedLine = split(seriesLoaded[i], '\t');
int leftOffset = width/2 - (seriesLoaded.length/2)*13;
if (((mouseX > leftOffset + i*13 - 6) && (mouseX < leftOffset + i*13 + 6)) || ((mouseX <= leftOffset - 6) && (i == 0)) || ((mouseX >= leftOffset + (seriesLoaded.length-1)*13 + 6) && (i == seriesLoaded.length-1))) {
stroke(0);
fill(0);
textFont(font2);
//DATE
textAlign(RIGHT, TOP);
text(loadedLine[3] + " " + loadedLine[4] + " " + loadedLine[5], width - 5, 5);
//DIMENSIONS
noStroke();
fill(0);
float[] dimensions = float(trim(split(loadedLine[7], 'x')));
rectMode(CENTER);
rect(leftOffset + i*13, height/2, dimensions[1]*10, dimensions[0]*10);
//MEDIUM
textAlign(CENTER, BOTTOM);
textFont(font1);
text(loadedLine[6], leftOffset + i*13, height/2 - dimensions[0]*5);
//INSCRIPTIONS
textFont(font1a);
textAlign(RIGHT, CENTER);
String[] inscriptions = split(loadedLine[8], '\"');
for (int m = 1; m < inscriptions.length; m++) {
fill(yellow);
text(inscriptions[m], leftOffset + i*13 - dimensions[1]*5 - 2, height/2 - dimensions[0]*5 + m*8);
}
//NOTES
textAlign(LEFT, TOP);
if (loadedLine.length >= 11) {
String[] notes = trim(split(loadedLine[10], "\""));
for (int j = 2; j < notes.length; j++) {
if (notes[j] != null) {
text("Notes:", leftOffset + i*13 + dimensions[1]*5 + 2, height/2 - dimensions[0]*5);
fill(yellow);
text(notes[j], leftOffset + i*13 + dimensions[1]*5 + 2, height/2 - dimensions[0]*5 + j*5);
}
}
}
textFill = yellow;
circleFill = yellow;
textFont(font2);
}
else {
textFill = color(128);
circleFill = color(200);
textFont(font1);
if (loadedLine.length >= 11) {//If there are inscriptions or notes, mark circles black
if ((loadedLine[8].length() > 1) || (loadedLine[10].length() > 1)) circleFill = color(128);
if ((loadedLine.length >= 13) && (loadedLine[12].length() > 2)) circleFill = color(0);
}
}
noStroke();
fill(circleFill);
ellipse(leftOffset + i*13, height - 30, 10, 10);
//DRAWING TITLE
pushMatrix();
textAlign(RIGHT, CENTER);
fill(textFill);
rotate(HALF_PI);
text(loadedLine[2], height - 40, -leftOffset - i*13 - 3);
popMatrix();
}
//SERIES LEGEND
for (int i = 0; i < seriesLengths.length; i++) {
if (i == seriesChosen) {
stroke(yellow);
}
else {
stroke(150);
}
strokeWeight(3);
line(5, 40 + i*8, 5 + seriesLengths[i], 40 + i*8);
}
}
void SeriesChooser() {
//ELLIPSE LEGEND
for (int i = 1; i < 16; i++) {
noFill();
strokeWeight(.5);
stroke(200);
ellipse(width/2, height/2, (10000*i)/200, (10000*i)/200);
fill(128);
textAlign(CENTER, TOP);
textFont(font1);
text(i + "-m^2", width/2, height/2 - (10000*i)/400);
}
//SERIES BREAKDOWN
textAlign(LEFT, CENTER);
strokeWeight(5);
fill(0, 50);
stroke(0);
int dimSample = constrain((int(mouseX) - 25)/13, 0, dimTotal.length - 1);
ellipse(width/2, height/2, dimTotal[dimSample]/200, dimTotal[dimSample]/200);
for (int i = 0; i < seriesLengths.length; i++) {
if (((mouseX > 18 + i*13) && (mouseX < 32 + i*13)) || ((mouseX <= 18 ) && (i == 0)) || ((mouseX >= 32 + (seriesLengths.length-1)*13) && (i == seriesLengths.length-1))) {
stroke(0);
fill(yellow);
textFont(font2);
}
else {
stroke(150);
fill(128);
textFont(font1);
}
line(25 + i*13, height/2, 25 + i*13, height/2 - seriesLengths[i]);
pushMatrix();
rotate(HALF_PI);
text(seriesNames[i], height/2 + 10, -28 - i*13);
popMatrix();
}
//LEGEND
textFont(font2);
fill(200);
pushMatrix();
rotate(HALF_PI);
textAlign(LEFT, CENTER);
text("SERIES", height/2 + 13, -width + 10);
textAlign(RIGHT, CENTER);
text("QUANTITY", height/2, -width + 10);//"Drawings" "Items"
popMatrix();
}
Separating by location of production, this interactive graphic represents the total number and total area of drawings originating in each.