ingo@1052: package de.intevation.flys.utils;
ingo@1052:
ingo@1052: import com.vividsolutions.jts.geom.Coordinate;
ingo@1052: import com.vividsolutions.jts.geom.Geometry;
ingo@1052:
ingo@1052:
ingo@1052:
ingo@1052: public class GeometryUtils {
ingo@1052:
ingo@1052: private GeometryUtils() {
ingo@1052: }
ingo@1052:
ingo@1052:
ingo@1052: /**
ingo@1052: * Returns the boundary of Geometry geom in OpenLayers
ingo@1052: * representation.
ingo@1052: *
ingo@1052: * @param geom The geometry.
ingo@1052: *
ingo@1052: * @return the OpenLayers boundary of geom.
ingo@1052: */
ingo@1052: public static String jtsBoundsToOLBounds(Geometry geom) {
ingo@1052: Coordinate[] c = geom != null ? geom.getCoordinates() : null;
ingo@1052:
ingo@1052: if (c == null || c.length < 2) {
ingo@1052: return null;
ingo@1052: }
ingo@1052:
ingo@1052: return "" + c[0].x + " " + c[1].y + " " + c[1].x + " " + c[0].y;
ingo@1052: }
ingo@1052: }
ingo@1052: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :