# HG changeset patch # User Sascha L. Teichmann # Date 1329155344 0 # Node ID 64dd65aa620dea64dfda47d4801127540e0edb12 # Parent b5f5af53a5262d9b6f409fa513778f2276621229 Partial fix for flys/issue499 flys-artifacts/trunk@4046 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r b5f5af53a526 -r 64dd65aa620d flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Mon Feb 13 17:48:14 2012 +0000 +++ b/flys-artifacts/ChangeLog Mon Feb 13 17:49:04 2012 +0000 @@ -1,3 +1,19 @@ +2012-02-13 Sascha L. Teichmann + + Partial fix for flys/issue499 (Wasserspiegellagen: Berechnung für W frei und Pegel kaputt) + There are still validation issue in the client. + + * src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java: + Fixed state evaluation for "W auf freier Strecke"/"W am Pegel". + There is still an issue in the client with the input validation + which prevents entering the right W values for + "W auf freier Strecke". :-/ + +2012-02-13 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/exports/XYChartGenerator.java: + Make it compilable again. + 2012-02-13 Felix Wolfsteller Partial Fix flys/issue500: text-backgrounds for manual points. diff -r b5f5af53a526 -r 64dd65aa620d flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java Mon Feb 13 17:48:14 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java Mon Feb 13 17:49:04 2012 +0000 @@ -369,7 +369,7 @@ qSel = false; ws = getWs(); double [][] qws = getQsForWs(ws); - if (qws == null) { + if (qws == null || qws.length == 0) { return error(new WQKms[0], "converting.ws.to.qs.failed"); } qs = qws[0]; @@ -729,7 +729,7 @@ String input = (String) sd.getValue(); - if (input == null | (input = input.trim()).length() == 0) { + if (input == null || (input = input.trim()).length() == 0) { logger.warn("reference end string is empty."); return null; } @@ -849,6 +849,11 @@ */ public double [][] getQsForWs(double[] ws) { + if (ws == null) { + logger.error("getQsForWs: ws == null"); + return null; + } + boolean debug = logger.isDebugEnabled(); if (debug) { @@ -868,6 +873,7 @@ } if (isFreeW()) { + logger.debug("Bezugslinienverfahren I: W auf freier Strecke"); // The simple case of the "Bezugslinienverfahren" // "W auf freier Strecke". WstValueTable wst = WstValueTableFactory.getTable(r); @@ -883,8 +889,12 @@ boolean generatedWs = false; for (int i = 0; i < ws.length; ++i) { + double w = ws[i]; + if (debug) { + logger.debug("getQsForWs: lookup Q for W: " + w); + } // There could bemore than one Q per W. - double [] qs = wst.findQsForW(km, ws[i]); + double [] qs = wst.findQsForW(km, w); for (int j = 0; j < qs.length; ++j) { outWs.add(ws[i]); outQs.add(qs[j]); @@ -892,6 +902,10 @@ generatedWs |= qs.length != 1; } + if (debug) { + logger.debug("getQsForWs: number of Qs: " + outQs.size()); + } + return new double [][] { outQs.toNativeArray(), generatedWs ? outWs.toNativeArray() : null }; @@ -917,14 +931,31 @@ double[][] values = tmp.get(g.getName()); double[] qs = new double[ws.length]; + TDoubleArrayList wsOut = new TDoubleArrayList(ws.length); + TDoubleArrayList qsOut = new TDoubleArrayList(ws.length); + for (int i = 0; i < ws.length; i++) { - qs[i] = dt.getQForW(values, ws[i]); + if (Double.isNaN(ws[i])) { + logger.warn("W is NaN: ignored"); + continue; + } + double w = ws[i] / 100.0; + double q = dt.getQForW(values, w); + if (Double.isNaN(q)) { + logger.warn("No Q found for W = " + ws[i]); + continue; + } + wsOut.add(w); + qsOut.add(q); if (debug) { - logger.debug("w: " + ws[i] + " -> q: " + qs[i]); + logger.debug("w: " + w + " -> q: " + q); } } - return new double [][] { qs, null }; + return new double [][] { + qsOut.toNativeArray(), + wsOut.toNativeArray() + }; } @@ -1104,7 +1135,7 @@ public boolean isFreeW() { StateData mode = getData("wq_mode"); - return mode != null && mode.getValue().equals("FREEW"); + return mode != null && mode.getValue().equals("WFREE"); } @@ -1181,7 +1212,7 @@ String mode = (dMode != null) ? (String) dMode.getValue() : ""; - if (mode.equals("W")) { + if (mode.equals("W") || mode.equals("WFREE")) { if (dSingle != null) { return getSingleWQValues(); }