# HG changeset patch # User Sascha L. Teichmann # Date 1317911765 0 # Node ID 394b7ac58fc98a0fa36d568b800662f8f8e7a2f7 # Parent e5f7f25a511cf888780d6e88994563c176e4db9c ATWriter: Get rid of buggy first line code. flys-artifacts/trunk@2900 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r e5f7f25a511c -r 394b7ac58fc9 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Wed Oct 05 16:58:38 2011 +0000 +++ b/flys-artifacts/ChangeLog Thu Oct 06 14:36:05 2011 +0000 @@ -1,3 +1,8 @@ +2011-10-06 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/exports/ATWriter.java: Get rid + of buggy first line code. + 2011-10-05 Sascha L. Teichmann fixed flys/issue201 diff -r e5f7f25a511c -r 394b7ac58fc9 flys-artifacts/src/main/java/de/intevation/flys/exports/ATWriter.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ATWriter.java Wed Oct 05 16:58:38 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ATWriter.java Thu Oct 06 14:36:05 2011 +0000 @@ -128,27 +128,13 @@ // the first row. printHeader(out, meta, river, km); - double rest = Math.abs(minW % COLUMNS); + double rest = (minW * 100.0) % 10.0; - double startW = Math.round(minW*10.0)/10.0; - if (rest >= 1d) { - startW -= 0.1; - out.printf(Locale.US, "%8d", (int)Math.round(startW*100.0)); - int columns = (int)Math.floor(rest); - for (int i = columns; i < COLUMNS; ++i) { - out.print(EMPTY); - } - for (int i = COLUMNS-columns; i < COLUMNS; ++i) { - double w = startW + i*0.01; - if (w < minW) { - out.print(EMPTY); - } - else { - printQ(out, getQ(w)); - } - } - out.println(); - startW += 0.1; + double startW = Math.rint((minW - rest*0.01)*10.0)*0.1; + + if (logger.isDebugEnabled()) { + logger.debug("startW: " + startW); + logger.debug("rest: " + rest); } int col = 0; @@ -157,7 +143,12 @@ out.printf(Locale.US, "%8d", (int)Math.round(w*100.0)); } - printQ(out, getQ(w)); + if (w < minW) { + out.print(EMPTY); + } + else { + printQ(out, getQ(w)); + } if (++col >= COLUMNS) { out.println();