/////////////////////////////////////////////////////// ///////////////////////programming by ANGELO SANTUCCI////////////////////////////////////// /////////////////////////////////////////////////////// //import processing.opengl.*; import proxml.*; PImage b; PFont font; XMLElement datas; XMLInOut xmlInOut; int[] ox = {}; int[] oy = {}; int[] fx = {}; int[] fy = {}; String[] nomi = {}; String[] descriptions = {}; Trip[] trips = {}; Info[] poveragente= {}; int count = 1; float last,rad; int maxalpha = 40; //*****max alpha of line int maxlenght = 700;//****need this one to check the max alpha of lines -- small lenght less max alpha -- float interval = 100; //****delay of call boolean active = false; //****for checkmouse boolean displayInfo; boolean pressed = false; boolean firstTime = true; int items, current, casual; void setup(){ size(800, 700);//, OPENGL); background(0); colorMode(RGB,255); font = loadFont("TrebuchetMS-24.vlw"); textAlign(CENTER); b = loadImage("map.gif"); image(b, 0, 100); try{ xmlInOut = new XMLInOut(this); datas = xmlInOut.loadElementFrom("morti.xml"); items = datas.countChildren(); trips = new Trip[items]; //****initialize array of Trip poveragente = new Info[items]; initData(); } catch(InvalidDocumentException ide){ println("File does not exist"); } last=millis(); trips[0] = new Trip(count-1,ox[0],oy[0],fx[0],fy[0],450+random(150)); poveragente[0] = new Info(nomi[0]+descriptions[0]); } void initData(){ XMLElement data; for(int i=0; iinterval) { last=millis(); trips[count] = new Trip(count,ox[count],oy[count],fx[count],fy[count],450+random(150)); poveragente[count] = new Info(nomi[count]+descriptions[count]); count++; } //display a random info at random call casual = int(random(1000)); if(casual==3 && displayInfo == false){ current = count-2; displayInfo = true; } } //reset and start everything again if(count==items){ if(millis()-last>25000) { image(b, 0, 100); noStroke(); fill(0); rect(0, 0, 800, 100); count = 0; } } for(int i=0;i 0 && dy > 0){ if(x=x1-1.5 && y>=y1-1.5){ drawCross(); x=x1; y=y1; } x+=dx/t; y+=dy/t; _alpha+=max_alpha/t; return; } } if(dx > 0 && dy < 0){ if(xy1){ line(x, y, x+(dx/t), y+(dy/t)); if(x>=x1-1.5 && y<=y1+1.5){ drawCross(); x=x1; y=y1; } x+=dx/t; y+=dy/t; _alpha+=max_alpha/t; return; } } if(dx < 0 && dy > 0){ if(x>x1 && y=y1-1.5){ drawCross(); x=x1; y=y1; } x+=dx/t; y+=dy/t; _alpha+=max_alpha/t; return; } } if(dx < 0 && dy < 0){ if(x>x1 && y>y1){ line(x, y, x+(dx/t), y+(dy/t)); if(x<=x1+1.5 && y<=y1+1.5){ drawCross(); x=x1; y=y1; } x+=dx/t; y+=dy/t; _alpha+=max_alpha/t; return; } } } public void checkMouse(){ if(displayInfo == false){ if(x1-3