This commit is contained in:
abe- 2017-06-17 16:34:49 +02:00
parent acc9ff4e16
commit a260bcab63
55 changed files with 42 additions and 6773 deletions

View file

@ -2,6 +2,7 @@ var cuencas, cmap;
var ids,nombres,colores,x,y;
var capas,capaspg,imgs;
var dim, dimr;
var pg;
function preload() {
ids = new Array("norte","duero","ebro","pirineo","jucar","tajo","guadiana","guadalquivir","sur","segura","baleares");
@ -22,7 +23,12 @@ function preload() {
}
function setup() {
createCanvas(800,519);
pg = createGraphics(800, 519);
var as = 519. / 800.;
var w = document.querySelectorAll(".video-container").offsetWidth;
var h = windowWidth*as;
createCanvas(w,h);
nombres = new Array("Norte","Duero","Ebro","Pirineo","Jucar","Tajo","Guadiana","Guadalquivir","Sur", "Segura", "Baleares y Canarias");
colores = new Array("#f00","#0f0","#00f","#ff0","#0ff","#a00","#0a0","#00a","#aa0","#0aa", "#aaa");
x = new Array(158,243, 429, 597, 432, 268, 226, 253, 362,432, 611);
@ -31,12 +37,12 @@ function setup() {
function draw() {
background("#cad2d3");
pg.background("#cad2d3");
// capas
for (var n = 0; n < ids.length; n++) {
if (dimr[n] != -1) image(capas[n],0,0);
if (dimr[n] != -1) pg.image(capas[n],0,0);
else {
image(imgs[n],0,0);
pg.image(imgs[n], 0, 0);
}
}
@ -44,49 +50,54 @@ function draw() {
var mc = cmap.get(mouseX,mouseY);
for (var n = 0; n < colores.length; n++) {
if (compara(mc,color(colores[n]))) {
tint(255,100);
image(capaspg[n],0,0);
noTint();
pg.tint(255,100);
pg.image(capaspg[n],0, 0);
pg.noTint();
}
}
// nombres
textSize(14);
pg.textSize(14);
for (var n = 0; n < nombres.length; n++) {
//var nbr = String.prototype.toUpperCase(nombres[n]);
if (dimr[n] != -1 || !compara(mc,color(colores[n]))) fill(0);
else fill(0);
noStroke();
textStyle(BOLD);
pg.noStroke();
pg.textStyle(BOLD);
text(nombres[n], x[n], y[n]-10);
textStyle(NORMAL);
pg.text(nombres[n], x[n], y[n]-10);
pg.textStyle(NORMAL);
if (compara(mc,color(colores[n]))) {
text("Plan inicial: " + dim[n]+" Has", x[n], y[n]+5);
pg.text("Plan inicial: " + dim[n]+" Has", x[n], y[n]+5);
}
else {
noStroke();
if (dimr[n] != -1) text("Parcela media: " + dimr[n]+" Has", x[n], y[n]+5);
else text("(Sin datos)", x[n], y[n]+5);
pg.noStroke();
if (dimr[n] != -1) pg.text("Parcela media: " + dimr[n]+" Has", x[n], y[n]+5);
else pg.text("(Sin datos)", x[n], y[n]+5);
}
}
// Titulo
fill(255,200);
stroke(155);
rect(605, 365, 170, 130);
fill(0);
textStyle(BOLD);
textSize(12);
text("TAMAÑO MEDIO DE EXPLOTACIÓN ENTREGADA A COLONO", 620, 380, 150, 80);
textStyle(NORMAL);
textSize(11);
noStroke();
fill(155,0,0);
text("Interacción con el ratón:",620, 430, 150, 20);
fill(0);
text("Datos reales (verde) frente a datos según Plan de Colonización (blanco)", 620, 445, 150, 80);
pg.fill(255,200);
pg.stroke(155);
pg.rect(605, 365, 170, 130);
pg.fill(0);
pg.textStyle(BOLD);
pg.textSize(12);
pg.text("TAMAÑO MEDIO DE EXPLOTACIÓN ENTREGADA A COLONO", 620, 380, 150, 80);
pg.textStyle(NORMAL);
pg.textSize(11);
pg.noStroke();
pg.fill(155,0,0);
pg.text("Interacción con el ratón:",620, 430, 150, 20);
pg.fill(0);
pg.text("Datos reales (verde) frente a datos según Plan de Colonización (blanco)", 620, 445, 150, 80);
background("#cad2d3");
imageMode(CENTER);
var w = min(800,width*.85);
var h = w*519./800.;
image(pg,width/2, height/2,w,h);
}