summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgit@eclectronics.org <git@eclectronics.org@eclectronics.org>2012-02-14 14:55:47 +0000
committergit@eclectronics.org <git@eclectronics.org@eclectronics.org>2012-02-14 14:55:47 +0000
commit89020cfbbec0fe8d0e15aa326174cb5af3d03ce6 (patch)
tree32064ad7bad8be0b54e7a8b88d660e6266f947e0
parent4401d19c9d14b15bdd58743c99c9d1cc13a1ed8a (diff)
test white on blue
-rw-r--r--parsecalldata.pde21
-rw-r--r--vodaviz.pde50
2 files changed, 49 insertions, 22 deletions
diff --git a/parsecalldata.pde b/parsecalldata.pde
index 80361c0..38bcd1e 100644
--- a/parsecalldata.pde
+++ b/parsecalldata.pde
@@ -72,7 +72,7 @@ class bitmapcountry extends country {
super(n,c,m,shp);
}
void analyse(float _xo,float _xs,float _yo,float _ys) {
- int step=5; //speedup
+ int step=1; //speedup
xo=_xo;
xs=_xs;
yo=_yo;
@@ -120,13 +120,16 @@ class bitmapcountry extends country {
return new RPoint(px,py);
}
- RPoint getpoint(){
- float index=random(0.999);
- int i=0;
- while (points.get(i).index<index) {
- i++;
- }
- return new RPoint(points.get(i).pt.x+random(1),points.get(i).pt.y+random(1));
+ RPoint getpoint(){
+ if (points.size()>0) {
+ float index=random(0.999);
+ int i=0;
+ while (points.get(i).index<index&&i<points.size()) {
+ i++;
+ }
+ return new RPoint(points.get(i).pt.x+random(1),points.get(i).pt.y+random(1));
+ }
+ else return new RPoint(0,0);
}
}
@@ -164,7 +167,7 @@ class calldata {
for (int i=0; i < countries.size(); i++) {
//if (DEBUG) countries.get(i).printOut();
- countries.get(i).analyse(18.279,746.302,129.314,374.293);
+ countries.get(i).analyse(18.279,746.302,109,374.293); //129.314
}
}
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");
}