Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/utils/GeometryUtils.java @ 1052:eeebf8514c7f
The boundary (extent) for the river axis is determined based on its geometry - this extent is written into the wms facet.
flys-artifacts/trunk@2514 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 19 Aug 2011 15:52:03 +0000 |
parents | |
children | e9f66d63bdd0 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/GeometryUtils.java Fri Aug 19 15:52:03 2011 +0000 @@ -0,0 +1,32 @@ +package de.intevation.flys.utils; + +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.Geometry; + + + +public class GeometryUtils { + + private GeometryUtils() { + } + + + /** + * Returns the boundary of Geometry <i>geom</i> in OpenLayers + * representation. + * + * @param geom The geometry. + * + * @return the OpenLayers boundary of <i>geom</i>. + */ + public static String jtsBoundsToOLBounds(Geometry geom) { + Coordinate[] c = geom != null ? geom.getCoordinates() : null; + + if (c == null || c.length < 2) { + return null; + } + + return "" + c[0].x + " " + c[1].y + " " + c[1].x + " " + c[0].y; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :