-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStateWindow.pde
More file actions
87 lines (70 loc) · 1.53 KB
/
Copy pathStateWindow.pde
File metadata and controls
87 lines (70 loc) · 1.53 KB
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
75
76
77
78
79
80
81
82
83
84
85
public class StateWindow{
//make bar graph for now.
private int x;
private int y;
private int width;
private int height;
private State state;
private PieChart pie;
int pieSize ;
int pieY;
int pieX;
private StateWindow(int x, int y){
this.x = x;
this.y = y;
width = 300;
height = 500;
defaultText();
pieSize = 300;
pieX=x+10;
pieY = y+100;
pie = new PieChart(pieX, pieY, pieSize, pieSize);
}
public void defaultText(){
textFont(font14,14);
String s = "Click on a state to see more detail.";
fill(22);
text(s, x, y, x+this.width, y+this.height); // Text wraps within text box
}
public void mouseMoved(){
if(draw.within(pieX,pieY,pieX+pieSize,pieY+pieSize)){
rect(pieX,pieY,pieSize,pieSize);
pie.mouseMoved();
draw.brushMap(state);
}
else{
pieReset();
}
}
public void setState(State state){
if (!state.equals(this.state)){
this.state = state;
pie.setState(state);
draw.draw();
}
}
public void writeName(){
fill(0);
textFont(font36, 36);
textAlign(CENTER);
text(state.getName(), x+this.width/2, y+60);
}
public void drawWindow(){
if (state!=null){
writeName();
pie.drawPie();
//draw bargraph
}
else{
defaultText();
}
}
public void windowCheck(State myState, int dataType){
if(state!=null && state.equals(myState)){
pie.pieHighlight(dataType);
}
}
public void pieReset(){
pie.pieReset();
}
}//end class