/** * Transforms a rectangle using the given math transform. * This transformation can not handle poles. */ @Override Rectangle2D transform(CoordinateReferenceSystem targetCRS, MathTransform2D transform, Rectangle2D envelope) throws TransformException { return Shapes2D.transform(transform, envelope, null); }
/** * Transforms a rectangle using the given operation. * This transformation can handle poles. */ @Override Rectangle2D transform(CoordinateOperation operation, Rectangle2D envelope) throws TransformException { return Shapes2D.transform(operation, envelope, null); }
/** * Returns a high precision and more accurate bounding box of the shape than the * {@link #getBounds} method. This method returns an infinite rectangle if some * points can not be transformed. */ @Override public Rectangle2D getBounds2D() { try { return Shapes2D.transform(projection, shape.getBounds2D(), null); } catch (TransformException exception) { Logging.recoverableException(null, ProjectedShape.class, "getBounds2D", exception); return XRectangle2D.INFINITY; } }
return transform(transform, envelope, destination, new double[2]);
return transform(transform, envelope, destination, new double[2]);
/** * Tests if the interior of this shape intersects the interior of a specified rectangle. * This method might conservatively return {@code true} if some points can not be transformed. * * @param r The rectangle to be tested. * @return {@code true} if this shape intersects the given rectangle. */ @Override public boolean intersects(final Rectangle2D r) { try { return shape.intersects(Shapes2D.transform(inverse(), r, rectangle)); } catch (TransformException exception) { Logging.recoverableException(null, ProjectedShape.class, "intersects", exception); return true; // Consistent with the Shape interface contract. } }
/** * Tests if the interior of this shape entirely contains the specified rectangle. * This method might conservatively return {@code false} if some points can not * be transformed. * * @param r The rectangle to be tested. * @return {@code true} if this shape contains the given rectangle. */ @Override public boolean contains(final Rectangle2D r) { try { return shape.contains(Shapes2D.transform(inverse(), r, rectangle)); } catch (TransformException exception) { Logging.recoverableException(null, ProjectedShape.class, "contains", exception); return false; // Consistent with the Shape interface contract. } }
r.setRect(Shapes2D.transform(CRS.findOperation(geographicArea.getCoordinateReferenceSystem(), sourceCRS, null), r, r)); r.intersect(areaOfInterest); final Rectangle2D bounds = Shapes2D.transform(op, areaOfInterest, null); gridX = (((int) (bounds.getMinX() / step))) * step; // Inclusive gridY = (((int) (bounds.getMinY() / step))) * step;
cell.setRect(Shapes2D.transform(gridToAOI, cell, cell)); if (cell.intersects(areaOfInterest)) { // Must be invoked on Envelope2D implementation. int x = gridX;
destination = transform(mt, envelope, destination, center);
destination = transform(mt, envelope, destination, center);