Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/utils/GeometryUtils.java @ 1641:eb3ab28d1c21
The extent of the WSPLGEN facets are now determined by the extent of the start and end CrossSectionTrack of the WSPLGEN calculation.
flys-artifacts/trunk@2827 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 26 Sep 2011 15:35:46 +0000 |
parents | 0398c2b8dbaf |
children | 092e1e5020bc |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/GeometryUtils.java Mon Sep 26 13:37:30 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/GeometryUtils.java Mon Sep 26 15:35:46 2011 +0000 @@ -76,6 +76,35 @@ } + public static String createOLBounds(Geometry a, Geometry b) { + Coordinate[] ca = a.getCoordinates(); + Coordinate[] cb = b.getCoordinates(); + + double lowerX = Double.MAX_VALUE; + double lowerY = Double.MAX_VALUE; + double upperX = -Double.MAX_VALUE; + double upperY = -Double.MAX_VALUE; + + for (Coordinate c: ca) { + lowerX = lowerX < c.x ? lowerX : c.x; + lowerY = lowerY < c.y ? lowerY : c.y; + + upperX = upperX > c.x ? upperX : c.x; + upperY = upperY > c.y ? upperY : c.y; + } + + for (Coordinate c: cb) { + lowerX = lowerX < c.x ? lowerX : c.x; + lowerY = lowerY < c.y ? lowerY : c.y; + + upperX = upperX > c.x ? upperX : c.x; + upperY = upperY > c.y ? upperY : c.y; + } + + return "" + lowerX + " " + lowerY + " " + upperX + " " + upperY; + } + + public static SimpleFeatureType buildFeatureType( String name, String srs, Class geometryType) {