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); }
public void addTriggerToParking(TaxiwayParkingModel model) { Rectangle2D square = ((java.awt.geom.Ellipse2D.Float) model.getParkingCircle()).getBounds2D(); square.setFrame( square.getX() - (double) (20F * scale), square.getY() - (double) (20F * scale), square.getWidth() + (double) (40F * scale), square.getHeight() + (double) (40F * scale)); TriggerModel triggerModel = new TriggerModel(); triggerModel.setShouldNotify(false); triggerModel.setType73("YES"); triggerModel.setTypeJet("YES"); triggerModel.setShouldNotify(true); 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 vertexPoints[] = new java.awt.geom.Point2D.Float[4]; vertexPoints[0] = Utilities.rotatePoint( point, new java.awt.geom.Point2D.Float((float) square.getX(), (float) square.getY()), model.getHeading()); vertexPoints[1] = Utilities.rotatePoint( point, new java.awt.geom.Point2D.Float( (float) square.getX(), (float) (square.getY() + square.getHeight())), model.getHeading()); vertexPoints[2] = Utilities.rotatePoint( point, new java.awt.geom.Point2D.Float( (float) (square.getX() + square.getWidth()), (float) (square.getY() + square.getHeight())), model.getHeading()); vertexPoints[3] = Utilities.rotatePoint( point, new java.awt.geom.Point2D.Float( (float) (square.getX() + square.getWidth()), (float) square.getY()), model.getHeading()); for (int i = 0; i < 4; i++) { VertexModel vertexModel = new VertexModel(); vertexModel.setShouldNotify(false); vertexModel.setLatLon( Utilities.getLatLonForPixel( model.getCenterPoint().getLat(), model.getCenterPoint().getLon(), vertexPoints[i].getX(), vertexPoints[i].getY(), scale)); vertexModel.setShouldNotify(true); triggerModel.addVertexModel(vertexModel); } addTriggerModel(triggerModel); }
@Override public Rectangle2D.Double getDrawingArea() { if (cachedDrawingArea == null) { Rectangle2D rx = getBounds(); Rectangle2D.Double r = (rx instanceof Rectangle2D.Double) ? (Rectangle2D.Double) rx : new Rectangle2D.Double(rx.getX(), rx.getY(), rx.getWidth(), rx.getHeight()); double g = SVGAttributeKeys.getPerpendicularHitGrowth(this); Geom.grow(r, g, g); if (TRANSFORM.get(this) == null) { cachedDrawingArea = r; } else { cachedDrawingArea = new Rectangle2D.Double(); cachedDrawingArea.setRect(TRANSFORM.get(this).createTransformedShape(r).getBounds2D()); } } return (Rectangle2D.Double) cachedDrawingArea.clone(); }
/** Gets the drawing area without taking the decorator into account. */ @Override protected Rectangle2D.Double getFigureDrawingArea() { if (getText() == null) { return getBounds(); } else { TextLayout layout = getTextLayout(); Rectangle2D.Double r = new Rectangle2D.Double(origin.x, origin.y, layout.getAdvance(), layout.getAscent()); Rectangle2D lBounds = layout.getBounds(); if (!lBounds.isEmpty() && !Double.isNaN(lBounds.getX())) { r.add( new Rectangle2D.Double( lBounds.getX() + origin.x, (lBounds.getY() + origin.y + layout.getAscent()), lBounds.getWidth(), lBounds.getHeight())); } // grow by two pixels to take antialiasing into account Geom.grow(r, 2d, 2d); return r; } }