-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtempPoint.pde
74 lines (65 loc) · 1.53 KB
/
tempPoint.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
class TempPoint {
final static int DEF = 0;
final static int PRI = 1;
final static int BTH = 2;
float lat;
float lon;
float temperature;
float airpressure;
float colP_HSB;
float colT_HSB;
float colP_RGB;
float colT_RGB;
int state = DEF;
TempPoint(float lon, float lat, float tmp, float prs) {
this.temperature = tmp;
this.lat = lat;
this.lon = lon;
this.airpressure = prs;
// Map colors with HSB
this.colT_HSB = map(tmp, -30, 40, 240, 0);
this.colP_HSB = map(prs, 970, 1030, 240, 0);
// Map colors with RGB
this.colT_RGB = map(tmp, -30, 40, 0, 255);
this.colP_RGB = map(prs, 970, 1030, 0, 255);
}
void show() {
if (showAll || this.state != DEF) {
pushMatrix();
rotateY(radians(this.lon));
rotateZ(radians(this.lat));
translate(-rad, 0);
int pointSize = 100;
switch(state) {
case DEF:
pointSize = 4;
noStroke();
break;
case PRI:
pointSize = 10;
noStroke();
break;
case BTH:
pointSize = 15;
stroke(255);
strokeWeight(4);
}
switch(drawMode) {
case TEMPERATURE:
colorMode(HSB);
fill(this.colT_HSB, 255, 255);
break;
case PRESSURE:
colorMode(HSB);
fill(this.colP_HSB, 255, 255);
break;
case BOTH:
colorMode(RGB);
fill(this.colT_RGB, this.colP_RGB, 128);
}
rotateY(radians(90));
ellipse(0, 0, pointSize, pointSize);
popMatrix();
}
}
}