[Dive4elements-commits] [PATCH] Enhance WSPLGEN legend's class names (#767)
Wald Commits
scm-commit at wald.intevation.org
Mon Jun 10 13:44:00 CEST 2013
# HG changeset patch
# User Christian Lins <christian.lins at intevation.de>
# Date 1370864633 -7200
# Node ID 8b03a7589101769ec485f878f38a2c70e71a6130
# Parent 9e4dc7f4d25414c73bf20ffd9d4790c489d395de
Enhance WSPLGEN legend's class names (#767).
diff -r 9e4dc7f4d254 -r 8b03a7589101 artifacts/src/main/java/org/dive4elements/river/utils/ThemeUtil.java
--- a/artifacts/src/main/java/org/dive4elements/river/utils/ThemeUtil.java Mon Jun 10 13:06:30 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/utils/ThemeUtil.java Mon Jun 10 13:43:53 2013 +0200
@@ -19,8 +19,6 @@
import java.awt.Color;
import java.awt.Font;
-import java.text.NumberFormat;
-import java.util.Locale;
import org.apache.log4j.Logger;
import org.w3c.dom.Document;
@@ -35,6 +33,10 @@
private static Logger logger =
Logger.getLogger(ThemeUtil.class);
+ private static final String MSG_ISOBATH_CLASS = "floodmap.isobath.class";
+
+ private static final String MSG_ISOBATH_LASTCLASS = "floodmap.isobath.lastclass";
+
public final static String XPATH_FILL_COLOR =
"/theme/field[@name='fillcolor']/@default";
@@ -731,20 +733,27 @@
}
}
- // FIXME: i18n
+ /**
+ * Creates a class name for the mapfile style that visualizes a floodmap.
+ * The class names are used in the map's legend.
+ *
+ * @param val Current isobath value.
+ * @param step Difference between to class values.
+ * @param idx Current class index that is being processed.
+ * @param maxIdx Highest class index.
+ * @param meta Caller meta object used to determine locale.
+ * @return
+ */
protected static String createWSPLGENClassName(float val, float step, int idx, int maxIdx, CallMeta meta) {
- Locale locale = Resources.getLocale(meta);
- NumberFormat nf = NumberFormat.getInstance(locale);
+ assert meta != null : "CallMeta instance is null";
+
if (idx < maxIdx) {
- return "[Differenz] >= "
- + nf.format(val)
- + " m UND [Differenz] < "
- + nf.format(val + step)
- + " m";
+ return Resources.getMsg(meta, MSG_ISOBATH_CLASS,
+ new Object[] {val, val + step});
}
else {
- return "[Differenz] >= "
- + nf.format(val) + " m";
+ return Resources.getMsg(meta, MSG_ISOBATH_LASTCLASS,
+ new Object[] {val});
}
}
diff -r 9e4dc7f4d254 -r 8b03a7589101 artifacts/src/main/resources/messages.properties
--- a/artifacts/src/main/resources/messages.properties Mon Jun 10 13:06:30 2013 +0200
+++ b/artifacts/src/main/resources/messages.properties Mon Jun 10 13:43:53 2013 +0200
@@ -422,6 +422,8 @@
floodmap.fixpoints = Fixpoints
floodmap.floodmaps = Floodmaps
floodmap.usershape = User data
+floodmap.isobath.class = {0,number,#.#} m to {1,number,#.#} m
+floodmap.isobath.lastclass = greater {0,number,#.#} m
wsplgen.job.queued = WSPLGEN job in queue.
wsplgen.job.error = An unexpected error while starting WSPLGEN occured.
diff -r 9e4dc7f4d254 -r 8b03a7589101 artifacts/src/main/resources/messages_de.properties
--- a/artifacts/src/main/resources/messages_de.properties Mon Jun 10 13:06:30 2013 +0200
+++ b/artifacts/src/main/resources/messages_de.properties Mon Jun 10 13:43:53 2013 +0200
@@ -423,6 +423,8 @@
floodmap.fixpoints = Festpunkte
floodmap.floodmaps = \u00dcberschwemmungsfl\u00e4che
floodmap.usershape = Benutzerdaten
+floodmap.isobath.class = {0,number,#.#} m bis {1,number,#.#} m
+floodmap.isobath.lastclass = gr\u00f6\u00dfer {0,number,#.#} m
wsplgen.job.queued = WSPLGEN Berechnung befindet sich in Warteschlange.
wsplgen.job.error = Ein unerwarteter Fehler beim Starten von WSPLGEN ist aufgetreten.
diff -r 9e4dc7f4d254 -r 8b03a7589101 artifacts/src/main/resources/messages_de_DE.properties
--- a/artifacts/src/main/resources/messages_de_DE.properties Mon Jun 10 13:06:30 2013 +0200
+++ b/artifacts/src/main/resources/messages_de_DE.properties Mon Jun 10 13:43:53 2013 +0200
@@ -419,6 +419,8 @@
floodmap.fixpoints = Festpunkte
floodmap.floodmaps = \u00dcberschwemmungsfl\u00e4che
floodmap.usershape = Benutzerdaten
+floodmap.isobath.class = {0,number,#.#} m bis {1,number,#.#} m
+floodmap.isobath.lastclass = gr\u00f6\u00dfer {0,number,#.#} m
wsplgen.job.queued = WSPLGEN Berechnung befindet sich in Warteschlange.
wsplgen.job.error = Ein unerwarteter Fehler beim Starten von WSPLGEN ist aufgetreten.
diff -r 9e4dc7f4d254 -r 8b03a7589101 artifacts/src/main/resources/messages_en.properties
--- a/artifacts/src/main/resources/messages_en.properties Mon Jun 10 13:06:30 2013 +0200
+++ b/artifacts/src/main/resources/messages_en.properties Mon Jun 10 13:43:53 2013 +0200
@@ -424,6 +424,8 @@
floodmap.fixpoints = Fixpoints
floodmap.floodmaps = Floodmaps
floodmap.usershape = User data
+floodmap.isobath.class = {0,number,#.#} m to {1,number,#.#} m
+floodmap.isobath.lastclass = greater {0,number,#.#} m
wsplgen.job.queued = WSPLGEN job in queue.
wsplgen.job.error = An unexpected error while starting WSPLGEN occured.
More information about the Dive4elements-commits
mailing list