static String filename = "simple"; float bottom; float left; float vert; float horiz; Map allResults = new TreeMap(); String [] lines = null; HashMap colors; float pixelsPerTime; float finalTimeValue; //!!!Magic float pixelsPerHit; void setup(){ size(700,500,P3D); textFont(loadFont("NimbusSansL-Bold-16.vlw"), 16); bottom = height*4 / 5; left = width/7; vert = height*3/5; horiz = width*5/7; //lines = loadStrings("simple"); lines = loadStrings(filename); String lastline = lines[lines.length - 1]; //println(lastline); String parts[] = lastline.split("\t"); finalTimeValue = Float.parseFloat(parts[0]); for(int i = 0; i < lines.length;i++){ parts = lines[i].split("\t"); float timeval = Float.parseFloat(parts[0]); if(parts.length == 2) { String result = parts[1]; allResults.put(result,plusOne((Integer)allResults.get(result))); } } colors = new HashMap(); String thisName = null; assignColors(); pixelsPerTime = horiz / finalTimeValue; //!!!Magic pixelsPerHit = vert / 600; //println(timePerPixel); } Integer plusOne(Integer Int){ int i = 0; if(Int != null) { i = Int.intValue(); } i++; return new Integer(i); } void draw(){ background(66); float labelleft = 10; float labeltop = 20; fill(255); text("viewadscriptlog3d ... click to reassign colors",10,20); Iterator it = allResults.keySet().iterator() ; while(it.hasNext()){ String thisName = (String) it.next(); Integer thisIntColor = (Integer)colors.get(thisName); fill(thisIntColor.intValue()); String caption = thisName +":"+ allResults.get(thisName)+" "; labeltop += 20; text(caption,labelleft,labeltop); } pushMatrix(); translate(width,height,-100); rotateY((((width/2) - mouseX)*-100.0) / (100.0*(width))); rotateX((((width/2) - mouseY)*100.0) / (100.0*(width))); stroke(0); strokeWeight(1); lineStart(left,bottom-vert,0); lineTo(left,bottom); lineTo(left+horiz,bottom); float depth = 0; it = allResults.keySet().iterator() ; while(it.hasNext()){ String thisName = (String) it.next(); Integer thisIntColor = (Integer)colors.get(thisName); stroke(thisIntColor.intValue(),200); lineStart(left,bottom,depth); int hitCount = 0; for(int i = 0; i < lines.length; i++){ String[] parts = lines[i].split("\t"); float timeval = Float.parseFloat(parts[0]); if(parts.length == 2 && thisName.equals(parts[1])){ hitCount++; lineTo(left+(timeval*pixelsPerTime), bottom - (hitCount * pixelsPerHit)); } } lineTo(left+(finalTimeValue*pixelsPerTime), bottom - (hitCount * pixelsPerHit)); depth += 20; } popMatrix(); } float lastX,lastY; float lastDepth; void lineStart(float x, float y, float depth){ lastX = x; lastY = y; lastDepth = depth; } void lineTo(float x, float y){ float offsetX = width / 2; float offsetY = height /2; line(lastX-width,lastY-height,lastDepth, x-width,y-height,lastDepth); lastX = x; lastY = y; } void assignColors(){ Iterator it = allResults.keySet().iterator() ; while(it.hasNext()){ String thisName = (String) it.next(); Integer intColor = new Integer( color(random(128)+128,random(128)+128,random(128)+128) ); colors.put(thisName,intColor); } } void mouseClicked(){ assignColors(); } static public void main(String args[]) { if(args.length != 1){ println("NO FILENAME - LOADING TEST DATA"); } else { filename = "file://"+args[0]; } PApplet.main(new String[] { "viewadscriptlog3d" }); }