[PATCH] (issue1754) Handle the case if no radius is given

Wald Commits scm-commit at wald.intevation.org
Thu Apr 30 18:13:18 CEST 2015


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1430410395 -7200
# Node ID c0c162d7cb0e279dcc0f1849f497229aba2b9178
# Parent  bccc476e78ebd50d125e6d61ffe4156ce8af3ef3
(issue1754) Handle the case if no radius is given.

diff -r bccc476e78eb -r c0c162d7cb0e artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator2.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator2.java	Thu Apr 30 17:11:59 2015 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator2.java	Thu Apr 30 18:13:15 2015 +0200
@@ -108,9 +108,6 @@
     public static final String XPATH_CHART_Y_RANGE =
         "/art:action/art:attributes/art:yrange";
 
-    public static final String I18N_SUBTITLE_RADIUS =
-        "chart.subtitle.radius";
-
     /** The document of the incoming out() request.*/
     protected Document request;
 
@@ -660,16 +657,22 @@
     }
 
     protected String interpolateVariables(String s) {
+        log.debug("Interpolate variables in string '" + s + "'");
         Object radius = context.getContextValue("radius");
         if (radius instanceof Double) {
             NumberFormat f = Formatter.getCSVFormatter(context);
-            return s.replace("$RADIUS", f.format(radius));
+            s = s.replace("$RADIUS", f.format(radius) + " km");
         }
+        else {
+            s = s.replace("$RADIUS", "-");
+        }
+
         Object km = context.getContextValue(CURRENT_KM);
         if (km instanceof Number && s.contains("$KM")) {
             NumberFormat f = Formatter.getCalculationKm(context.getMeta());
-            return s.replace("$KM", f.format(km));
+            s = s.replace("$KM", f.format(km));
         }
+
         return s;
     }
 
diff -r bccc476e78eb -r c0c162d7cb0e artifacts/src/main/resources/messages.properties
--- a/artifacts/src/main/resources/messages.properties	Thu Apr 30 17:11:59 2015 +0200
+++ b/artifacts/src/main/resources/messages.properties	Thu Apr 30 18:13:15 2015 +0200
@@ -371,7 +371,7 @@
 chart.beddifference.year.title = Bedheight Difference
 chart.beddifference.yaxis.label.morph = Width [m]
 chart.beddifference.yaxis.label.heights = Absolute Height [{0}]
-chart.subtitle.radius = Width of sample window for moving average: {0} km
+chart.subtitle.radius = Width of sample window for moving average: {0}
 
 export.csv.header.km = km
 export.csv.header.year = year
diff -r bccc476e78eb -r c0c162d7cb0e artifacts/src/main/resources/messages_de.properties
--- a/artifacts/src/main/resources/messages_de.properties	Thu Apr 30 17:11:59 2015 +0200
+++ b/artifacts/src/main/resources/messages_de.properties	Thu Apr 30 18:13:15 2015 +0200
@@ -372,7 +372,7 @@
 chart.beddifference.year.title = Sohlh\u00f6hendifferenz
 chart.beddifference.yaxis.label.morph = Breite [m]
 chart.beddifference.yaxis.label.heights = Absolute H\u00f6he [m]
-chart.subtitle.radius = Fensterbreite f\u00fcr gleitenden Mittelwert: {0} km
+chart.subtitle.radius = Fensterbreite f\u00fcr gleitenden Mittelwert: {0}
 
 export.csv.header.km = km
 export.csv.header.year = Jahr
diff -r bccc476e78eb -r c0c162d7cb0e artifacts/src/main/resources/messages_de_DE.properties
--- a/artifacts/src/main/resources/messages_de_DE.properties	Thu Apr 30 17:11:59 2015 +0200
+++ b/artifacts/src/main/resources/messages_de_DE.properties	Thu Apr 30 18:13:15 2015 +0200
@@ -369,7 +369,7 @@
 chart.beddifference.year.title = Sohlh\u00f6hendifferenz
 chart.beddifference.yaxis.label.morph = Breite [m]
 chart.beddifference.yaxis.label.heights = Absolute H\u00f6he [{0}]
-chart.subtitle.radius = Fensterbreite f\u00fcr gleitenden Mittelwert: {0} km
+chart.subtitle.radius = Fensterbreite f\u00fcr gleitenden Mittelwert: {0}
 
 export.csv.header.km = km
 export.csv.header.year = Jahr
diff -r bccc476e78eb -r c0c162d7cb0e artifacts/src/main/resources/messages_en.properties
--- a/artifacts/src/main/resources/messages_en.properties	Thu Apr 30 17:11:59 2015 +0200
+++ b/artifacts/src/main/resources/messages_en.properties	Thu Apr 30 18:13:15 2015 +0200
@@ -373,7 +373,7 @@
 chart.beddifference.year.title = Bedheight Difference
 chart.beddifference.yaxis.label.morph = Width [m]
 chart.beddifference.yaxis.label.heights = Absolute Height [m]
-chart.subtitle.radius = Radius for weighted Average: {0} km
+chart.subtitle.radius = Width of sample window for moving average: {0}
 
 export.csv.header.km = km
 export.csv.header.year = year


More information about the Dive4Elements-commits mailing list