/** * Fills the given {@link RectF} with the path bounds. * * @param bounds the RectF to be filled. */ public void fillBounds(RectF bounds) { Rectangle2D rect = mPath.getBounds2D(); bounds.left = (float) rect.getMinX(); bounds.right = (float) rect.getMaxX(); bounds.top = (float) rect.getMinY(); bounds.bottom = (float) rect.getMaxY(); }
public static Path2D enlargeSlightlyInPlace(Path2D path2d) { AffineTransform aLittleLarger = new AffineTransform(); double centerX = path2d.getBounds2D().getCenterX(); double centerY = path2d.getBounds2D().getCenterY(); aLittleLarger.translate(centerX, centerY); aLittleLarger.scale(1.01, 1.01); aLittleLarger.translate(-centerX, -centerY); path2d.transform(aLittleLarger); return path2d; }
@Override public Rectangle2D getBounds2D() { return path.getBounds2D(); }
@Override public Rectangle2D getBounds2D() { return path.getBounds2D(); }
/** * Fills the given {@link RectF} with the path bounds. * * @param bounds the RectF to be filled. */ public void fillBounds(RectF bounds) { Rectangle2D rect = mPath.getBounds2D(); bounds.left = (float) rect.getMinX(); bounds.right = (float) rect.getMaxX(); bounds.top = (float) rect.getMinY(); bounds.bottom = (float) rect.getMaxY(); }
// Polygon -> PathIterator -> Path2D, and then: Path2D path = ...; at.scale( 1, -1 ); path.transform( at ); bbox = path.getBounds2D(); at = new AffineTransform(); at.translate( -bbox.getMinX(), -bbox.getMinY() ); path.transform( at );
Rectangle2D r = path.getBounds2D(); Rectangle2D lowerHalf = new Rectangle2D.Double(0.0, 0.0, 360.0, r.getMaxY()); if (lowerHalf.contains(center.getOrdinate(0) + 180.0, center.getOrdinate(1) + 90.0)) { Rectangle2D r = path.getBounds2D(); if ((r.getMaxX() - r.getMinX()) > 359.0) { return new Rectangle2D.Double(0.0, 0.0, 360.0, 180.0); return path.getBounds2D();
Rectangle2D pathBounds = path.getBounds2D(); if (pathBounds.getHeight() > maxImageSize || pathBounds.getWidth() > maxImageSize) { if (pathBounds.getHeight() > pathBounds.getWidth()) {
Rectangle2D bounds = path.getBounds2D(); double imageSize = 0; if (params.containsKey(AreaSymbolFill.KEY_SYMBOL_FILL_ICON_SIZE)) {
/** * Transforms the given shape using the given projection, then apply a correction for fitting * the shape in the test viewer. This method also set the {@link #projection} to the resulting * concatenated transform. */ private Shape createReferenceShape(final Shape shape, MathTransform2D tr) throws TransformException { final Path2D path = transform(shape, tr); Rectangle2D bounds = path.getBounds2D(); final AffineTransform adjust = AffineTransform.getTranslateInstance(SHAPE_X, SHAPE_Y); adjust.scale(2*SHAPE_WIDTH / bounds.getWidth(), 2*SHAPE_HEIGHT / bounds.getHeight()); adjust.translate(-bounds.getX(), -bounds.getY()); path.transform(adjust); tr = MathTransforms.concatenate(tr, (MathTransform2D) org.geotoolkit.referencing.operation.MathTransforms.linear(adjust)); projection = tr; return path; }
Rectangle2D bounds = path.getBounds2D(); double imageSize = 0; if (params.containsKey(AreaSymbolFill.KEY_SYMBOL_FILL_ICON_SIZE)) {
Rectangle2D pathBounds = path.getBounds2D(); if (pathBounds.getHeight() > maxImageSize || pathBounds.getWidth() > maxImageSize) { if (pathBounds.getHeight() > pathBounds.getWidth()) {
Rectangle2D r = path.getBounds2D(); Rectangle2D lowerHalf = new Rectangle2D.Double(0.0, 0.0, 360.0, r.getMaxY()); if (lowerHalf.contains(center.getOrdinate(0) + 180.0, center.getOrdinate(1) + 90.0)) { Rectangle2D r = path.getBounds2D(); if ((r.getMaxX() - r.getMinX()) > 359.0) { return new Rectangle2D.Double(0.0, 0.0, 360.0, 180.0); return path.getBounds2D();
/** * Gets the bounding rectangle around a local bounded object with facing. * * @param object the local bounded object. * @return bounding rectangle. */ public static Rectangle2D getBoundingRectangle(LocalBoundedObject object) { Rectangle2D rect = new Rectangle2D.Double(object.getXLocation() - (object.getWidth() / 2D), object.getYLocation() - (object.getLength() / 2D), object.getWidth(), object.getLength()); Path2D path = getPathFromRectangleRotation(rect, object.getFacing()); return path.getBounds2D(); }
Rectangle2D pathBounds = path.getBounds2D(); Rectangle2D obstacleBounds = obstacleArea.getBounds2D(); if (pathBounds.intersects(obstacleBounds)) {
LabelFace lf = (LabelFace) f; Path2D p = lf.createPath(pts); Rectangle2D lb = p.getBounds2D(); g2.setFont(lf.getFont()); g2.setColor(lf.getBackgroundColor());