[Dive4elements-commits] [PATCH 1 of 2] NaviChartOutputTab: Get relevant data also from not-fixationanalysis-artifacts

Wald Commits scm-commit at wald.intevation.org
Tue Oct 30 12:01:49 CET 2012


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1351595089 -3600
# Node ID f36550788addc63114cde7ffab849131fb734c48
# Parent  e7f7be368cf32b3a931610abe1ac305ff286a29c
NaviChartOutputTab: Get relevant data also from not-fixationanalysis-artifacts.

diff -r e7f7be368cf3 -r f36550788add flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/NaviChartOutputTab.java
--- 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();
         }
 


More information about the Dive4elements-commits mailing list