Mercurial > dive4elements > river
changeset 6244:8b03a7589101
Enhance WSPLGEN legend's class names (#767).
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Mon, 10 Jun 2013 13:43:53 +0200 |
parents | 9e4dc7f4d254 |
children | 54f1f4d90c72 |
files | artifacts/src/main/java/org/dive4elements/river/utils/ThemeUtil.java artifacts/src/main/resources/messages.properties artifacts/src/main/resources/messages_de.properties artifacts/src/main/resources/messages_de_DE.properties artifacts/src/main/resources/messages_en.properties |
diffstat | 5 files changed, 29 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- 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}); } }
--- 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.
--- 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.
--- 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.
--- 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.