Mercurial > dive4elements > river
changeset 6234:02ea1c3fba8c
Fix export at river km's for issue1275
Rrenkert explained that the intention was to scale the
Waterlevels because they should be in centimeters at a gauge
and in meters otherwise.
This appears very strange to me and should be clarified.
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Fri, 07 Jun 2013 17:09:26 +0200 |
parents | a8613826bcac |
children | c2c5ac7c1743 |
files | artifacts/src/main/java/org/dive4elements/river/exports/ATExporter.java artifacts/src/main/java/org/dive4elements/river/exports/ATWriter.java |
diffstat | 2 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ATExporter.java Fri Jun 07 13:06:20 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/ATExporter.java Fri Jun 07 17:09:26 2013 +0200 @@ -111,7 +111,7 @@ gauge.getName(), gauge.getDatum(), interval.getStartTime(), - 100d); + false); } else { // at km @@ -123,7 +123,7 @@ null, null, null, - 0d); + true); } }
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ATWriter.java Fri Jun 07 13:06:20 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/ATWriter.java Fri Jun 07 17:09:26 2013 +0200 @@ -160,7 +160,7 @@ String gName, BigDecimal datum, Date date, - double scale) + boolean wOutUnitIsMeter) throws IOException { PrintWriter out = new PrintWriter(writer); @@ -186,7 +186,13 @@ int col = 0; for (double w = startW; w <= maxW; w += 0.01) { if (col == 0) { - out.printf(Locale.US, "%8d", (int)Math.round(w * scale)); + if (wOutUnitIsMeter) { + // For some crazy reason W's at a gauge should be in the + // unit but W's exported elsewhere should be in Meter + out.printf(Locale.US, "%5.2f", w); + } else { + out.printf(Locale.US, "%8d", (int)Math.round(w * 100d)); + } } if (w < minW) {