List of usage examples for java.awt.geom RectangularShape getWidth
public abstract double getWidth();
From source file:org.jcurl.demo.tactics.old.MenuView.java
private void zoom(final Point2D center, final double ratio, final int dt) { if (getModel() == null) return;/*from w w w .j a v a2s . c o m*/ final RectangularShape src = getModel().getZoom(); if (log.isDebugEnabled()) log.debug(src); final double w = src.getWidth() * ratio; final double h = src.getHeight() * ratio; final double cx, cy; if (center == null) { cx = src.getCenterX(); cy = src.getCenterY(); } else { cx = center.getX(); cy = center.getY(); } zoom(new Rectangle2D.Double(cx - w / 2, cy - h / 2, Math.abs(w), Math.abs(h)), dt); }
From source file:tufts.vue.LWComponent.java
/** @return our shape, full transformed into map coords and ultimate scale when drawn at 100% map zoom * this is used for portal clipping, and will be imperfect for some scaled shapes, such as RountRect's * This only works for raw shapes that are RectangularShapes -- other Shape types just return the bounding * box in map coordinates (e.g., a link shape) *///from w w w .ja va 2 s .c o m public RectangularShape getMapShape() { // Will not work for shapes like RoundRect when scaled -- e..g, corner scaling will be off final Shape s = getZeroShape(); // if (getMapScale() != 1f && s instanceof RectangularShape) { // todo: do if any transform, not just scale if (s instanceof RectangularShape) { // todo: cache this: only need to updaate if location, size or scale changes // (Also, on the scale or location change of any parent!) RectangularShape rshape = (RectangularShape) s; rshape = (RectangularShape) rshape.clone(); AffineTransform a = getZeroTransform(); Point2D.Float loc = new Point2D.Float(); a.transform(loc, loc); rshape.setFrame(loc.x, loc.y, rshape.getWidth() * a.getScaleX(), rshape.getHeight() * a.getScaleY()); //System.out.println("TRANSFORMED SHAPE: " + rshape + " for " + this); return rshape; } else { return getMapBounds(); } }