-
Notifications
You must be signed in to change notification settings - Fork 1
/
functions.pde
44 lines (36 loc) · 1017 Bytes
/
functions.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
public int degreesToXPixels(float degrees) {
//return (int) abs( (xDegree + degrees) * 12373.4531);
return (int) abs( (degrees - xDegree) * 12373.4531 );
}
public int degreesToYPixels(float degrees) {
//return (int) abs( (degrees - yDegree) * 13110.6870 );
return (int) abs ((yDegree - degrees) * 13110.6870);
}
int readViajeCSV() {
table = loadTable("lastday.csv", "header");
return table.getRowCount();
}
void readEstacionesCSV() {
estacionesTable = loadTable("ecobiciestaciones.csv", "header");
}
void drawEstaciones() {
int total = estacionesTable.getRowCount();
for (TableRow row : estacionesTable.rows()) {
fill(#ffffff);
stroke(#ffffff);
smooth();
ellipse( degreesToXPixels(row.getFloat("longitude") ), degreesToYPixels( row.getFloat("latitude")), 1, 1);
}
}
String buildDate(int h, int m) {
String hora, minuto;
if ( h < 10)
hora = "0"+h;
else
hora = ""+h;
if (m < 10)
minuto = "0"+m;
else
minuto = ""+m;
return hora+":"+minuto;
}