nnode[] points;
import processing.pdf.*;
String[] file_input;
float x, y, rad;
PFont font;
PGraphics pdf;
String file = "03-04";
void setup(){
size(1500,1500);
/*make_pdf("01-16");
make_pdf("01-17");
make_pdf("01-18");
make_pdf("01-19");
make_pdf("01-20");
make_pdf("01-21");
make_pdf("01-22");
make_pdf("02-02");
make_pdf("02-03");
make_pdf("02-04");
make_pdf("02-05");
make_pdf("02-06");
make_pdf("02-07");
make_pdf("02-08");
make_pdf("02-09");
make_pdf("02-10");
make_pdf("02-11");
make_pdf("02-12");
make_pdf("02-13");
make_pdf("02-14");
make_pdf("02-15");
make_pdf("02-16");
make_pdf("02-17");
make_pdf("02-18");
make_pdf("02-19");
make_pdf("02-20");
make_pdf("02-21");
make_pdf("02-22");
make_pdf("02-23");
make_pdf("02-24");
make_pdf("02-25");
make_pdf("02-26");
make_pdf("02-27");
make_pdf("02-28");
make_pdf("03-01");
make_pdf("03-02");
make_pdf("03-03");
make_pdf("03-04");
make_pdf("03-05");
make_pdf("03-06"); */
make_pdf(file);
image(pdf,0,0,1500,1500);
}
void draw(){
}
void keyPressed(){
if(key == 's'){
pdf.save(file + Integer.toString(day()) + Integer.toString(hour()) + Integer.toString(minute()) + ".png");
println("saved");
}
}
void make_pdf(String file){
println(file);
file_input = loadStrings(file + ".csv");
pdf = createGraphics(6000, 6000, JAVA2D);
points = new node[file_input.length];
for(int i = 0; i < file_input.length; i++){
String[] pieces = split(file_input[i], "\";\"");
pieces[0] = pieces[0].substring(1,pieces[0].length());
pieces[4] = pieces[4].substring(0,pieces[4].length() - 1);
points[i] = new node(parseInt(pieces[0]), pieces[1], parseInt(pieces[2]),
parseInt(pieces[3]), parseFloat(pieces[4]), parseFloat(pieces[5]));
}
pdf.beginDraw();
//size(800,600);
pdf.smooth();
pdf.colorMode(HSB,100);
//background(0);
font = loadFont("HelveticaNeue-Light-12.vlw");
pdf.textFont(font,12);
pdf.background(100,0,100);
x = pdf.width/2;
y = pdf.height/2;
for(int i = 0; i < points.length; i++){
float x2 = cos(points[i].light) * float(points[i].light)/50.0 + x;
float y2 = sin(points[i].light) * float(points[i].light)/50.0 + y;
pdf.stroke(points[i].db * 100, 100,100);
//pdf.strokeWeight(points[i].temperature/20);
pdf.line(x,y,x2,y2);
x = x2;
y = y2;
}
pdf.dispose();
pdf.endDraw();
//pdf.save(file + Integer.toString(day()) + Integer.toString(hour()) + Integer.toString(minute()) + ".png");
}
class node{
int index;
String time;
int light;
int proximity;
float db;
float temperature;
node(int i, String t, int l, int p, float d, float tp){
index = i;
time = t;
light = l;
proximity = p;
db = d;
temperature = tp;
}
}