diff options
Diffstat (limited to 'vodaviz.pde')
| -rw-r--r-- | vodaviz.pde | 50 |
1 files changed, 37 insertions, 13 deletions
diff --git a/vodaviz.pde b/vodaviz.pde index 2b39363..d12db59 100644 --- a/vodaviz.pde +++ b/vodaviz.pde @@ -172,33 +172,46 @@ csvloader data; calldata calls; bitmapcountry Ireland; +bezierstroke bstroke; PImage lightmap; +color bg,fg; void setup(){ println("vodaviz v0.21"); RG.init(this); //mode="PDF"; - if (mode=="PDF") size(832,220,PDF, "vodaviz_test_080212.pdf"); //P3D); //832,220); //nb pdf is 800x600 + if (mode=="PDF") size(832,220,PDF, "vodaviz_test_140212.pdf"); //P3D); //832,220); //nb pdf is 800x600 else size(832,220); //,PDF, "testoutput.pdf"); //P3D); //832,220); //nb pdf is 800x600 + // C. 33 - M. 3 - Y. 0 - K. 0 + bg=color(164,215,244); + fg=color(255,255,255); + smooth(); float m = millis(); shp = RG.loadShape("countries_named_mercator.svg"); //test_drawing.svg"); //world_countries_outlines_split.svg"); - pnorm = new pointNormalise(18.279,746.302,129.314,374.293); + pnorm = new pointNormalise(18.279,746.302,109,374.293); ptrans = new pointTransform(); smap = new sphereMap(); - lightmap=loadImage("earthlights2_dmsp_big.jpg"); + lightmap=loadImage("earth_lights.gif"); + float startsize=0.2; + float endsize=0.1; + float linewidth=0.05; + float mpfract=0.5; + float raisefract=0.1; + float bezierfract=0.25; + bstroke = new bezierstroke(startsize,endsize,linewidth,mpfract,raisefract,bezierfract); RG.ignoreStyles(); println("loaded svg in "+((millis()-m)*.001)+" seconds"); Ireland=new bitmapcountry("Ireland",0,0,shp.children[0]); - Ireland.analyse(18.279,746.302,129.314,374.293); + Ireland.analyse(18.279,746.302,109,374.293); data=new csvloader("calls.csv"); calls=new calldata(data.data,shp); @@ -223,12 +236,22 @@ int i=0; int j=0; void draw() { - //if (i==0) image(lightmap,0,0,getWidth(),getHeight()); + noStroke(); + + + if (i==0) { + //image(lightmap,0,0,getWidth(),getHeight()); + fill(bg); + rect(0,0,width,height); + } + fill(fg); //pick a random colour - stroke(random(150)+10,random(150)+10,random(150)+10); + //stroke(random(150)+10,random(150)+10,random(150)+10); + //stroke(0,0,0,50); - if (true) //draw globe + + if (false) //draw globe { if (true) { //draw countries beginShape(); @@ -265,7 +288,7 @@ void draw() { } else //draw 2D { - if (true) { //draw countries + if (false) { //draw countries beginShape(); for (int k=0;k<calls.getcountry(i).outline.paths[0].commands.length;k++) { RPoint sp=calls.getcountry(i).outline.paths[0].commands[k].startPoint; @@ -277,19 +300,20 @@ void draw() { //println("drawing "+calls.getcountry(i).name+": "+calls.getcountry(i).outline.paths[0].commands.length+" points"); } if (true) { //draw lines - for (int j=0;j<log10(calls.countries.get(i).calls)*100;j++) { + for (int j=0;j<log10(calls.countries.get(i).calls)*1;j++) { RPoint s=calls.countries.get(i).getpoint(); RPoint e=Ireland.getpoint(); if (s.x>0&&e.x>0){ //point found RPoint Sp=screenMapper(pnorm.alise(s)); RPoint Ep=screenMapper(pnorm.alise(e)); RPoint Mp=plerp(Sp,Ep,0.75); - beginShape(); + //beginShape(); //line(Sp.x+(getWidth()/2),Sp.y+(getHeight()/2),Mp.x+(getWidth()/2),Mp.y+(getHeight()/2)); //line(Mp.x+(getWidth()/2),Mp.y+(getHeight()/2),Ep.x+(getWidth()/2),Ep.y+(getHeight()/2)); - bezier(Sp.x, Sp.y, Sp.x, Sp.y-((getHeight()-Sp.y)*.1), Ep.x, Ep.y-((getHeight()-Ep.y)*.1), Ep.x, Ep.y); - endShape(); - } + //bezier(Sp.x, Sp.y, Sp.x, Sp.y-((getHeight()-Sp.y)*.1), Ep.x, Ep.y-((getHeight()-Ep.y)*.1), Ep.x, Ep.y); + //endShape(); + bstroke.drawstroke(Sp,Ep); + } } //println("plotting "+calls.countries.get(i).name+": "+calls.countries.get(i).calls+" calls"); } |
