diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WDifferencesState.java @ 1173:2490d6ef394e

Extended WDifferences bracnh of WINFO to have calculation in dedicated, new state. flys-artifacts/trunk@2753 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 15 Sep 2011 07:39:36 +0000
parents 9bdf738abbad
children 9c1cda9e2bc4
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WDifferencesState.java	Wed Sep 14 14:58:06 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WDifferencesState.java	Thu Sep 15 07:39:36 2011 +0000
@@ -18,9 +18,11 @@
 import de.intevation.flys.artifacts.model.WQKms;
 
 import de.intevation.flys.artifacts.model.DataFacet;
+import de.intevation.flys.artifacts.model.WaterlevelFacet;
 
 import de.intevation.flys.utils.FLYSUtils;
 
+//import net.sf.json.JSONObject;
 
 public class WDifferencesState
 extends      DefaultState
@@ -29,14 +31,15 @@
     /** The logger that is used in this state. */
     private static Logger logger = Logger.getLogger(WDifferencesState.class);
 
+
     public WDifferencesState() {
     }
 
 
-    /** Specify to display a datacage_twin_panel. */
+    /** Specify to display nothing (this is kind of a "final" state). */
     @Override
     protected String getUIProvider() {
-        return "datacage_twin_panel";
+        return "noinput";
     }
 
 
@@ -49,6 +52,7 @@
         Object       old
     ) {
         WINFOArtifact winfo = (WINFOArtifact)artifact;
+        String id = getID();
 
         // Get a data item (uuids) or parameterization of the respective
         // artifacts.
@@ -79,6 +83,16 @@
             wkms = WKmsOperation.SUBTRACTION.operate(minuend[0], subtrahend[0]);
             facetName = "W ("+minuend[0].getName() + ") - W (" + subtrahend[0].getName()+")";
             logger.warn("Did a WKMSSubtraction");
+            // Add these datasets also as facets.
+            // TODO Store parameterization.
+            // Therefore need: getKmRange, getQs, getRiver, eventually getWs
+            Facet minuendAbsFacet = new WaterlevelFacet(0, LONGITUDINAL_W,
+                "Minuend: W (_todo_)", ComputeType.ADVANCE, id, hash);
+            Facet subtrahendAbsFacet = new WaterlevelFacet(1, LONGITUDINAL_W,
+                "Subtrahend: W (_todo_)", ComputeType.ADVANCE, id, hash);
+            //JSONObject jsonObject = new JSONObject().accumulate("string", 2.0f);
+            //facets.add(minuendAbsFacet);
+            //facets.add(subtrahendAbsFacet);
         }
 
         if (facets != null) {

http://dive4elements.wald.intevation.org