Example usage for java.awt.geom RectangularShape getHeight

List of usage examples for java.awt.geom RectangularShape getHeight

Introduction

In this page you can find the example usage for java.awt.geom RectangularShape getHeight.

Prototype

public abstract double getHeight();

Source Link

Document

Returns the height of the framing rectangle in double precision.

Usage

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.  j  ava2  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();
    }
}