java.awt.geom.Path2D#getBounds ( )源码实例Demo

下面列出了java.awt.geom.Path2D#getBounds ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: dragonwell8_jdk   文件: Path2DCopyConstructor.java
static void testGetBounds(Path2D pathA, Path2D pathB) {
    final Rectangle rA = pathA.getBounds();
    final Rectangle rB = pathB.getBounds();

    if (!rA.equals(rB)) {
        throw new IllegalStateException("Bounds are not equals [" + rA
            + "|" + rB + "] !");
    }
    final Rectangle2D r2dA = pathA.getBounds2D();
    final Rectangle2D r2dB = pathB.getBounds2D();

    if (!equalsRectangle2D(r2dA, r2dB)) {
        throw new IllegalStateException("Bounds2D are not equals ["
            + r2dA + "|" + r2dB + "] !");
    }
    log("testGetBounds: passed.");
}
 
源代码2 项目: TencentKona-8   文件: Path2DCopyConstructor.java
static void testGetBounds(Path2D pathA, Path2D pathB) {
    final Rectangle rA = pathA.getBounds();
    final Rectangle rB = pathB.getBounds();

    if (!rA.equals(rB)) {
        throw new IllegalStateException("Bounds are not equals [" + rA
            + "|" + rB + "] !");
    }
    final Rectangle2D r2dA = pathA.getBounds2D();
    final Rectangle2D r2dB = pathB.getBounds2D();

    if (!equalsRectangle2D(r2dA, r2dB)) {
        throw new IllegalStateException("Bounds2D are not equals ["
            + r2dA + "|" + r2dB + "] !");
    }
    log("testGetBounds: passed.");
}
 
源代码3 项目: jdk8u60   文件: Path2DCopyConstructor.java
static void testGetBounds(Path2D pathA, Path2D pathB) {
    final Rectangle rA = pathA.getBounds();
    final Rectangle rB = pathB.getBounds();

    if (!rA.equals(rB)) {
        throw new IllegalStateException("Bounds are not equals [" + rA
            + "|" + rB + "] !");
    }
    final Rectangle2D r2dA = pathA.getBounds2D();
    final Rectangle2D r2dB = pathB.getBounds2D();

    if (!equalsRectangle2D(r2dA, r2dB)) {
        throw new IllegalStateException("Bounds2D are not equals ["
            + r2dA + "|" + r2dB + "] !");
    }
    log("testGetBounds: passed.");
}
 
源代码4 项目: openjdk-jdk8u   文件: Path2DCopyConstructor.java
static void testGetBounds(Path2D pathA, Path2D pathB) {
    final Rectangle rA = pathA.getBounds();
    final Rectangle rB = pathB.getBounds();

    if (!rA.equals(rB)) {
        throw new IllegalStateException("Bounds are not equals [" + rA
            + "|" + rB + "] !");
    }
    final Rectangle2D r2dA = pathA.getBounds2D();
    final Rectangle2D r2dB = pathB.getBounds2D();

    if (!equalsRectangle2D(r2dA, r2dB)) {
        throw new IllegalStateException("Bounds2D are not equals ["
            + r2dA + "|" + r2dB + "] !");
    }
    log("testGetBounds: passed.");
}
 
static void testGetBounds(Path2D pathA, Path2D pathB) {
    final Rectangle rA = pathA.getBounds();
    final Rectangle rB = pathB.getBounds();

    if (!rA.equals(rB)) {
        throw new IllegalStateException("Bounds are not equals [" + rA
            + "|" + rB + "] !");
    }
    final Rectangle2D r2dA = pathA.getBounds2D();
    final Rectangle2D r2dB = pathB.getBounds2D();

    if (!equalsRectangle2D(r2dA, r2dB)) {
        throw new IllegalStateException("Bounds2D are not equals ["
            + r2dA + "|" + r2dB + "] !");
    }
    log("testGetBounds: passed.");
}
 
源代码6 项目: openjdk-jdk9   文件: Path2DCopyConstructor.java
static void testGetBounds(Path2D pathA, Path2D pathB) {
    final Rectangle rA = pathA.getBounds();
    final Rectangle rB = pathB.getBounds();

    if (!rA.equals(rB)) {
        throw new IllegalStateException("Bounds are not equals [" + rA
            + "|" + rB + "] !");
    }
    final Rectangle2D r2dA = pathA.getBounds2D();
    final Rectangle2D r2dB = pathB.getBounds2D();

    if (!equalsRectangle2D(r2dA, r2dB)) {
        throw new IllegalStateException("Bounds2D are not equals ["
            + r2dA + "|" + r2dB + "] !");
    }
    log("testGetBounds: passed.");
}
 
