diff artifacts/src/main/java/org/dive4elements/river/exports/WaterlevelExporter.java @ 6941:d322da01d862

(issue1451) Round Q's in the way it is done for AT's and localize KM
author Andre Heinecke <aheinecke@intevation.de>
date Thu, 29 Aug 2013 11:28:55 +0200
parents b1e66ea7fc2b
children 0a337f0005c2
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/WaterlevelExporter.java	Thu Aug 29 11:33:30 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/WaterlevelExporter.java	Thu Aug 29 11:28:55 2013 +0200
@@ -150,7 +150,7 @@
 
         super.init(request, out, context);
 
-        this.data = new ArrayList<WQKms[]>();
+        data = new ArrayList<WQKms[]>();
     }
 
 
@@ -594,12 +594,11 @@
         writer.writeNext(new String[] {
             kmf.format(wqkm[2]),
             wf.format(wqkm[0]),
-            qf.format(wqkm[1]),
+            qf.format(RiverUtils.roundQ(wqkm[1])),
             RiverUtils.getLocationDescription(flys, wqkm[2])
         });
     }
 
-
     /** Write an csv-row at gauge location. */
     private void writeRow6(CSVWriter writer, double wqkm[], String wOrQDesc,
         D4EArtifact flys, String gaugeName) {
@@ -610,7 +609,7 @@
         writer.writeNext(new String[] {
             kmf.format(wqkm[2]),
             wf.format(wqkm[0]),
-            qf.format(wqkm[1]),
+            qf.format(RiverUtils.roundQ(wqkm[1])),
             wOrQDesc,
             RiverUtils.getLocationDescription(flys, wqkm[2]),
             gaugeName
@@ -913,12 +912,14 @@
 
         Locale locale = Resources.getLocale(meta);
         DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, locale);
+        NumberFormat kmf = getKmFormatter();
 
         source.addMetaData("date", df.format(new Date()));
 
         RangeAccess rangeAccess = new RangeAccess(flys);
         double[] kms = rangeAccess.getKmRange();
-        source.addMetaData("range", kms[0] + " - " + kms[kms.length-1]);
+        source.addMetaData("range",
+                kmf.format(kms[0]) + " - " + kmf.format(kms[kms.length-1]));
 
         source.addMetaData("gauge", RiverUtils.getGaugename(flys));
 
@@ -969,7 +970,7 @@
                 source.addData(new String[] {
                     kmf.format(result[2]),
                     wf.format(result[0]),
-                    qf.format(result[1]),
+                    qf.format(RiverUtils.roundQ(result[1])),
                     desc,
                     RiverUtils.getLocationDescription(flys, result[2]),
                     result[2] >= a && result[2] <= b
@@ -981,7 +982,7 @@
                 source.addData(new String[] {
                     kmf.format(result[2]),
                     wf.format(result[0]),
-                    qf.format(result[1]),
+                    qf.format(RiverUtils.roundQ(result[1])),
                     desc,
                     RiverUtils.getLocationDescription(flys, result[2]),
                     result[2] >= a && result[2] <= b

http://dive4elements.wald.intevation.org