Example usage for java.awt.geom Rectangle2D.Float setRect

List of usage examples for java.awt.geom Rectangle2D.Float setRect

Introduction

In this page you can find the example usage for java.awt.geom Rectangle2D.Float setRect.

Prototype

public void setRect(Rectangle2D r) 

Source Link

Document

Sets this Rectangle2D to be the same as the specified Rectangle2D .

Usage

From source file:tufts.vue.LWComponent.java

/** @return the union of the bounds of the current component, all connected links, and all far endpoints
 * of those links.//from ww  w. j  av  a  2 s  .c  o m
 */
public Rectangle2D.Float getFanBounds(Rectangle2D.Float rect) {
    if (rect == null)
        rect = getMapBounds();
    else
        rect.setRect(getMapBounds());

    for (LWLink link : getLinks()) {
        final LWComponent head = link.getHead();
        final LWComponent tail = link.getTail();

        rect.add(link.getPaintBounds());

        if (head != this) {
            if (head != null)
                rect.add(head.getPaintBounds());
        } else if (tail != this) {
            if (tail != null)
                rect.add(tail.getPaintBounds());
        }
    }
    return rect;
}