コード例 #1
0
ファイル: AirportModel.java プロジェクト: bily/fsxp
 public void addStationToParking(TaxiwayParkingModel model) {
   Rectangle2D square = ((java.awt.geom.Ellipse2D.Float) model.getParkingCircle()).getBounds2D();
   SceneryModel sceneryModel = new SceneryModel();
   sceneryModel.setShouldNotify(false);
   sceneryModel.setName("{0da416ee-c523-4d81-a562-9ce503f28468}");
   sceneryModel.setHeading(model.getHeading());
   java.awt.geom.Point2D.Float point =
       new java.awt.geom.Point2D.Float(
           (float) (square.getX() + square.getWidth() / 2D),
           (float) (square.getY() + square.getHeight() / 2D));
   java.awt.geom.Point2D.Float sceneryPoint =
       Utilities.rotatePoint(
           point,
           new java.awt.geom.Point2D.Float(
               (float) (square.getX() + square.getWidth() / 2D),
               (float) (square.getY() - 27.5D * (double) scale)),
           model.getHeading());
   sceneryModel.setLatLon(
       Utilities.getLatLonForPixel(
           model.getCenterPoint().getLat(),
           model.getCenterPoint().getLon(),
           sceneryPoint.getX(),
           sceneryPoint.getY(),
           scale));
   sceneryModel.setShouldNotify(true);
   addSceneryModel(sceneryModel);
 }
コード例 #2
0
ファイル: AirportModel.java プロジェクト: bily/fsxp
 public void addILSModelToRunway(ILSModel ilsModel, RunwayModel runwayModel, boolean primaryEnd) {
   ilsModel.setShouldNotify(false);
   int sizeLength = 0;
   if (runwayModel.getLengthMeasure().equals("M"))
     sizeLength = (int) ((runwayModel.getLength() * 3.28F + 2000F) * runwayModel.getScale());
   else sizeLength = (int) ((runwayModel.getLength() + 2000F) * runwayModel.getScale());
   java.awt.geom.Point2D.Float runwayCP =
       Utilities.getPixelsBetweenPoints(
           runwayModel.getCenterPoint().getLat(),
           runwayModel.getCenterPoint().getLon(),
           runwayModel.getLatLon().getLat(),
           runwayModel.getLatLon().getLon(),
           runwayModel.getScale());
   java.awt.geom.Point2D.Float ilsPoint =
       new java.awt.geom.Point2D.Float(
           (float) runwayCP.getX(),
           (float)
               (runwayCP.getY() - ((double) sizeLength / 2D) * (double) (primaryEnd ? 1 : -1)));
   ilsPoint = Utilities.rotatePoint(runwayCP, ilsPoint, runwayModel.getHeading());
   ilsModel.setLatLon(
       Utilities.getLatLonForPixel(
           runwayModel.getCenterPoint().getLat(),
           runwayModel.getCenterPoint().getLon(),
           ilsPoint.x,
           ilsPoint.y,
           runwayModel.getScale()));
   if (primaryEnd) ilsModel.setEnd("PRIMARY");
   else ilsModel.setEnd("SECONDARY");
   ilsModel.setAlt(runwayModel.getAlt());
   ilsModel.setAltMeasure(runwayModel.getAltMeasure());
   if (primaryEnd) {
     ilsModel.setHeading(runwayModel.getHeading());
   } else {
     float ilsHeading = runwayModel.getHeading() + 180F;
     if (ilsHeading >= 360F) ilsHeading -= 360F;
     ilsModel.setHeading(ilsHeading);
   }
   DMEModel dmeModel = new DMEModel();
   dmeModel.setShouldNotify(false);
   dmeModel.setLatLon((LatLonPoint) ilsModel.getLatLon().clone());
   dmeModel.setAlt(ilsModel.getAlt());
   dmeModel.setAltMeasure(ilsModel.getAltMeasure());
   dmeModel.setShouldNotify(true);
   ilsModel.setDMEModel(dmeModel);
   GlideSlopeModel glideSlopeModel = new GlideSlopeModel();
   glideSlopeModel.setShouldNotify(false);
   glideSlopeModel.setAlt(ilsModel.getAlt());
   glideSlopeModel.setAltMeasure(ilsModel.getAltMeasure());
   ilsModel.setGlideSlopeModel(glideSlopeModel);
   if (runwayModel.getLengthMeasure().equals("M"))
     sizeLength = (int) ((runwayModel.getLength() * 3.28F - 2000F) * runwayModel.getScale());
   else sizeLength = (int) ((runwayModel.getLength() - 2000F) * runwayModel.getScale());
   java.awt.geom.Point2D.Float glideSlopePoint =
       new java.awt.geom.Point2D.Float(
           (float) runwayCP.getX() - 350F * runwayModel.getScale() * (float) (primaryEnd ? 1 : -1),
           (float)
               (runwayCP.getY() - ((double) sizeLength / 2D) * (double) (primaryEnd ? -1 : 1)));
   glideSlopePoint = Utilities.rotatePoint(runwayCP, glideSlopePoint, runwayModel.getHeading());
   glideSlopeModel.setLatLon(
       Utilities.getLatLonForPixel(
           runwayModel.getCenterPoint().getLat(),
           runwayModel.getCenterPoint().getLon(),
           glideSlopePoint.x,
           glideSlopePoint.y,
           runwayModel.getScale()));
   glideSlopeModel.setShouldNotify(true);
   String runwayName = runwayModel.getNumber();
   if (runwayModel.getDesignator().length() > 0 && !runwayModel.getDesignator().equals("NONE"))
     runwayName =
         (new StringBuilder())
             .append(runwayName)
             .append(" ")
             .append(runwayModel.getDesignator())
             .toString();
   else if (runwayModel.getPrimaryDesignator().length() > 0
       && !runwayModel.getPrimaryDesignator().equals("NONE"))
     runwayName =
         (new StringBuilder())
             .append(runwayName)
             .append(" ")
             .append(runwayModel.getPrimaryDesignator())
             .toString();
   ilsModel.setRunway(runwayName);
   runwayModel.addILSModel(ilsModel);
   ilsModel.setShouldNotify(true);
 }