changeset 3444:f903f1e5aed6

Preparing W/Q per gauge input for FixationArtifact. flys-artifacts/trunk@5107 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Mon, 23 Jul 2012 15:08:28 +0000
parents ee2ae91c96e5
children b6c301cb3871
files flys-artifacts/ChangeLog flys-artifacts/doc/conf/artifacts/fixanalysis.xml flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java
diffstat 4 files changed, 55 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Mon Jul 23 14:58:04 2012 +0000
+++ b/flys-artifacts/ChangeLog	Mon Jul 23 15:08:28 2012 +0000
@@ -1,3 +1,18 @@
+2012-07-23	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Towards per-Gauge-input of W/Q values for FixationArtifact.
+
+	* src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java,
+	  src/main/java/de/intevation/flys/utils/FLYSUtils.java:
+	  (getGauges): Refactored, moved from WINFOArtifact to FLYSUtils.
+	
+	* src/main/java/de/intevation/flys/utils/FLYSUtils.java:
+	  Handle unlucky differences in names of data for
+	  WINFOArtifact/FixationArtifact.
+	
+	* doc/conf/artifacts/fixanalysis.xml:
+	  (Re-)use WQAdapted State for fix.analysis.
+
 2012-07-23	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	* doc/conf/artifacts/winfo.xml,
--- a/flys-artifacts/doc/conf/artifacts/fixanalysis.xml	Mon Jul 23 14:58:04 2012 +0000
+++ b/flys-artifacts/doc/conf/artifacts/fixanalysis.xml	Mon Jul 23 15:08:28 2012 +0000
@@ -210,8 +210,9 @@
         </transition>
 
         <state id="state.fix.vollmer.qs" description="state.fix.vollmer.qs"
-            state="de.intevation.flys.artifacts.states.fixation.QSelect">
-            <data name="qs" type="Double[]"/>
+            state="de.intevation.flys.artifacts.states.WQAdapted">
+            <data name="wq_isq"   type="String" />
+            <data name="wq_values" type="WQTriple" />
         </state>
 
         <transition transition="de.intevation.flys.artifacts.transitions.DefaultTransition">
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Mon Jul 23 14:58:04 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Mon Jul 23 15:08:28 2012 +0000
@@ -530,7 +530,7 @@
             logger.warn("no wq_values given");
             return Collections.emptyList();
         }
-        String input = (String)wqValues.getValue();
+        String input = (String) wqValues.getValue();
         if (input == null || (input = input.trim()).length() == 0) {
             logger.warn("wq_values are empty");
             return Collections.emptyList();
@@ -888,25 +888,6 @@
     }
 
 
-    /**
-     * Returns the gauges that match the selected kilometer range.
-     *
-     * @return the gauges based on the selected kilometer range.
-     */
-    public List<Gauge> getGauges() {
-
-        River river = FLYSUtils.getRiver(this);
-        if (river == null) {
-            return null;
-        }
-
-        double [] dist = FLYSUtils.getKmRange(this);
-        if (dist == null) {
-            return null;
-        }
-
-        return river.determineGauges(dist[0], dist[1]);
-    }
 
 
     /**
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java	Mon Jul 23 14:58:04 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java	Mon Jul 23 15:08:28 2012 +0000
@@ -179,7 +179,7 @@
         }
 
         String values = flys.getDataAsString("wq_values");
-        Boolean isQ    = flys.getDataAsBoolean("wq_isq");
+        Boolean isQ   = flys.getDataAsBoolean("wq_isq");
 
         if (values != null) {
             return isQ ? WQ_MODE.QGAUGE : WQ_MODE.WGAUGE;
@@ -296,6 +296,14 @@
         String strFrom = flys.getDataAsString("ld_from");
         String strTo   = flys.getDataAsString("ld_to");
 
+        if (strFrom == null) {
+            strFrom = flys.getDataAsString("from");
+        }
+
+        if (strTo == null) {
+            strTo = flys.getDataAsString("to");
+        }
+
         if (strFrom == null || strTo == null) {
             return null;
         }
@@ -891,5 +899,32 @@
 
         return doubles.toNativeArray();
     }
+
+
+    /**
+     * Returns the gauges that match the selected kilometer range.
+     *
+     * @param flys the flys artifact.
+     *
+     * @return the gauges based on the selected kilometer range (null if
+     *         none/no range set).
+     */
+    public static List<Gauge> getGauges(FLYSArtifact flys) {
+
+        River river = getRiver(flys);
+        if (river == null) {
+            logger.debug("getGauges: no river!");
+            return null;
+        }
+
+        double [] dist = getKmRange(flys);
+        if (dist == null) {
+            logger.debug("getGauges: no dist!");
+            return null;
+        }
+        logger.debug("getGauges: " + dist[0] + " - " + dist[1]);
+
+        return river.determineGauges(dist[0], dist[1]);
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org