-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParkingLot.pde
97 lines (90 loc) · 2.59 KB
/
ParkingLot.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
class ParkingLot {
int Lotwidth;
int Lotlength;
int posX;
int posY;
//parking lot border dimensions
int topwidth;
int sidewidth;
int sectionspac;
int row;
int col;
ParkingStall stall;
ParkingStallSection section;
ParkingStallSection [][] sectionArr;
ParkingLot(int w, int l, int x, int y, int tw, int sw, int r, int c, int space, ParkingStall ps, ParkingStallSection s) {
Lotwidth=w;
Lotlength=l;
posX=x;
posY=y;
topwidth=tw;
sidewidth=sw;
row=r;
col=c;
sectionspac=space;
sectionArr = new ParkingStallSection [row][col];
for (int i = 0; i < r; i++) {
for (int j = 0; j < c; j++) {
sectionArr [i][j] = new ParkingStallSection (ps, s.row, s.col, ps.posX, ps.posY, s.width, s.length);
}
}
for (int j=0; j<row; j++) {
for (int i=0; i<col; i++) {
sectionArr[j][i].posY+=(sectionspac+sectionArr[j][i].width)*(j-1);
sectionArr[j][i].posX+=(sectionspac+sectionArr[j][i].length)*i;
}
}
}
void drawLot() {
smooth();
//border of lot
strokeWeight(4);
stroke(255);
fill(#41A046);
rect(posX, posY, Lotlength, Lotwidth);
fill(#A0A0A0);
rect(posX+sidewidth, posY+topwidth, Lotlength-sidewidth*2, Lotwidth-topwidth*2);
stroke(#A0A0A0);
strokeWeight(10);
rect(posX+Lotlength/2-25, posY+1, 50, topwidth);
rect(posX+Lotlength/2-25, posY+Lotwidth-topwidth-1, 50, topwidth);
fill(255);
line(posX+Lotlength/2-25, posY, posX+Lotlength/2-25, posY+topwidth);
line(posX+Lotlength/2+25, posY+Lotwidth-topwidth+1, posX+Lotlength/2, posY+Lotwidth);
for (int j=0; j<row; j++) {
for (int i=0; i<col; i++) {
sectionArr[j][i].drawStallSection();
}
}
//opening of the gate
strokeWeight(3);
line(posX+Lotlength/2-30, posY, posX+Lotlength/2-30, posY+topwidth);
line(posX+Lotlength/2+29, posY, posX+Lotlength/2+29, posY+topwidth);
line(posX+Lotlength/2+29, posY+Lotwidth-topwidth, posX+Lotlength/2+29, posY+Lotwidth);
line(posX+Lotlength/2-29, posY+Lotwidth-topwidth, posX+Lotlength/2-29, posY+Lotwidth);
stroke(255);
strokeWeight(4);
fill(#41A046);
rect(-20, -5, 1030, 122);
}
void drawDyn() {
noStroke();
fill(#A0A0A0);
rect(480, 150, 40, 600);
stroke(0);
fill(255);
rect(930, 190, 50, 30);
fill(0);
textSize(7);
text(" Limit \n 1px/frame lol", 935, 200);
stroke(255);
strokeWeight(4);
fill(#41A046);
rect(-20, -5, 1030, 122);
for (int j=0; j<row; j++) {
for (int i=0; i<col; i++) {
sectionArr[j][i].drawStallSection();
}
}
}
}