當前位置: 首頁>>代碼示例>>Java>>正文


Java Rectangle2D.union方法代碼示例

本文整理匯總了Java中java.awt.geom.Rectangle2D.union方法的典型用法代碼示例。如果您正苦於以下問題:Java Rectangle2D.union方法的具體用法?Java Rectangle2D.union怎麽用?Java Rectangle2D.union使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.awt.geom.Rectangle2D的用法示例。


在下文中一共展示了Rectangle2D.union方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getVisualBounds

import java.awt.geom.Rectangle2D; //導入方法依賴的package包/類
public Rectangle2D getVisualBounds() {
    Rectangle2D result = null;
    for (int i = 0; i < glyphs.length; ++i) {
        Rectangle2D glyphVB = getGlyphVisualBounds(i).getBounds2D();
        if (!glyphVB.isEmpty()) {
            if (result == null) {
                result = glyphVB;
            } else {
                Rectangle2D.union(result, glyphVB, result);
            }
        }
    }
    if (result == null) {
        result = new Rectangle2D.Float(0, 0, 0, 0);
    }
    return result;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:18,代碼來源:StandardGlyphVector.java

示例2: bounds

import java.awt.geom.Rectangle2D; //導入方法依賴的package包/類
public static Rectangle bounds(Collection<? extends Shape> shapes) {
    if (shapes.isEmpty()) {
        throw new IllegalArgumentException("shapes can't be empty");
    }

    Iterator<? extends Shape> iter = shapes.iterator();
    Rectangle rv = new Rectangle();
    rv.setRect(iter.next().getBounds2D());

    while (iter.hasNext()) {
        Rectangle2D.union(iter.next().getBounds2D(), rv, rv);
    }

    return rv;

}
 
開發者ID:redmyers,項目名稱:484_P7_1-Java,代碼行數:17,代碼來源:Utils.java

示例3: createUnion

import java.awt.geom.Rectangle2D; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 * @since 1.2
 */
public Rectangle2D createUnion(Rectangle2D r) {
    if (r instanceof Rectangle) {
        return union((Rectangle) r);
    }
    Rectangle2D dest = new Rectangle2D.Double();
    Rectangle2D.union(this, r, dest);
    return dest;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:13,代碼來源:Rectangle.java

示例4: updateCachedPreferredSize

import java.awt.geom.Rectangle2D; //導入方法依賴的package包/類
/**
 * Taken from <code>com.jgraph.example.fastgraph.FastGraphUI</code>.
 * Updates the <code>preferredSize</code> instance variable, which is
 * returned from <code>getPreferredSize()</code>. Ignores edges for
 * performance
 */
@Override
protected void updateCachedPreferredSize() {
    CellView[] views = this.graphLayoutCache.getRoots();
    Rectangle2D size = null;
    if (views != null && views.length > 0) {
        for (int i = 0; i < views.length; i++) {
            if (views[i] != null && !(views[i] instanceof JEdgeView)) {
                Rectangle2D r = views[i].getBounds();
                if (r != null) {
                    if (size == null) {
                        size =
                            new Rectangle2D.Double(r.getX(), r.getY(),
                                r.getWidth(), r.getHeight());
                    } else {
                        Rectangle2D.union(size, r, size);
                    }
                }
            }
        }
    }
    if (size == null) {
        size = new Rectangle2D.Double();
    }
    Point2D psize =
        new Point2D.Double(size.getX() + size.getWidth(), size.getY()
            + size.getHeight());
    Dimension d = getJGraph().getMinimumSize();
    Point2D min =
        (d != null) ? getJGraph().toScreen(new Point(d.width, d.height))
                : new Point(0, 0);
    Point2D scaled = getJGraph().toScreen(psize);
    this.preferredSize =
        new Dimension((int) Math.max(min.getX(), scaled.getX()),
            (int) Math.max(min.getY(), scaled.getY()));
    Insets in = this.graph.getInsets();
    if (in != null) {
        this.preferredSize.setSize(this.preferredSize.getWidth() + in.left
            + in.right, this.preferredSize.getHeight() + in.top + in.bottom);
    }
    this.validCachedPreferredSize = true;
}
 
開發者ID:meteoorkip,項目名稱:JavaGraph,代碼行數:48,代碼來源:JGraphUI.java


注:本文中的java.awt.geom.Rectangle2D.union方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。