changeset 4322:f36550788add

NaviChartOutputTab: Get relevant data also from not-fixationanalysis-artifacts.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 30 Oct 2012 12:04:49 +0100
parents e7f7be368cf3
children 33d6d4025d0f
files flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/NaviChartOutputTab.java
diffstat 1 files changed, 25 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/NaviChartOutputTab.java	Tue Oct 30 10:45:16 2012 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/NaviChartOutputTab.java	Tue Oct 30 12:04:49 2012 +0100
@@ -104,11 +104,25 @@
         }
         else {
             // Probably WINFOArtifact kind of artifact.
-            // TODO Proper implementation
-            // collectionView set real steps.
-            collectionView.setSteps(100d);
-            fromKm = 0d;
-            toKm = 93d;
+            String ld_step =
+                    art.getArtifactDescription().getDataValueAsString("ld_step");
+            try {
+                collectionView.setSteps(Double.valueOf(ld_step));
+            }
+            catch (Exception e) {
+                GWT.log("No ld_steps data or not parsable.");
+                return root;
+            }
+
+            double[] kmRange = art.getArtifactDescription().getKMRange();
+            if (kmRange == null || kmRange.length == 2) {
+                fromKm = kmRange[0];
+                toKm   = kmRange[1];
+            }
+            else {
+                GWT.log("No KM range in description found.");
+                return root;
+            }
         }
 
         collectionView.setMinKm(fromKm);
@@ -284,12 +298,17 @@
             }
         }
 
-        if(collectionView.getArtifact() instanceof FixAnalysisArtifact) {
+        if (collectionView.getArtifact() instanceof FixAnalysisArtifact) {
             if (collectionView.getCurrentKm() == -1) {
                 FixAnalysisArtifact fix =
                     (FixAnalysisArtifact) collectionView.getArtifact();
                 collectionView.setCurrentKm(fix.getFilter().getFromKm());
             }
+        }
+        else if (collectionView.getCurrentKm() == -1) {
+            collectionView.setCurrentKm(collectionView.getArtifact().getArtifactDescription().getKMRange()[0]);
+        }
+        if (collectionView.getCurrentKm() != -1) {
             imgUrl += "&currentKm=" + collectionView.getCurrentKm();
         }
 

http://dive4elements.wald.intevation.org