changeset 1682:394b7ac58fc9

ATWriter: Get rid of buggy first line code. flys-artifacts/trunk@2900 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 06 Oct 2011 14:36:05 +0000
parents e5f7f25a511c
children acb4d20b130e
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/ATWriter.java
diffstat 2 files changed, 17 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- 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	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/ATWriter.java: Get rid
+	  of buggy first line code.
+
 2011-10-05	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	fixed flys/issue201
--- 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();

http://dive4elements.wald.intevation.org