diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.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 f45bbc80bd3d
children 74142aa5d938
line wrap: on
line diff
--- 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);
         }

http://dive4elements.wald.intevation.org