-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCircleData.pde
More file actions
72 lines (61 loc) · 1.48 KB
/
Copy pathCircleData.pde
File metadata and controls
72 lines (61 loc) · 1.48 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
import java.awt.geom.Ellipse2D;
public class CircleData implements Comparable<CircleData>{
Ellipse2D circleBound;
float dataValue;
State st;
int dataType;
color col;
int diameter;
int value;
boolean brushing;
public CircleData(State st, int diameter, int dataType, int value, color col) {
this.dataValue = (float)(st.getStateData().getDataArray()[dataType]);
this.dataType = dataType;
this.st =st;
this.col = col;
this.diameter = diameter;
this.value = value;
this.circleBound = new Ellipse2D.Float(st.getCenterX()-diameter/2, st.getCenterY()-diameter/2, diameter, diameter);
brushing = false;
}
int getDataType(){
return dataType;
}
void setBrushing(boolean tf){
brushing = tf;
}
int getValue(){
return value;
}
void draw() {
if(brushing){
stroke(100);
fill(col);
}
else{
stroke(col);
fill(col,30);
}
strokeWeight(2);
ellipse(st.getCenterX(), st.getCenterY(), diameter, diameter);
st.drawName();
}
State getState(){
return st;
}
boolean contains(){
return circleBound.contains(mouseX,mouseY);
}
public int compareTo(CircleData other)
{
return other.diameter-this.diameter;//populationDensity.comparetTo(other.populationDensity);
}
}
/*
public class CircleComparator implements Comparator<CireData> {
@Override
public int compare(CircleData c1, CircleData c2) {
return c2.diameter - c1.diameter;
}
}
*/