-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gate.pde
98 lines (85 loc) · 1.94 KB
/
Gate.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
class Gate {
int posX;
int posY;
int Gatelength;
int Gatewidth;
boolean open;
String title;
Gate (int x, int y, int l, int w, String s) {
posX=x;
posY=y;
Gatelength=l;
Gatewidth=w;
open=true;
title=s;
}
Gate (Gate X) {
posX=X.posX;
posY=X.posY;
Gatelength=X.Gatelength;
Gatewidth=X.Gatewidth;
open=X.open;
title=X.title;
}
void drawGate () {
for (int j = 0; j < lot.row; j++) {
for (int i = 0; i< lot.col; i++) {
for (int k = 0; k < lot.sectionArr[j][i].row; k++) {
for (int n = 0; n < lot.sectionArr[j][i].col; n++) {
if (lot.sectionArr[j][i].ps[k][n].occupied == true)
open=false;
}
}
}
open=true;
}
if (open)
openGate();
else
closeGate();
strokeWeight(2);
rect(posX-105, posY-20, 100, 20);
stroke(0);
fill(255);
rect(posX-105, posY, 100, 20);
fill(0);
textSize(14);
text(title, posX-89, posY-4);
text(("Spaces: "+numberOccupied()), 385, 235);
text("Fee: $"+fee+"0", 385, 695);
}
void openGate() {
strokeWeight(7);
stroke(#A0A0A0);
stroke(#CB2121);
line(posX+2, posY, posX+0.75*Gatelength, posY-Gatewidth);
strokeWeight(0.5);
stroke(0);
fill(#00FFF0);
ellipse(posX+2, posY, 7, 7);
}
void closeGate() {
strokeWeight(7);
stroke(#A0A0A0);
stroke(#CB2121);
line(posX+2, posY, posX+Gatelength-2, posY);
strokeWeight(0.5);
stroke(0);
fill(#00FFF0);
ellipse(posX+2, posY, 7, 7);
}
int numberOccupied() {
int counter=0;
for (int j = 0; j < lot.row; j++) {
for (int i = 0; i< lot.col; i++) {
for (int k = 0; k < lot.sectionArr[j][i].row; k++) {
for (int n = 0; n < lot.sectionArr[j][i].col; n++) {
if (lot.sectionArr[j][i].ps[k][n].occupied == false)
counter++;
}
}
}
}
return counter;
}
}