@Test public void getEnvelope2D() { ReferencedEnvelope refEnv = new ReferencedEnvelope( -10, 10, -5, 5, DefaultGeographicCRS.WGS84); Envelope2D env2D = JTS.getEnvelope2D(refEnv, refEnv.getCoordinateReferenceSystem()); CRS.equalsIgnoreMetadata( refEnv.getCoordinateReferenceSystem(), env2D.getCoordinateReferenceSystem()); assertTrue(env2D.boundsEquals(refEnv, 0, 1, TOL)); }
public static Envelope2D getEnvelope2D(final Envelope envelope, final CoordinateReferenceSystem crs) throws MismatchedDimensionException { ensureNonNull("envelope", envelope); ensureNonNull("crs", crs); if (envelope instanceof ReferencedEnvelope) { final ReferencedEnvelope referenced = (ReferencedEnvelope) envelope; final CoordinateReferenceSystem implicitCRS = referenced.getCoordinateReferenceSystem(); if ((crs != null) && !CRS.equalsIgnoreMetadata(crs, implicitCRS)) { throw new IllegalArgumentException(Errors.format( ErrorKeys.MISMATCHED_ENVELOPE_CRS_$2, crs.getName().getCode(), implicitCRS .getName().getCode())); } } final CoordinateReferenceSystem crs2D = CRS.getHorizontalCRS(crs); if (crs2D == null) throw new MismatchedDimensionException(Errors.format(ErrorKeys.CANT_SEPARATE_CRS_$1, crs)); return new Envelope2D(crs2D, envelope.getMinX(), envelope.getMinY(), envelope.getWidth(), envelope.getHeight()); }
JTS { public static Envelope2D getEnvelope2D(final Envelope envelope, final CoordinateReferenceSystem crs) throws MismatchedDimensionException { ensureNonNull("envelope", envelope); ensureNonNull("crs", crs); if (envelope instanceof ReferencedEnvelope) { final ReferencedEnvelope referenced = (ReferencedEnvelope) envelope; final CoordinateReferenceSystem implicitCRS = referenced.getCoordinateReferenceSystem(); if ((crs != null) && !CRS.equalsIgnoreMetadata(crs, implicitCRS)) { throw new IllegalArgumentException(Errors.format( ErrorKeys.MISMATCHED_ENVELOPE_CRS_$2, crs.getName().getCode(), implicitCRS .getName().getCode())); } } final CoordinateReferenceSystem crs2D = CRS.getHorizontalCRS(crs); if (crs2D == null) throw new MismatchedDimensionException(Errors.format(ErrorKeys.CANT_SEPARATE_CRS_$1, crs)); return new Envelope2D(crs2D, envelope.getMinX(), envelope.getMinY(), envelope.getWidth(), envelope.getHeight()); } }
JTS { public static Envelope2D getEnvelope2D(final Envelope envelope, final CoordinateReferenceSystem crs) throws MismatchedDimensionException { ensureNonNull("envelope", envelope); ensureNonNull("crs", crs); if (envelope instanceof ReferencedEnvelope) { final ReferencedEnvelope referenced = (ReferencedEnvelope) envelope; final CoordinateReferenceSystem implicitCRS = referenced.getCoordinateReferenceSystem(); if ((crs != null) && !CRS.equalsIgnoreMetadata(crs, implicitCRS)) { throw new IllegalArgumentException(Errors.format( ErrorKeys.MISMATCHED_ENVELOPE_CRS_$2, crs.getName().getCode(), implicitCRS .getName().getCode())); } } final CoordinateReferenceSystem crs2D = CRS.getHorizontalCRS(crs); if (crs2D == null) throw new MismatchedDimensionException(Errors.format(ErrorKeys.CANT_SEPARATE_CRS_$1, crs)); return new Envelope2D(crs2D, envelope.getMinX(), envelope.getMinY(), envelope.getWidth(), envelope.getHeight()); } private  JTS(); }
JTS { public static Envelope2D getEnvelope2D(final Envelope envelope, final CoordinateReferenceSystem crs) throws MismatchedDimensionException { ensureNonNull("envelope", envelope); ensureNonNull("crs", crs); if (envelope instanceof ReferencedEnvelope) { final ReferencedEnvelope referenced = (ReferencedEnvelope) envelope; final CoordinateReferenceSystem implicitCRS = referenced.getCoordinateReferenceSystem(); if ((crs != null) && !CRS.equalsIgnoreMetadata(crs, implicitCRS)) { throw new IllegalArgumentException(Errors.format( ErrorKeys.MISMATCHED_ENVELOPE_CRS_$2, crs.getName().getCode(), implicitCRS .getName().getCode())); } } final CoordinateReferenceSystem crs2D = CRS.getHorizontalCRS(crs); if (crs2D == null) throw new MismatchedDimensionException(Errors.format(ErrorKeys.CANT_SEPARATE_CRS_$1, crs)); return new Envelope2D(crs2D, envelope.getMinX(), envelope.getMinY(), envelope.getWidth(), envelope.getHeight()); } private  JTS(); static Envelope transform(final Envelope envelope, final MathTransform transform); static Envelope transform(final Envelope sourceEnvelope, Envelope targetEnvelope,
            final MathTransform transform, int npoints); static Geometry transform(final Geometry geom, final MathTransform transform); static Coordinate transform(final Coordinate source, Coordinate dest,
            final MathTransform transform); static Envelope toGeographic(final Envelope envelope, final CoordinateReferenceSystem crs); static void xform(final MathTransform transform, final double[] src, final double[] dest); static synchronized double orthodromicDistance(final Coordinate p1, final Coordinate p2,
            final CoordinateReferenceSystem crs); static DirectPosition toDirectPosition(final Coordinate point,
            final CoordinateReferenceSystem crs); static void copy(final Coordinate point, final double[] ordinates); static Geometry shapeToGeometry(final Shape shape, final GeometryFactory factory); static Geometry toGeometry(final Shape shape); static Geometry toGeometry(final Shape shape, final GeometryFactory factory); static Envelope2D getEnvelope2D(final Envelope envelope,
            final CoordinateReferenceSystem crs); static Point toGeometry(DirectPosition position); static Point toGeometry(DirectPosition position, GeometryFactory factory); static Polygon toGeometry(Envelope env); static Polygon toGeometry(final Envelope env, GeometryFactory factory); static ReferencedEnvelope toEnvelope(Geometry geom); static Polygon toGeometry(ReferencedEnvelope bbox); static Polygon toGeometry(BoundingBox bbox, GeometryFactory factory, int npoints); static Polygon toGeometry(BoundingBox bbox); static Polygon toGeometry(BoundingBox bbox, final GeometryFactory factory); static void checkCoordinatesRange(Geometry geom, CoordinateReferenceSystem crs); static Geometry smooth(final Geometry geom, double fit); static Geometry smooth(final Geometry geom, double fit, final GeometryFactory factory); }
