[Dive4elements-commits] [PATCH 2 of 4] ExtremeCompute: Generate LS-Facets

Wald Commits scm-commit at wald.intevation.org
Mon Oct 29 13:44:05 CET 2012


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1351514799 -3600
# Node ID ce10b846bc86696523953bc020bbe21a3b1ea860
# Parent  1f304cb5729bc2448234d4e27effd4d8bf51a920
ExtremeCompute: Generate LS-Facets.

diff -r 1f304cb5729b -r ce10b846bc86 flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeCompute.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeCompute.java	Mon Oct 29 13:46:19 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeCompute.java	Mon Oct 29 13:46:39 2012 +0100
@@ -8,13 +8,20 @@
 
 import de.intevation.flys.artifacts.access.ExtremeAccess;
 
+import de.intevation.flys.artifacts.model.Calculation;
 import de.intevation.flys.artifacts.model.CalculationResult;
+import de.intevation.flys.artifacts.model.FacetTypes;
 import de.intevation.flys.artifacts.model.ReportFacet;
+import de.intevation.flys.artifacts.model.WaterlevelFacet;
+import de.intevation.flys.artifacts.model.WQKms;
 
 import de.intevation.flys.artifacts.model.extreme.ExtremeCalculation;
+import de.intevation.flys.artifacts.model.extreme.ExtremeResult;
 
 import de.intevation.flys.artifacts.states.DefaultState;
 
+import de.intevation.flys.utils.FLYSUtils;
+
 import java.util.List;
 
 import org.apache.log4j.Logger;
@@ -22,6 +29,7 @@
 /** State in which to deliver extreme value analysis result. */
 public class ExtremeCompute
 extends      DefaultState
+implements   FacetTypes
 {
     /** Private logger. */
     private static Logger logger = Logger.getLogger(ExtremeCompute.class);
@@ -59,7 +67,41 @@
             facets.add(new ReportFacet());
         }
 
-        // TODO: Add more facets.
+        ExtremeResult eres = (ExtremeResult) res.getData();
+        WQKms [] wqkms = (WQKms []) eres.getWQKms();
+
+        if (wqkms == null) {
+            logger.error("No computation result!");
+        }
+
+        for (int i = 0; i < wqkms.length; i++) {
+            String name = wqkms[i].getName();
+
+            // Ext.Calc has wqkmsName(i)
+            String nameW = "WW";//TODO: FLYSUtils.createWspWTitle(artifact, context, name);
+            String nameQ = "QQ";//FLYSUtils.createWspQTitle(artifact, context, name);
+
+            // Hotfix for theme names. Themes with the same name cause problems
+            // aggregating chart legend items.
+            if (i > 0 && name.equals(wqkms[i - 1].getName())) {
+                nameW += "; Q=" + wqkms[i].get(0, new double[3])[1];
+                nameQ += " = " + wqkms[i].get(0, new double[3])[1];
+            }
+
+            Facet w = new WaterlevelFacet(
+                i, LONGITUDINAL_W, nameW, ComputeType.ADVANCE, id, hash);
+            Facet q = new WaterlevelFacet(
+                i, LONGITUDINAL_Q, nameQ, ComputeType.ADVANCE, id, hash);
+
+            // TODO add more facets like:
+            // csv, data, pdf wst facet
+            // furthermore, waterlevel
+            //facets.add(new CrossSectionWaterLineFacet(i, nameW));
+
+            facets.add(w);
+            facets.add(q);
+        }
+
 
         return res;
     }


More information about the Dive4elements-commits mailing list