Examples of Airport


Examples of logic.Airport

    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

Examples of logic.Airport

            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

Examples of se.plushogskolan.jetbroker.plane.domain.Airport

    DateTime now = new DateTime();
    DateTime dateMinus1 = now.minusHours(1);
    DateTime dateMinus2 = now.minusHours(2);

    Airport airport = TestFixture.getValidAirport();
    airport.setId(0);
    airport.setLastUpdated(now);
    long id1 = repo.persist(airport);

    Airport airport2 = TestFixture.getValidAirport();
    airport2.setId(0);
    airport2.setLastUpdated(dateMinus2);
    repo.persist(airport2);

    assertEquals("All airports", 2, repo.getAllAirports().size());

    int noOfDeletes = repo.deleteAirportsOlderThan(dateMinus1);
View Full Code Here

Examples of se.plushogskolan.jetbroker.plane.domain.Airport

  @Test(expected = Exception.class)
  public void testValidation() {

    // Create airport with empty code. ID must be 0 for integrations tests
    // using JPA.
    Airport airport = TestFixture.getValidAirport(0, "", "Gothenburg");
    repo.persist(airport);
  }
View Full Code Here

Examples of se.plushogskolan.jetbroker.plane.domain.Airport

public class TestFixture {

  private static Logger log = Logger.getLogger(TestFixture.class.getName());

  public static Airport getValidAirport(long id, String code, String name) {
    Airport airport = new Airport();
    airport.setId(id);
    airport.setCode(code);
    airport.setName(name);
    airport.setLatitude(10);
    airport.setLongitude(20);
    return airport;
  }
View Full Code Here

Examples of se.plushogskolan.jetbroker.plane.domain.Airport

public class TestFixture {

  private static Logger log = Logger.getLogger(TestFixture.class.getName());

  public static Airport getValidAirport(long id, String code, String name) {
    Airport airport = new Airport();
    airport.setId(id);
    airport.setCode(code);
    airport.setName(name);
    airport.setLatitude(10);
    airport.setLongitude(20);
    return airport;
  }
View Full Code Here

Examples of se.plushogskolan.jetbroker.plane.domain.Airport

    log.fine("Edit airport, id=" + id);

    EditAirportBean bean = new EditAirportBean();

    if (id > 0) {
      Airport airport = getAirportService().getAirport(id);
      bean.copyAirportValuesToBean(airport);
    }

    ModelAndView mav = new ModelAndView("editAirport");
    mav.addObject("editAirportBean", bean);
View Full Code Here

Examples of se.plushogskolan.jetbroker.plane.domain.Airport

      mav.addObject("editAirportBean", bean);
      return mav;
    }

    if (bean.getId() > 0) {
      Airport airport = getAirportService().getAirport(bean.getId());
      bean.copyBeanValuesToAirport(airport);
      getAirportService().updateAirport(airport);
    } else {
      Airport airport = new Airport();
      bean.copyBeanValuesToAirport(airport);
      getAirportService().createAirport(airport);
    }

    return new ModelAndView("redirect:/index.html");
View Full Code Here

Examples of se.plushogskolan.jetbroker.plane.domain.Airport

    DateTime now = new DateTime();
    DateTime dateMinus1 = now.minusHours(1);
    DateTime dateMinus2 = now.minusHours(2);

    Airport airport = TestFixture.getValidAirport(0);
    airport.setLastUpdated(now);
    long id1 = repo.persist(airport);

    Airport airport2 = TestFixture.getValidAirport(0);
    airport2.setLastUpdated(dateMinus2);
    repo.persist(airport2);

    assertEquals("All airports", 2, repo.getAllAirports().size());

    int noOfDeletes = repo.deleteAirportsOlderThan(dateMinus1);
View Full Code Here

Examples of se.plushogskolan.jetbroker.plane.domain.Airport

  @Test(expected = Exception.class)
  public void testValidation() {

    // Create airport with empty code. ID must be 0 for integrations tests
    // using JPA.
    Airport airport = TestFixture.getValidAirport(0, "", "Gothenburg");
    repo.persist(airport);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.