Package logic

Examples of logic.Airport$Runway


    private void drawAirportsUndetailed(final Graphics2D g) {
        g.setColor(colors.get("UNDETAILED_AIRPORT_COLOR").getColor());
        Iterator<IAirport> it = airports.values().iterator();
        while (it.hasNext()) {
            Airport cAirport = (Airport) it.next();
            if (allObjects.get("Airport: " + cAirport.getName())) {
                float upperLat = cAirport.getUpperLatBound();
                float lowerLon = cAirport.getLowerLonBound();
                g.drawString(cAirport.getID(), getX(lowerLon) - 2, getY(upperLat) - 4);
                g.fillRect(getX(lowerLon) - 2, getY(upperLat) - 2, 4, 4);
            }

        }
    }
View Full Code Here


    private void drawAirportsDetailed(final Graphics2D g) {
        Collection<IAirport> cAirports = airports.values();
        Iterator it = cAirports.iterator();
        while (it.hasNext()) {
            Airport current = (Airport) it.next();
            ITower cTower = current.getTower();
            Iterator<? extends IRunway> iRunways = current.getRunways();
            String aName = current.getName();

            //Draw the boundaries

            float upperLon = current.getUpperLonBound();
            float upperLat = current.getUpperLatBound();
            float lowerLon = current.getLowerLonBound();
            float lowerLat = current.getLowerLatBound();
            if (allObjects.get("Airport: " + aName)) {
                g.setColor(colors.get("DETAILED_AIRPORT_COLOR_BORDER").getColor());
                g.drawRect(getX(lowerLon) - 10, getY(upperLat) - 10, getX(upperLon) - getX(lowerLon) + 20, getY(lowerLat) - getY(upperLat) + 20);
                g.setColor(colors.get("DETAILED_AIRPORT_COLOR_NAME").getColor());
                g.drawString(current.getID() + " " + aName, getX(lowerLon) - 10, getY(upperLat) - 15);
            }


            //Draw the Tower
            if (cTower != null && allObjects.get("Tower: " + aName + " - " + cTower.getName())) {
                g.setColor(colors.get("DETAILED_AIRPORT_COLOR_TOWER").getColor());
                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;
View Full Code Here

            NavaidCoord nav = (NavaidCoord) it.next();
            allObjects.put("Navaid: " + nav.getName(), new Boolean(true));
        }
        it = airports.values().iterator();
        while (it.hasNext()) {
            Airport air = (Airport) it.next();
            allObjects.put("Airport: " + air.getName(), true);
            if (air.hasTower()) {
                allObjects.put("Tower: " + air.getName() + " - " + air.getTower().getName(), new Boolean(true));
            }
            Iterator rIt = air.getRunways();
            while (rIt.hasNext()) {
                Runway run = (Runway) rIt.next();
                allObjects.put("Runway: " + air.getName() + " - " + run.getStartNum(), new Boolean(true));
                if (run.hasStartILS()) {
                    allObjects.put("ILS: " + air.getName() + " - " + run.getStartNum(), true);
                }
                if (run.hasEndILS()) {
                    allObjects.put("ILS: " + air.getName() + " - " + run.getEndNum(), true);
                }
            }
        }
        showEntities = new ShowEntitiesDialog();
        repaint();
View Full Code Here

TOP

Related Classes of logic.Airport$Runway

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.