源代码7 项目: jdk8u-jdk   文件: Path2DCopyConstructor.java
static void testGetBounds(Path2D pathA, Path2D pathB) {
    final Rectangle rA = pathA.getBounds();
    final Rectangle rB = pathB.getBounds();

    if (!rA.equals(rB)) {
        throw new IllegalStateException("Bounds are not equals [" + rA
            + "|" + rB + "] !");
    }
    final Rectangle2D r2dA = pathA.getBounds2D();
    final Rectangle2D r2dB = pathB.getBounds2D();

    if (!equalsRectangle2D(r2dA, r2dB)) {
        throw new IllegalStateException("Bounds2D are not equals ["
            + r2dA + "|" + r2dB + "] !");
    }
    log("testGetBounds: passed.");
}
 
源代码8 项目: hottub   文件: Path2DCopyConstructor.java
static void testGetBounds(Path2D pathA, Path2D pathB) {
    final Rectangle rA = pathA.getBounds();
    final Rectangle rB = pathB.getBounds();

    if (!rA.equals(rB)) {
        throw new IllegalStateException("Bounds are not equals [" + rA
            + "|" + rB + "] !");
    }
    final Rectangle2D r2dA = pathA.getBounds2D();
    final Rectangle2D r2dB = pathB.getBounds2D();

    if (!equalsRectangle2D(r2dA, r2dB)) {
        throw new IllegalStateException("Bounds2D are not equals ["
            + r2dA + "|" + r2dB + "] !");
    }
    log("testGetBounds: passed.");
}
 
源代码9 项目: jdk8u_jdk   文件: Path2DCopyConstructor.java
static void testGetBounds(Path2D pathA, Path2D pathB) {
    final Rectangle rA = pathA.getBounds();
    final Rectangle rB = pathB.getBounds();

    if (!rA.equals(rB)) {
        throw new IllegalStateException("Bounds are not equals [" + rA
            + "|" + rB + "] !");
    }
    final Rectangle2D r2dA = pathA.getBounds2D();
    final Rectangle2D r2dB = pathB.getBounds2D();

    if (!equalsRectangle2D(r2dA, r2dB)) {
        throw new IllegalStateException("Bounds2D are not equals ["
            + r2dA + "|" + r2dB + "] !");
    }
    log("testGetBounds: passed.");
}
 
源代码10 项目: mil-sym-java   文件: MultiPointHandler.java
/**
 *
 * @param tgPoints
 * @param jsonContent
 * @param mSymbol
 * @param ipc
 * @param normalize
 */
static private String AddImageFillToKML(ArrayList<JavaLineArray.POINT2> tgPoints,
        String jsonContent, MilStdSymbol mSymbol, IPointConversion ipc, Boolean normalize) {
    if (tgPoints == null || tgPoints.size() == 0) {
        return null;
    }
    //get original point values in pixel form                    
    ArrayList<Point2D> pixelPoints = new ArrayList<Point2D>();
    Path2D path = new Path2D.Double();

    //for(JavaLineArray.POINT2 pt : tgPoints)
    int kcount = tgPoints.size();
    JavaLineArray.POINT2 tpTemp = null;
    for (int k = 0; k < kcount; k++) {
        tpTemp = tgPoints.get(k);
        pixelPoints.add(new Point2D.Double(tpTemp.x, tpTemp.y));
        if (k > 0) {
            path.lineTo(tpTemp.x, tpTemp.y);
        } else {
            path.moveTo(tpTemp.x, tpTemp.y);
        }
    }
    Rectangle rect = path.getBounds();
    //get url for the fill or line pattern PNG
    String goImageUrl = SECWebRenderer.GenerateSymbolLineFillUrl(mSymbol.getModifierMap(), pixelPoints, rect);
    //generate the extra KML needed to insert the image
    String goKML = GenerateGroundOverlayKML(goImageUrl, ipc, rect, normalize);
    goKML += "</Folder>";

    //StringBuilder sb = new StringBuilder();
    //sb.replace(start, end, str)
    jsonContent = jsonContent.replace("</Folder>", goKML);

    return jsonContent;
}
 
