/
Runway.java
109 lines (90 loc) · 2.22 KB
/
Runway.java
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
99
100
101
102
103
104
105
106
107
108
109
/**
* Conceptual class for a Runway - For the Airport Lighting Tool
*
* @author 2011SEGgp04 - Michael
* Creation: 21/02/11
*
* Modified: 03/03/11 - Zacharias
* Added getters and setters
*
* Modified: 04/03/11 - Zacharias
* Changed centerY to -centerY so that positive Y is according to cartesian coordinate system
*
* Modified: 25/03/11 - David
* Added Extension positioning
*
*/
public class Runway {
private int UID;
private double centerX;
private double centerY;
private double orientation;
private double length;
private double width;
private Extension bottomExtension = null;
private Extension topExtension = null;
public Runway(int UID, double centerX, double centerY, double orientation, double length, double width) {
this.UID = UID;
this.centerX = centerX;
this.centerY = -centerY;
this.orientation = orientation;
this.length = length;
this.width = width;
}
public void setTopExtension(Extension arg0) {
this.topExtension = arg0;
topExtension.setPosition(centerX, getY()+length);
if(topExtension.getWidth() == 0){
topExtension.setWidth(width);
}
}
public void setBottomExtension(Extension arg0) {
this.bottomExtension = arg0;
bottomExtension.setPosition(centerX, getY());
if(bottomExtension.getWidth() == 0){
bottomExtension.setWidth(width);
}
}
@Override
public String toString() {
String output = "Runway " + UID + " : ";
output += " centerX : " + centerX;
output += " centerY : " + centerY;
output += " X : " + getX();
output += " Y : " + getY();
output += " orientation : " + orientation;
output += " length : " + length;
output += " width : " + width;
return output;
}
public int getUID() {
return UID;
}
public double getX() {
return centerX - width/2;
}
public double getY() {
return centerY - length/2;
}
public double getCenterX() {
return centerX;
}
public double getCenterY() {
return centerY;
}
public double getOrientation() {
return orientation;
}
public double getLength() {
return length;
}
public double getWidth() {
return width;
}
public Extension getBottomExtension() {
return bottomExtension;
}
public Extension getTopExtension() {
return topExtension;
}
}