changeset 679:9a035ef7b595

The state that is used to enter locations writes the river's range into the DESCRIBE now. flys-artifacts/trunk@2103 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 14 Jun 2011 10:38:00 +0000
parents 19a3185822a4
children bcd62609c936
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/LocationSelect.java
diffstat 2 files changed, 46 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Jun 10 15:59:47 2011 +0000
+++ b/flys-artifacts/ChangeLog	Tue Jun 14 10:38:00 2011 +0000
@@ -1,3 +1,9 @@
+2011-06-14  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/states/LocationSelect.java:
+	  This state that is used to retrieve locations will now write the
+	  kilometer range of the selected river into the DESCRIBE document.
+
 2011-06-10  Sascha L. Teichmann <sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/model/Calculation1.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/LocationSelect.java	Fri Jun 10 15:59:47 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/LocationSelect.java	Tue Jun 14 10:38:00 2011 +0000
@@ -4,9 +4,13 @@
 
 import org.apache.log4j.Logger;
 
+import org.w3c.dom.Element;
+
 import de.intevation.artifacts.Artifact;
 import de.intevation.artifacts.CallContext;
 
+import de.intevation.artifacts.common.utils.XMLUtils;
+
 import de.intevation.artifactdatabase.data.StateData;
 
 import de.intevation.flys.artifacts.FLYSArtifact;
@@ -40,6 +44,42 @@
 
 
     @Override
+    protected Element[] createItems(
+        XMLUtils.ElementCreator cr,
+        Artifact    artifact,
+        String      name,
+        CallContext context)
+    {
+        double[] minmax = getMinMaxDistance(artifact);
+
+        double minVal = Double.MIN_VALUE;
+        double maxVal = Double.MAX_VALUE;
+
+        if (minmax != null) {
+            minVal = minmax[0];
+            maxVal = minmax[1];
+        }
+        else {
+            logger.warn("Could not read min/max distance values!");
+        }
+
+        if (name.equals(FIELD_LOCATIONS)) {
+            Element min = createItem(
+                cr,
+                new String[] {"min", new Double(minVal).toString()});
+
+            Element max = createItem(
+                cr,
+                new String[] {"max", new Double(maxVal).toString()});
+
+            return new Element[] { min, max };
+        }
+
+        return null;
+    }
+
+
+    @Override
     public boolean validate(Artifact artifact, CallContext context)
     throws IllegalArgumentException
     {

http://dive4elements.wald.intevation.org