源代码11 项目: ET_Redux   文件: ConcordiaGraphPanel.java
private void plotAFraction(
            Graphics2D g2d,
            boolean svgStyle,
            ETFractionInterface f,
            Color borderColor,
            float borderWeight,
            Color centerColor,
            float centerSize,
            String ellipseLabelFont,
            String ellipseLabelFontSize) {

        Path2D ellipse = f.getErrorEllipsePath();
        if (svgStyle) {
            // generate file if necessary to handle weakness in Batik
        } else {
            // draw ellipse
            g2d.setStroke(new BasicStroke(borderWeight));
            g2d.setPaint(borderColor);
            g2d.draw(ellipse);
        }

        // draw ellipse centers
        if (isShowEllipseCenters()) {

            float centerXbox = (float) (ellipse.getBounds().x + ellipse.getBounds().width / 2.0 - centerSize / 2.0);
            float centerYbox = (float) (ellipse.getBounds().y + ellipse.getBounds().height / 2.0 - centerSize / 2.0);

            Ellipse2D fractionbox = new Ellipse2D.Double(
                    centerXbox,
                    centerYbox,
                    centerSize,
                    centerSize);
            g2d.setPaint(centerColor);
            g2d.setStroke(new BasicStroke(1.0f));
            g2d.fill(fractionbox);

//            // jan 2011 experiment re: centers: we need to find a more precise way to draw centers
//            float centerX = (float)mapX(((UPbFractionI) f).getCenterX());
//            float centerY = (float)mapY(((UPbFractionI) f).getCenterY());
//
//            Ellipse2D fraction = new Ellipse2D.Double(
//                    centerX,
//                    centerY,
//                    centerSize,
//                    centerSize );
//            g2d.setPaint( centerColor );
//            g2d.setStroke( new BasicStroke( 1.0f ) );
//            g2d.fill( fraction );
        }

        if (isShowEllipseLabels()) {
            g2d.setPaint(borderColor);
            g2d.setFont(new Font(
                    ellipseLabelFont,
                    Font.BOLD,
                    Integer.parseInt(ellipseLabelFontSize)));

            // locate label based on tilt of ellipse as represented by rho
            float labelY;
            float labelX;
            if (f.getEllipseRho() < 0) {
                labelY = (float) (ellipse.getBounds().getY() //
                        + ellipse.getBounds().getHeight() - (1.0 + f.getEllipseRho()) * ellipse.getBounds().getHeight() / 4.0 + 15f);
                labelX = (float) (ellipse.getBounds().getX() + ellipse.getBounds().getWidth() - 6f);
            } else {
                labelY = (float) (ellipse.getBounds().getY() //
                        + (1.0 - f.getEllipseRho()) * ellipse.getBounds().getHeight() / 2.0);
                labelX = (float) (ellipse.getBounds().getX() + ellipse.getBounds().getWidth() + 2f);
            }

            g2d.drawString(f.getFractionID(), labelX, labelY);
        }

    }
 
源代码12 项目: ET_Redux   文件: AbstractDataView.java
protected void plotAFraction(
            Graphics2D g2d,
            boolean svgStyle,
            ETFractionInterface f,
            Color borderColor,
            float borderWeight,
            Color centerColor,
            float centerSize,
            String ellipseLabelFont,
            String ellipseLabelFontSize,
            boolean showCenters,
            boolean showLabels) {

        Path2D ellipse = f.getErrorEllipsePath();
        if (svgStyle) {
            // generate file if necessary to handle weakness in Batik
        } else {
            // draw ellipse
            g2d.setStroke(new BasicStroke(borderWeight));
            g2d.setPaint(centerColor);
            g2d.draw(ellipse);

            Composite originalComposite = g2d.getComposite();
            g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.3f));
//            g2d.setPaint(fillColor);
            g2d.fill(ellipse);
            //restore composite
            g2d.setComposite(originalComposite);
//            g2d.fill(ellipse);
        }

        // draw ellipse centers
        if (showCenters) {

            float centerXbox = (float) (ellipse.getBounds().x + ellipse.getBounds().width / 2.0 - centerSize / 2.0);
            float centerYbox = (float) (ellipse.getBounds().y + ellipse.getBounds().height / 2.0 - centerSize / 2.0);

            Ellipse2D fractionbox = new Ellipse2D.Double(
                    centerXbox,
                    centerYbox,
                    centerSize,
                    centerSize);
            g2d.setPaint(Color.BLACK);
            g2d.setStroke(new BasicStroke(1.0f));
            g2d.fill(fractionbox);
        }

        if (showLabels) {
            g2d.setPaint(borderColor);
            g2d.setFont(new Font(
                    ellipseLabelFont,
                    Font.BOLD,
                    Integer.parseInt(ellipseLabelFontSize)));

            // locate label based on tilt of ellipse as represented by rho
            float labelY;
            float labelX;
            if (f.getEllipseRho() < 0) {
                labelY = (float) (ellipse.getBounds().getY() //
                        + ellipse.getBounds().getHeight() - (1.0 + f.getEllipseRho()) * ellipse.getBounds().getHeight() / 4.0 + 15f);
                labelX = (float) (ellipse.getBounds().getX() + ellipse.getBounds().getWidth() - 6f);
            } else {
                labelY = (float) (ellipse.getBounds().getY() //
                        + (1.0 - f.getEllipseRho()) * ellipse.getBounds().getHeight() / 2.0);
                labelX = (float) (ellipse.getBounds().getX() + ellipse.getBounds().getWidth() + 2f);
            }

            g2d.drawString(f.getFractionID(), labelX, labelY);
        }

    }