Mercurial > dive4elements > river
changeset 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 | fb296bdf815f |
children | 6c0b79efd2c9 |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java flys-artifacts/src/main/java/de/intevation/flys/utils/GeometryUtils.java |
diffstat | 3 files changed, 63 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Mon Sep 26 13:37:30 2011 +0000 +++ b/flys-artifacts/ChangeLog Mon Sep 26 15:35:46 2011 +0000 @@ -1,3 +1,13 @@ +2011-09-26 Ingo Weinzierl <ingo@intevation.de> + + * src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java: + The extent of the WSPLGEN result layer is now specified by the extent of + the CrossSectionTracks that matches the start and end kilometer of the + WSPLGEN calculation. + + * src/main/java/de/intevation/flys/utils/GeometryUtils.java: New function + that creates the OpenLayers bounding box based on two Geometries. + 2011-09-26 Felix Wolfsteller <felix.wolfsteller@intevation.de> Improved w-differences diagram generation with included "absolute"
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java Mon Sep 26 13:37:30 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java Mon Sep 26 15:35:46 2011 +0000 @@ -126,6 +126,23 @@ return FLYSUtils.getRiverSrid(artifact); } + protected String getWSPLGENBounds() { + String river = getRiver(); + double kms[] = FLYSUtils.getKmRange(artifact); + + CrossSectionTrack a = + CrossSectionTrack.getCrossSectionTrack(river, kms[0]); + + CrossSectionTrack b = + CrossSectionTrack.getCrossSectionTrack(river, kms[1]); + + if (a == null || b == null) { + return null; + } + + return GeometryUtils.createOLBounds(a.getGeom(), b.getGeom()); + } + protected String getBounds() { return GeometryUtils.getRiverBounds(getRiver()); } @@ -147,10 +164,16 @@ hash, getUrl()); + String bounds = getWSPLGENBounds(); + + if (bounds == null || bounds.length() == 0) { + bounds = getBounds(); + } + wsplgen.addLayer( artifact.identifier() + MapfileGenerator.MS_WSPLGEN_POSTFIX); wsplgen.setSrid(getSrid()); - wsplgen.setExtent(getBounds()); + wsplgen.setExtent(bounds); facets.add(wsplgen); }
--- 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) {