diff flys-artifacts/src/main/java/de/intevation/flys/utils/GeometryUtils.java @ 2078:cbeeaaad1056

#440 Support river axes that consist of more than a single geometry. flys-artifacts/trunk@3593 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 05 Jan 2012 10:46:32 +0000
parents 092e1e5020bc
children 33aa37e6d98f
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/GeometryUtils.java	Thu Jan 05 08:34:47 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/GeometryUtils.java	Thu Jan 05 10:46:32 2012 +0000
@@ -46,11 +46,24 @@
 
 
     public static Envelope getRiverBoundary(String rivername) {
-        RiverAxis axis = RiverAxis.getRiverAxis(rivername);
-        if (axis != null) {
-            // TODO Take the correct EPSG into account. Maybe, we need to
-            // reproject the geometry.
-            return axis.getGeom().getEnvelopeInternal();
+        List<RiverAxis> axes = RiverAxis.getRiverAxis(rivername);
+        if (axes != null && axes.size() > 0) {
+            Envelope max = null;
+
+            for (RiverAxis axis: axes) {
+                // TODO Take the correct EPSG into account. Maybe, we need to
+                // reproject the geometry.
+                Envelope env = axis.getGeom().getEnvelopeInternal();
+
+                if (max == null) {
+                    max = env;
+                }
+                else {
+                    max.expandToInclude(env);
+                }
+            }
+
+            return max;
         }
 
         return null;

http://dive4elements.wald.intevation.org