changeset 1806:50110699e38e

Determine correct bounding box a KMs WMS layer. flys-artifacts/trunk@3134 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 01 Nov 2011 15:33:54 +0000
parents 5e9696c32f04
children 416d5526e1eb
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSKmArtifact.java
diffstat 2 files changed, 23 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue Nov 01 14:54:59 2011 +0000
+++ b/flys-artifacts/ChangeLog	Tue Nov 01 15:33:54 2011 +0000
@@ -1,3 +1,9 @@
+2011-11-01  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/WMSKmArtifact.java: Determine
+	  the extent of such WMS layer based on the list of RiverAxisKm objects
+	  returned by the backend.
+
 2011-11-01  Ingo Weinzierl <ingo@intevation.de>
 
 	* doc/conf/meta-data.xml: Added a datacage node that represents a
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSKmArtifact.java	Tue Nov 01 14:54:59 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSKmArtifact.java	Tue Nov 01 15:33:54 2011 +0000
@@ -17,7 +17,7 @@
 import de.intevation.artifactdatabase.state.State;
 
 import de.intevation.flys.model.River;
-import de.intevation.flys.model.RiverAxis;
+import de.intevation.flys.model.RiverAxisKm;
 
 import de.intevation.flys.artifacts.WMSDBArtifact.WMSDBState;
 import de.intevation.flys.artifacts.model.FacetTypes;
@@ -101,18 +101,6 @@
             return riverId;
         }
 
-        public Geometry getGeom() {
-            if (geom == null) {
-                // TODO replace riveraxis with kilometrage geometry
-                River river = RiverFactory.getRiver(getRiverId());
-                RiverAxis a = RiverAxis.getRiverAxis(river.getName());
-
-                geom = a.getGeom();
-            }
-
-            return geom;
-        }
-
         @Override
         protected String getFacetType() {
             return FLOODMAP_KMS;
@@ -136,7 +124,22 @@
 
         @Override
         protected Envelope getExtent() {
-            return getGeom().getEnvelopeInternal();
+            List<RiverAxisKm> kms = RiverAxisKm.getRiverAxisKms(getRiverId());
+
+            Envelope max = null;
+
+            for (RiverAxisKm km: kms) {
+                Envelope env = km.getGeom().getEnvelopeInternal();
+
+                if (max == null) {
+                    max = env;
+                    continue;
+                }
+
+                max.expandToInclude(env);
+            }
+
+            return max;
         }
 
         @Override

http://dive4elements.wald.intevation.org