# HG changeset patch # User Sascha L. Teichmann # Date 1305798897 0 # Node ID 7137ef65c17c8c7b8e720c9fd312cc8e80199953 # Parent 2c0c22e0935daebe0dc01643f501c584061eaae1 Reintroduced titles for the "W for unausgeglichene Abfluesse". flys-artifacts/trunk@1952 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 2c0c22e0935d -r 7137ef65c17c flys-artifacts/ChangeLog --- 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 + + * 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 * src/main/java/de/intevation/flys/exports/DischargeCurveGenerator.java: diff -r 2c0c22e0935d -r 7137ef65c17c flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.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. diff -r 2c0c22e0935d -r 7137ef65c17c flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java --- 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 r 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 :