当前位置: 首页>>代码示例>>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;未经允许,请勿转载。