JTS { public static Envelope2D getEnvelope2D(final Envelope envelope, final CoordinateReferenceSystem crs) throws MismatchedDimensionException { ensureNonNull("envelope", envelope); ensureNonNull("crs", crs); if (envelope instanceof ReferencedEnvelope) { final ReferencedEnvelope referenced = (ReferencedEnvelope) envelope; final CoordinateReferenceSystem implicitCRS = referenced.getCoordinateReferenceSystem(); if ((crs != null) && !CRS.equalsIgnoreMetadata(crs, implicitCRS)) { throw new IllegalArgumentException(Errors.format( ErrorKeys.MISMATCHED_ENVELOPE_CRS_$2, crs.getName().getCode(), implicitCRS .getName().getCode())); } } final CoordinateReferenceSystem crs2D = CRS.getHorizontalCRS(crs); if (crs2D == null) throw new MismatchedDimensionException(Errors.format(ErrorKeys.CANT_SEPARATE_CRS_$1, crs)); return new Envelope2D(crs2D, envelope.getMinX(), envelope.getMinY(), envelope.getWidth(), envelope.getHeight()); } private  JTS(); static Envelope transform(final Envelope envelope, final MathTransform transform); static Envelope transform(final Envelope sourceEnvelope, Envelope targetEnvelope,
            final MathTransform transform, int npoints); static Geometry transform(final Geometry geom, final MathTransform transform); static Coordinate transform(final Coordinate source, Coordinate dest,
            final MathTransform transform); static Envelope toGeographic(final Envelope envelope, final CoordinateReferenceSystem crs); static void xform(final MathTransform transform, final double[] src, final double[] dest); static synchronized double orthodromicDistance(final Coordinate p1, final Coordinate p2,
            final CoordinateReferenceSystem crs); static DirectPosition toDirectPosition(final Coordinate point,
            final CoordinateReferenceSystem crs); static void copy(final Coordinate point, final double[] ordinates); static Geometry shapeToGeometry(final Shape shape, final GeometryFactory factory); static Geometry toGeometry(final Shape shape); static Geometry toGeometry(final Shape shape, final GeometryFactory factory); static Envelope2D getEnvelope2D(final Envelope envelope,
            final CoordinateReferenceSystem crs); static Point toGeometry(DirectPosition position); static Point toGeometry(DirectPosition position, GeometryFactory factory); static Polygon toGeometry(Envelope env); static Polygon toGeometry(final Envelope env, GeometryFactory factory); static ReferencedEnvelope toEnvelope(Geometry geom); static Polygon toGeometry(ReferencedEnvelope bbox); static Polygon toGeometry(BoundingBox bbox, GeometryFactory factory, int npoints); static Polygon toGeometry(BoundingBox bbox); static Polygon toGeometry(BoundingBox bbox, final GeometryFactory factory); static void checkCoordinatesRange(Geometry geom, CoordinateReferenceSystem crs); static Geometry smooth(final Geometry geom, double fit); static Geometry smooth(final Geometry geom, double fit, final GeometryFactory factory);  }