changeset 2716:150dcdefeb7d

Only offer soundings that fit to the current km range in MINFO bed height workflow. flys-artifacts/trunk@4444 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 18 May 2012 12:44:20 +0000
parents 250a370c377d
children 4cd55689e9a9
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/SoundingsSelect.java
diffstat 2 files changed, 26 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri May 18 11:58:38 2012 +0000
+++ b/flys-artifacts/ChangeLog	Fri May 18 12:44:20 2012 +0000
@@ -1,3 +1,8 @@
+2012-05-18  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/states/SoundingsSelect.java:
+	  Take the current km range into account in getOptions().
+
 2012-05-18  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java,
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/SoundingsSelect.java	Fri May 18 11:58:38 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/SoundingsSelect.java	Fri May 18 12:44:20 2012 +0000
@@ -51,19 +51,29 @@
         }
 
         River river = FLYSUtils.getRiver((FLYSArtifact) artifact);
+        double lo = ((FLYSArtifact) artifact).getDataAsDouble("ld_from");
+        double hi = ((FLYSArtifact) artifact).getDataAsDouble("ld_to");
+
+        double kmLo = Math.min(lo, hi);
+        double kmHi = Math.max(lo, hi);
 
         List<KVP<String, String>> kvp = new ArrayList<KVP<String, String>>();
 
-        appendSingles(river, kvp);
-        appendEpochs(river, kvp);
+        appendSingles(river, kmLo, kmHi, kvp);
+        appendEpochs(river, kmLo, kmHi, kvp);
 
         return (KVP<String,String>[]) kvp.toArray(new KVP[kvp.size()]);
     }
 
 
-    protected void appendSingles(River river, List<KVP<String, String>> kvp) {
+    protected void appendSingles(
+        River river,
+        double kmLo,
+        double kmHi,
+        List<KVP<String, String>> kvp
+    ) {
         List<BedHeightSingle> singles =
-            BedHeightSingle.getBedHeightSingles(river);
+            BedHeightSingle.getBedHeightSingles(river, kmLo, kmHi);
 
         if (singles != null) {
             for (int i = 0; i < singles.size(); i++) {
@@ -78,9 +88,14 @@
     }
 
 
-    protected void appendEpochs(River river, List<KVP<String, String>> kvp) {
+    protected void appendEpochs(
+        River river,
+        double kmLo,
+        double kmHi,
+        List<KVP<String, String>> kvp
+    ) {
         List<BedHeightEpoch> epochs =
-            BedHeightEpoch.getBedHeightEpochs(river);
+            BedHeightEpoch.getBedHeightEpochs(river, kmLo, kmHi);
 
         if (epochs != null) {
             for (int i = 0; i < epochs.size(); i++) {

http://dive4elements.wald.intevation.org