Java Code Examples for java.awt.geom.Path2D#getBounds()
The following examples show how to use
java.awt.geom.Path2D#getBounds() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Path2DCopyConstructor.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
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."); }
Example 2
Source File: Path2DCopyConstructor.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
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."); }
Example 3
Source File: Path2DCopyConstructor.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
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."); }
Example 4
Source File: Path2DCopyConstructor.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
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."); }
Example 5
Source File: Path2DCopyConstructor.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
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."); }
Example 6
Source File: Path2DCopyConstructor.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
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."); }
Example 7
Source File: Path2DCopyConstructor.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
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."); }
Example 8
Source File: Path2DCopyConstructor.java From hottub with GNU General Public License v2.0 | 6 votes |
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."); }
Example 9
Source File: Path2DCopyConstructor.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
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."); }
Example 10
Source File: MultiPointHandler.java From mil-sym-java with Apache License 2.0 | 5 votes |
/** * * @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; }
Example 11
Source File: ConcordiaGraphPanel.java From ET_Redux with Apache License 2.0 | 4 votes |
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); } }
Example 12
Source File: AbstractDataView.java From ET_Redux with Apache License 2.0 | 4 votes |
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); } }