changeset 455:7137ef65c17c

Reintroduced titles for the "W for unausgeglichene Abfluesse". flys-artifacts/trunk@1952 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 19 May 2011 09:54:57 +0000
parents 2c0c22e0935d
children af1b64ec7250
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java
diffstat 3 files changed, 37 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Thu May 19 09:45:29 2011 +0000
+++ b/flys-artifacts/ChangeLog	Thu May 19 09:54:57 2011 +0000
@@ -1,3 +1,12 @@
+2011-05-19	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java:
+	  Added convenience method isQ() to determine if we are
+	  doing Q calculations.
+
+	* src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java:
+	  Reintroduced titles for the "W for unausgeglichene Abfluesse".
+
 2011-05-19  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/exports/DischargeCurveGenerator.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java	Thu May 19 09:45:29 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java	Thu May 19 09:54:57 2011 +0000
@@ -673,6 +673,11 @@
         }
     }
 
+    public boolean isQ() {
+        StateData mode = getData("wq_mode");
+        return mode != null && mode.getValue().equals("Q");
+    }
+
 
     /**
      * Returns the Q values based on a specified kilometer range.
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Thu May 19 09:45:29 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Thu May 19 09:54:57 2011 +0000
@@ -628,9 +628,12 @@
                 results.add(new WQKms(okms, oqs, ows));
             }
         }
-        // TODO: set names
 
-        return results.toArray(new WQKms[results.size()]);
+        WQKms [] wqkms = results.toArray(new WQKms[results.size()]);
+
+        setDischargeLongitudinalSectionNames(wqkms, iqs, isQ() ? "Q" : "W");
+
+        return wqkms;
     }
 
     protected static String joinDoubles(double [] x) {
@@ -659,40 +662,31 @@
     /**
      * Sets the name for discharge longitudinal section curves where each WQKms
      * in <i>r</i> represents a column.
-     *
-     * @param wqkms A longitudinal section curve.
-     * @param allValues The input values of the computations.
-     * @param col The requested column in the table of Ws or Qs.
-     * @param wq The WQ mode - can be one of "W" or "Q".
      */
     public static void setDischargeLongitudinalSectionNames(
-        WQKms      wqkms,
-        double[][] allValues,
-        int        col,
-        String     wq)
-    {
+        WQKms  []   wqkms,
+        double [][] iqs,
+        String      wq
+    ) {
         logger.debug("WINFOArtifact.setDischargeLongitudinalSectionNames");
 
-        StringBuilder sb = new StringBuilder(" (");
-        boolean    first = true;
-
-        int rows = allValues.length;
-
-        for (int i = 0; i < rows; i++) {
-            double[] values = allValues[i];
+        // TODO: I18N
 
-            if (!first) {
-                sb.append("; ");
-            }
-
-            sb.append(Double.toString(values[col]));
+        for (int j = 0; j < wqkms.length; ++j) {
+            StringBuilder sb = new StringBuilder(wq)
+                .append(" benutzerdefiniert (");
 
-            first = false;
-        }
+            double [] iqsi = iqs[j];
+            for (int i = 0; i < iqsi.length; i++) {
+                if (i > 0) {
+                    sb.append("; ");
+                }
+                sb.append(iqsi[i]);
+            }
+            sb.append(")");
 
-        sb.append(")");
-
-        wqkms.setName(wq + " Benutzerdefiniert" + sb.toString());
+            wqkms[j].setName(sb.toString());
+        }
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org