g.fillRect(getX(cTower.getLon()) - 3, getY(cTower.getLat()) - 3, 6, 6);
}
//Draw the Runways
while (iRunways.hasNext()) {
Runway cRunway = (Runway) iRunways.next();
float x1 = getXFloat(cRunway.getStartLon());
float y1 = getYFloat(cRunway.getStartLat());
float x2 = getXFloat(cRunway.getEndLon());
float y2 = getYFloat(cRunway.getEndLat());
float width = cRunway.getWidth(); // feet
if (allObjects.get("Runway: " + current.getName() + " - " + cRunway.getStartNum())) {
g.setColor(colors.get("DETAILED_AIRPORT_COLOR_RUNWAY").getColor());
if (width < BULLSHIT_FACTOR) {
float ref = DistanceCalculator.getDistance(minY, minX, minY, maxX);
ref = DistanceCalculator.milesToFeet(ref);
float fact = ref / width;
g.setStroke(new BasicStroke(width / fact));
g.drawLine((int) x1, (int) y1, (int) x2, (int) y2);
}
}
g.setStroke(new BasicStroke(1));
//Draw the ILSPath - Start ILS
double ILSTestLength = 9300.0; //feet
double ILSTestLengthShort = ILSTestLength - 300;
double offset = 0.03;
if (cRunway.hasStartILS()) {
if (allObjects.get("ILS: " + aName + " - " + cRunway.getStartNum())) {
float ref = DistanceCalculator.milesToFeet(DistanceCalculator.getDistance(minY, minX, minY, maxX));
double fact = ref / ILSTestLength;
double factShort = ref / ILSTestLengthShort;
double angle = Math.atan2(x2 - x1, y2 - y1);
angle = angle - Math.PI;
//Calculate the edge points
int leftOffsetX = (int) (x2 + Math.sin(angle - offset) * (ILSTestLength / fact));
int leftOffsetY = (int) (y2 + Math.cos(angle - offset) * (ILSTestLength / fact));
int middleX = (int) (x2 + Math.sin(angle) * ((ILSTestLengthShort) / factShort));
int middleY = (int) (y2 + Math.cos(angle) * ((ILSTestLengthShort) / factShort));
int rightOffsetX = (int) (x2 + Math.sin(angle + offset) * (ILSTestLength / fact));
int rightOffsetY = (int) (y2 + Math.cos(angle + offset) * (ILSTestLength / fact));
//Draw the actual ILS
g.setColor(colors.get("DETAILED_AIRPORT_COLOR_ILS").getColor());
g.drawLine((int) x1, (int) y1, leftOffsetX, leftOffsetY);
g.drawLine((int) x1, (int) y1, middleX, middleY);
g.drawLine((int) x1, (int) y1, rightOffsetX, rightOffsetY);
g.drawLine(leftOffsetX, leftOffsetY, middleX, middleY);
g.drawLine(rightOffsetX, rightOffsetY, middleX, middleY);
}
}
//Draw the ILSPath - End ILS
if (cRunway.hasEndILS()) {
if (allObjects.get("ILS: " + aName + " - " + cRunway.getEndNum())) {
float ref = DistanceCalculator.getDistance(minY, minX, minY, maxX);
ref = DistanceCalculator.milesToFeet(ref);
double fact = ref / ILSTestLength;
double factShort = ref / ILSTestLengthShort;
double angle = Math.atan2(x1 - x2, y1 - y2);
angle = angle - Math.PI;
//Calculate the edge points
int leftOffsetX = (int) (x1 + Math.sin(angle - offset) * (ILSTestLength / fact));
int leftOffsetY = (int) (y1 + Math.cos(angle - offset) * (ILSTestLength / fact));
int middleX = (int) (x1 + Math.sin(angle) * ((ILSTestLengthShort) / factShort));
int middleY = (int) (y1 + Math.cos(angle) * ((ILSTestLengthShort) / factShort));
int rightOffsetX = (int) (x1 + Math.sin(angle + offset) * (ILSTestLength / fact));
int rightOffsetY = (int) (y1 + Math.cos(angle + offset) * (ILSTestLength / fact));
//Draw the actual ILS
g.setColor(colors.get("DETAILED_AIRPORT_COLOR_ILS").getColor());
g.drawLine((int) x2, (int) y2, leftOffsetX, leftOffsetY);
g.drawLine((int) x2, (int) y2, middleX, middleY);
g.drawLine((int) x2, (int) y2, rightOffsetX, rightOffsetY);
g.drawLine(leftOffsetX, leftOffsetY, middleX, middleY);
g.drawLine(rightOffsetX, rightOffsetY, middleX, middleY);
}
}
//Draw the Runwayname
if (zoomLevel < 0.1) {
if ((Boolean) (allObjects.get("Runway: " + current.getName() + " - " + cRunway.getStartNum())).booleanValue()) {
Font f = g.getFont();
int xoffset = 0;
int yoffset = 0;
if (x1 < x2) {
xoffset = -15;
} else {
xoffset = 15;
}
if (y1 < y2) {
yoffset = -15;
} else {
yoffset = 15;
}
g.setColor(Color.green.darker().darker());
g.setFont(AIRPLANE_NAME_FONT);
g.drawString(cRunway.getStartNum(), x1 + xoffset, y1 + yoffset);
g.drawString(cRunway.getEndNum(), x2 - xoffset, y2 - yoffset);
g.setFont(f);
}
}
}
}