// Museum Talk visualization // by Petra Farinha - Nov/Dec 2007 ////////////////////////// GLOBAL VARIABLES ////////////////////////// // array that collets all the data from the txt file String [] texto; String [] data; // strings for artworks variables String nameV; String artistV; String imageNameV; // artworks array and position Artwork [] artwork; // array for Artwork class int x = 0; // circle - artwork position int y = 0; // circle - artwork position float divide; // timebased viz String [] time; // array for time txt String [] data2; int sensorV2; String filename1 = "visitor1"; String filename2 = "visitor2"; String filename3 = "visitor3"; String textmenu ="show other visitors"; boolean show = false; boolean hide= true; // turn on and off visualizations boolean showgraph = false; boolean showgraph2 = false; boolean showartworks = true; boolean exbh = false; boolean rollover = true; // show rollover text just on the emotions and exb mode // viz by exb String jeff = "Jeff Wall"; String martin = "Martin Puryear"; String comic = "Comic Abstraction"; boolean je = false; boolean mar = false; boolean com = false; color tags = color (0,200); // Moma Image + fonts PImage a; PFont b; PFont c; PFont e; int xmenu; // position for txtmenu int ymenu; // position for txtmenu ///////////////////// SETUP ///////////////////////////////////////////////// void setup(){ size(1000,800); // position for menu text xmenu = 50 ; ymenu = height - 60 ; // load moma logo a = loadImage("momalogo.jpg"); //font for menu b = loadFont("Unibody8-Italic-8.vlw"); // font for exb c = loadFont("Dolly-Italic-12.vlw"); // font for artwork name e = loadFont("Dolly-Roman-14.vlw"); // load txt into string texto = loadStrings("data_file2.txt"); // create n artworks according with text.lenght artwork = new Artwork[texto.length]; //create artwork objects for (int n = 0;n = xmenu + 81 && mouseY >= ymenu -9 && mouseY <= ymenu+3){ showartworks = true; for ( int l=0; l= xmenu + 150 && mouseY >= ymenu -9 && mouseY <= ymenu+3){ showartworks = true; exbh = true; sortSensor(); mar = false; com = false; je = false; } if (mouseX <= xmenu+280 && mouseX >= xmenu + 235 && mouseY >= ymenu -9 && mouseY <= ymenu+3){ for ( int l=0; l= width - 165 && mouseY >= 640 && mouseY <= 654){ if (showgraph) { showgraph2 = !showgraph2; } } if (mouseX <= xmenu + 219 && mouseX >= xmenu+150 && mouseY >= ymenu && mouseY <= ymenu+33){ println("martin"); mar = true; com = false; je = false; } if (mouseX <= xmenu + 340 && mouseX >=xmenu+253 && mouseY >= ymenu + 2 && mouseY <= ymenu+33){ println("comic"); com = true; je = false; mar = false ; } if (mouseX <= xmenu + 411 && mouseX >=xmenu+375 && mouseY >= ymenu +10 && mouseY <= ymenu+33){ println("jeff"); je = true; mar = false; com = false; } } ///////////////////// ARTWORKS CLASS ////////////////////////////////////////////////// class Artwork { // variables int sensor; String exb; String name; int time; PImage img; String imageName; float xpos =-100; //x position float ypos = -100; // y position float d; // diameter float limit = 2; // to the artworks don't stay near the limits of the screen int a = 255; // alpha boolean mouse; // for rollover // constructor Artwork (int sensor_, String exb_, String name_, int time_,String imageName_){ exb = exb_; sensor = sensor_; name = name_; time = time_; imageName = imageName_; img = loadImage(imageName); // size of the artwork d = sensor*1.40; } // functions void display(){ ellipseMode(CENTER); stroke(0); smooth(); colorMode(RGB,50); fill(255,0,0,a); ellipse(xpos,ypos,d,d); } // make rollover void showinfo(){ if (mouse){ if ( mousePressed){ image(img,xpos,ypos - 15); } point(xpos,ypos); fill(0); textFont(e,14); text(exb,xpos+5,ypos-10,150,70); textFont(c,12); text(name,xpos+5,ypos+5,150,70); } else{ fill(255,0,0,255); } } // mouseinteraction void rollover(int mx, int my){ if( dist(mx,my,xpos,ypos) < d/2) { mouse = true; } else { mouse = false; } } } ///////////////////// SORT FUNCTION ////////////////////////////////////////////////// // function to sort array according with sensor value void sortSensor(){ // show rollover rollover = true; // hide time showgraph = false; showgraph2 = false; int biggest = 0; // min. sensor int biggestIndex = 0; // min for(int i = 0; i < artwork.length; i++){ biggest = artwork[i].sensor; biggestIndex = i; for (int j = i+1; j < artwork.length;j++){ if( artwork[j].sensor > biggest){ biggest = artwork[j].sensor; biggestIndex = j; } } Artwork temp = artwork[i]; artwork[i] = artwork[biggestIndex]; artwork[biggestIndex] = temp; //println(artwork[i].sensor); } // display artworks ------- spiral float x= width/2 ; float y = height/2; float radius = 60; artwork[0].xpos = x+47; artwork[0].ypos = y-10; artwork[1].xpos = x; artwork[1].ypos = y-65; artwork[2].xpos = x; artwork[2].ypos = y+60; artwork[3].xpos = x -40; artwork[3].ypos = y; // from 4 to 9 radius = 100; for(int n = 3; n<8; n++){ float angle =30+PI/5*n; artwork[n+1].xpos = (x+25) + sin(angle) * radius; artwork[n+1].ypos = (y-30) + cos(angle) * radius; } // from 10 to 15 radius = 116; for(int n = 9; n<15; n++){ float angle =5.14+PI/6*n; artwork[n+1].xpos = (x+25) + sin(angle) * radius; artwork[n+1].ypos = (y-30) + cos(angle) * radius; radius+=8; } // from 16 to 22 radius = 138; for(int n = 15; n<22; n++){ float angle =6.2+PI/7*n; artwork[n+1].xpos = (x+25) + sin(angle) * radius; artwork[n+1].ypos = (y-5) + cos(angle) * radius; radius+=11; } // from 23 to 29 radius = 165; for(int n = 22; n<29; n++){ float angle =1.07+PI/8*n; artwork[n+1].xpos = (x+20) + sin(angle) * radius; artwork[n+1].ypos = (y-47) + cos(angle) * radius; radius+=11; } // from 30 to 36 radius = 180; for(int n = 29; n<36; n++){ float angle =-0.65+PI/7*n; artwork[n+1].xpos = (x+25) + sin(angle) * radius; artwork[n+1].ypos = (y+6) + cos(angle) * radius; radius+=12; } } ///////////////////// TIMEBASED VIS ////////////////////////////////////////////////// String getTimeValues(String name, color c_){ // variable for position int limit = 50; int baseh = 620; // variable for color color c = c_; // load txt String url = name +"." +"txt"; time = loadStrings(url); // get time and sensors values and works int counter = 0; for( int i = 0; i