/** * Creates and returns a geometry out of bounds (a point if bounds.getSpan(0) == * bounds.getSpan(1) == 0D, a polygon otherwise), setting the bounds * {@link BoundingBox#getCoordinateReferenceSystem() CRS} as the geometry's * {@link Geometry#getUserData() user data}. * * @param bounds the bounding box to build from * @return the newly constructed geometry */ public static Geometry toGeometry(final BoundingBox bounds) { if (bounds == null) { return null; } Geometry geom; if (bounds.getSpan(0) == 0D && bounds.getSpan(1) == 0D) { geom = gfac.createPoint(new Coordinate(bounds.getMinX(), bounds.getMinY())); } else { geom = JTS.toGeometry(bounds, gfac); } geom.setUserData(bounds.getCoordinateReferenceSystem()); return geom; }
/** * Creates and returns a geometry out of bounds (a point if bounds.getSpan(0) == * bounds.getSpan(1) == 0D, a polygon otherwise), setting the bounds * {@link BoundingBox#getCoordinateReferenceSystem() CRS} as the geometry's * {@link Geometry#getUserData() user data}. * * @param bounds the bounding box to build from * @return the newly constructed geometry */ public static Geometry toGeometry(final BoundingBox bounds) { if (bounds == null) { return null; } Geometry geom; if (bounds.getSpan(0) == 0D && bounds.getSpan(1) == 0D) { geom = gfac.createPoint(new Coordinate(bounds.getMinX(), bounds.getMinY())); } else { geom = JTS.toGeometry(bounds, gfac); } geom.setUserData(bounds.getCoordinateReferenceSystem()); return geom; }
/** * Creates and returns a geometry out of bounds (a point if bounds.getSpan(0) == * bounds.getSpan(1) == 0D, a polygon otherwise), setting the bounds * {@link BoundingBox#getCoordinateReferenceSystem() CRS} as the geometry's * {@link Geometry#getUserData() user data}. * * @param bounds the bounding box to build from * @return the newly constructed geometry */ public static Geometry toGeometry(final BoundingBox bounds) { if (bounds == null) { return null; } Geometry geom; if (bounds.getSpan(0) == 0D && bounds.getSpan(1) == 0D) { geom = gfac.createPoint(new Coordinate(bounds.getMinX(), bounds.getMinY())); } else { geom = JTS.toGeometry(bounds, gfac); } geom.setUserData(bounds.getCoordinateReferenceSystem()); return geom; }