[Dive4elements-commits] [PATCH] Fix flys/issue1228: Units in tabular calculation output

Wald Commits scm-commit at wald.intevation.org
Thu Feb 28 12:30:00 CET 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1362051427 -3600
# Node ID 8e52b4829cd1f5a83911341baba3e58f9d744c12
# Parent  c2b377bcc025da9af75744a17b2bf5bd1c7f2e68
Fix flys/issue1228: Units in tabular calculation output.

diff -r c2b377bcc025 -r 8e52b4829cd1 flys-artifacts/src/main/java/de/intevation/flys/exports/AbstractExporter.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/AbstractExporter.java	Thu Feb 28 12:26:02 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/AbstractExporter.java	Thu Feb 28 12:37:07 2013 +0100
@@ -246,6 +246,10 @@
         return Resources.getMsg(context.getMeta(), key, def);
     }
 
+    protected String msg(String key, String def, Object[] args) {
+        return Resources.getMsg(context.getMeta(), key, def, args);
+    }
+
 
     /**
      * This method starts CSV creation. It makes use of writeCSVData() which has
diff -r c2b377bcc025 -r 8e52b4829cd1 flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java	Thu Feb 28 12:26:02 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java	Thu Feb 28 12:37:07 2013 +0100
@@ -426,10 +426,12 @@
     ) {
         logger.info("WaterlevelExporter.writeCSVHeader");
 
+        String unit = FLYSUtils.getRiver((FLYSArtifact) master).getWstUnit().getName();
+
         if (atGauge) {
             writer.writeNext(new String[] {
                 msg(CSV_KM_HEADER, DEFAULT_CSV_KM_HEADER),
-                msg(CSV_W_HEADER, DEFAULT_CSV_W_HEADER),
+                msg(CSV_W_HEADER, DEFAULT_CSV_W_HEADER, new Object[] { unit }),
                 msg(CSV_Q_HEADER, DEFAULT_CSV_Q_HEADER),
                 (isQ
                     ? msg(CSV_Q_DESC_HEADER, DEFAULT_CSV_Q_DESC_HEADER)
@@ -441,7 +443,8 @@
         else {
             writer.writeNext(new String[] {
                 msg(CSV_KM_HEADER, DEFAULT_CSV_KM_HEADER),
-                msg(CSV_W_HEADER, DEFAULT_CSV_W_HEADER),
+                    // TODO flys/issue1128 (unit per river)
+                msg(CSV_W_HEADER, DEFAULT_CSV_W_HEADER, new Object[] { unit }),
                 msg(CSV_Q_HEADER, DEFAULT_CSV_Q_HEADER),
                 msg(CSV_LOCATION_HEADER, DEFAULT_CSV_LOCATION_HEADER)
             });
diff -r c2b377bcc025 -r 8e52b4829cd1 flys-artifacts/src/main/resources/messages.properties
--- a/flys-artifacts/src/main/resources/messages.properties	Thu Feb 28 12:26:02 2013 +0100
+++ b/flys-artifacts/src/main/resources/messages.properties	Thu Feb 28 12:37:07 2013 +0100
@@ -301,7 +301,7 @@
 
 
 export.waterlevel.csv.header.km = River-Km
-export.waterlevel.csv.header.w = W [NN + m]
+export.waterlevel.csv.header.w = W [{0}]
 export.waterlevel.csv.header.q = Q [m\u00b3/s]
 export.waterlevel.csv.header.q.desc = Description
 export.waterlevel.csv.header.location = Location
diff -r c2b377bcc025 -r 8e52b4829cd1 flys-artifacts/src/main/resources/messages_de.properties
--- a/flys-artifacts/src/main/resources/messages_de.properties	Thu Feb 28 12:26:02 2013 +0100
+++ b/flys-artifacts/src/main/resources/messages_de.properties	Thu Feb 28 12:37:07 2013 +0100
@@ -291,7 +291,7 @@
 chart.beddifference.yaxis.label.heights = Absolute H\u00f6he [m]
 
 export.waterlevel.csv.header.km = Fluss-Km
-export.waterlevel.csv.header.w = W [NN + m]
+export.waterlevel.csv.header.w = W [{0}]
 export.waterlevel.csv.header.q = Q [m\u00b3/s]
 export.waterlevel.csv.header.q.desc = Bezeichnung
 export.waterlevel.csv.header.location = Lage
diff -r c2b377bcc025 -r 8e52b4829cd1 flys-artifacts/src/main/resources/messages_de_DE.properties
--- a/flys-artifacts/src/main/resources/messages_de_DE.properties	Thu Feb 28 12:26:02 2013 +0100
+++ b/flys-artifacts/src/main/resources/messages_de_DE.properties	Thu Feb 28 12:37:07 2013 +0100
@@ -300,7 +300,7 @@
 chart.beddifference.yaxis.label.heights = Absolute H\u00f6he [m]
 
 export.waterlevel.csv.header.km = Fluss-Km
-export.waterlevel.csv.header.w = W [NN + m]
+export.waterlevel.csv.header.w = W [{0}]
 export.waterlevel.csv.header.q = Q [m\u00b3/s]
 export.waterlevel.csv.header.q.desc = Bezeichnung
 export.waterlevel.csv.header.location = Lage
diff -r c2b377bcc025 -r 8e52b4829cd1 flys-artifacts/src/main/resources/messages_en.properties
--- a/flys-artifacts/src/main/resources/messages_en.properties	Thu Feb 28 12:26:02 2013 +0100
+++ b/flys-artifacts/src/main/resources/messages_en.properties	Thu Feb 28 12:37:07 2013 +0100
@@ -303,7 +303,7 @@
 chart.beddifference.yaxis.label.heights = Absolute Height [m]
 
 export.waterlevel.csv.header.km = River-Km
-export.waterlevel.csv.header.w = W [NN + m]
+export.waterlevel.csv.header.w = W [{0}]
 export.waterlevel.csv.header.q = Q [m\u00b3/s]
 export.waterlevel.csv.header.q.desc = Description
 export.waterlevel.csv.header.location = Location


More information about the Dive4elements-commits mailing list