changeset 1153:62ad0a753b68

Fix facet name and legend of w-differences, walk over distance state, too. flys-artifacts/trunk@2684 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 09 Sep 2011 12:29:28 +0000
parents fc572b30f1b8
children 24b87650136f
files flys-artifacts/ChangeLog flys-artifacts/doc/conf/artifacts/winfo.xml flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WDifferencesState.java flys-artifacts/src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java
diffstat 4 files changed, 31 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Sep 09 10:13:22 2011 +0000
+++ b/flys-artifacts/ChangeLog	Fri Sep 09 12:29:28 2011 +0000
@@ -1,3 +1,17 @@
+2011-09-09  Felix Wolfsteller <felix.wolfsteller@intevation.de>
+
+	Fix Facet name and Legend of W-Differences, also insert state to specify
+	distance.
+
+	* doc/conf/artifacts/winfo.xml: Add additional transitions to walk over
+	  distances state.
+
+	* src/main/java/de/intevation/flys/artifacts/states/WDifferencesState.java:
+	  Set facets description.
+
+	* src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java:
+	  Take facets description as legend.
+
 2011-09-09  Felix Wolfsteller <felix.wolfsteller@intevation.de>
 
 	Added configuration to kick-in w-differences branch of winfo.
@@ -24,7 +38,7 @@
 	  New file, implements naive approach to calculate w-differences (of
 	  calculations identified by hardcoded uuids!) and register respective facet.
 
-	* src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java,
+	* src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java:
 	  New file, implementing naive approach to display w-differences.
 
 2011-09-09  Felix Wolfsteller <felix.wolfsteller@intevation.de>
--- a/flys-artifacts/doc/conf/artifacts/winfo.xml	Fri Sep 09 10:13:22 2011 +0000
+++ b/flys-artifacts/doc/conf/artifacts/winfo.xml	Fri Sep 09 12:29:28 2011 +0000
@@ -41,7 +41,7 @@
 
         <transition transition="de.intevation.flys.artifacts.transitions.ValueCompareTransition">
             <from state="state.winfo.calculation_mode"/>
-            <to state="state.winfo.w_differences"/>
+            <to state="state.winfo.distance"/>
             <condition data="calculation_mode" value="calc.w.differences" operator="equal"/>
         </transition>
 
@@ -89,6 +89,12 @@
             </outputmodes>
         </state>
 
+        <transition transition="de.intevation.flys.artifacts.transitions.ValueCompareTransition">
+            <from state="state.winfo.distance"/>
+            <to state="state.winfo.w_differences"/>
+            <condition data="calculation_mode" value="calc.w.differences" operator="equal"/>
+        </transition>
+
         <transition transition="de.intevation.flys.artifacts.transitions.DefaultTransition">
             <from state="state.winfo.distance"/>
             <to state="state.winfo.wq_adapted"/>
@@ -112,12 +118,6 @@
             <condition data="calculation_mode" value="calc.discharge.curve" operator="equal"/>
         </transition>
 
-        <transition transition="de.intevation.flys.artifacts.transitions.ValueCompareTransition">
-            <from state="state.winfo.location"/>
-            <to state="state.winfo.w_differences"/>
-            <condition data="calculation_mode" value="calc.w.differences" operator="equal"/>
-        </transition>
-
         <state id="state.winfo.wq" description="state.winfo.wq" state="de.intevation.flys.artifacts.states.WQSelect">
             <data name="wq_mode" type="String" />
             <data name="wq_free" type="Boolean" />
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WDifferencesState.java	Fri Sep 09 10:13:22 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WDifferencesState.java	Fri Sep 09 12:29:28 2011 +0000
@@ -74,18 +74,22 @@
             logger.warn("One of the artifacts (2) for diff calculation could not be loaded");
         }
         WKms wkms = null;
+        String facetName = "diff ()";
 
         if (flys1 != null && flys2 != null) {
+            // TODO also check size.
+            // TODO also need index of wqkms.
             WQKms[] minuend = (WQKms[]) flys1.getWaterlevelData().getData();
             WQKms[] subtrahend = (WQKms[]) flys2.getWaterlevelData().getData();
             wkms = WKmsOperation.SUBTRACTION.operate(minuend[0], subtrahend[0]);
+            facetName = "W ("+minuend[0].getName() + ") - W (" + subtrahend[0].getName()+")";
             logger.warn("Did a WKMSSubtraction");
         }
 
         if (facets != null) {
             // TODO: pass computetype and state id.
             //, ComputeType.ADVANCE, getID(), hash));
-            facets.add(new DataFacet(W_DIFFERENCES, "wdiff data"));
+            facets.add(new DataFacet(W_DIFFERENCES, facetName));
         }
         else {
             logger.debug("Not adding facets in WDifferencesState.");
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java	Fri Sep 09 10:13:22 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java	Fri Sep 09 12:29:28 2011 +0000
@@ -89,7 +89,7 @@
         }
 
         if (name.equals(W_DIFFERENCES)) {
-            doWDifferencesOut((WKms) f.getData(artifact, context), attr);
+            doWDifferencesOut((WKms) f.getData(artifact, context), f.getDescription(), attr);
         }
         else {
             logger.warn("Unknown facet name: " + name);
@@ -97,11 +97,11 @@
         }
     }
 
-
+    // TODO reenable inversion.
     /**
      * Add items to dataseries which describes the differences.
      */
-    protected void doWDifferencesOut(WKms wkms, Document theme) {
+    protected void doWDifferencesOut(WKms wkms, String seriesName, Document theme) {
         logger.debug("WDifferencesCurveGenerator.doWDifferencesOut");
         if (wkms == null) {
             logger.warn("No data to add to WDifferencesChart.");
@@ -109,8 +109,7 @@
         }
 
        int size = wkms.size();
-       // TODO get series name
-       XYSeries series = new StyledXYSeries(getSeriesName(wkms, "delta"), theme);
+       XYSeries series = new StyledXYSeries(seriesName, theme);
 
        if (logger.isDebugEnabled()) {
            if (wkms.size() > 0) {

http://dive4elements.wald.intevation.org