# HG changeset patch # User Felix Wolfsteller # Date 1336035379 0 # Node ID 33d61e2a49a23038b892b80245b80ddb7bc86a17 # Parent bdc86e61428cd1389a6df262700dc4188bdbda81 Added and respect two new properties of waterlevels in cross-sections. flys-artifacts/trunk@4339 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r bdc86e61428c -r 33d61e2a49a2 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Thu May 03 07:48:12 2012 +0000 +++ b/flys-artifacts/ChangeLog Thu May 03 08:56:19 2012 +0000 @@ -1,3 +1,13 @@ +2012-05-03 Felix Wolfsteller + + * doc/conf/themes.xml: Add two new options for waterlevel label in cs. + + * src/main/java/de/intevation/flys/utils/ThemeUtil.java: + Parse new theme properties. + + * src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java: + Adjust label according to chosen properties. + 2012-05-03 Felix Wolfsteller * src/main/java/de/intevation/flys/utils/ThemeUtil.java diff -r bdc86e61428c -r 33d61e2a49a2 flys-artifacts/doc/conf/themes.xml --- a/flys-artifacts/doc/conf/themes.xml Thu May 03 07:48:12 2012 +0000 +++ b/flys-artifacts/doc/conf/themes.xml Thu May 03 08:56:19 2012 +0000 @@ -585,6 +585,8 @@ + + diff -r bdc86e61428c -r 33d61e2a49a2 flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java Thu May 03 07:48:12 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java Thu May 03 08:56:19 2012 +0000 @@ -25,6 +25,8 @@ import de.intevation.flys.geom.Lines; +import de.intevation.flys.utils.ThemeUtil; + /** * An OutGenerator that generates cross section graphs. @@ -221,9 +223,20 @@ Lines.LineData lines = (Lines.LineData) o; // DO NOT SORT DATA! This destroys the gaps indicated by NaNs StyledXYSeries series = new StyledXYSeries(seriesName, false, theme); - // TODO Label for line with infos if wished. - series.setLabel(series.getLabel() + lines.width); + // TODO i18n for all the label text and number format. + if (ThemeUtil.parseShowWidth(theme)) { + series.setLabel(series.getLabel() + ", b=" + lines.width + "m"); + } + else { + // Do not modify. + //series.setLabel(series.getLabel()); + } + if (ThemeUtil.parseShowLevel(theme) && lines.points.length >0 && lines.points[1].length > 0) { + series.setLabel(series.getLabel() + ", W=" + lines.points[1][0] + "NN+m"); + } + // TODO Missing: "mittlere hoehe" (and area but this geos to + // the area theme). StyledSeriesBuilder.addPoints(series, lines.points); diff -r bdc86e61428c -r 33d61e2a49a2 flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java --- a/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java Thu May 03 07:48:12 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java Thu May 03 08:56:19 2012 +0000 @@ -73,6 +73,12 @@ public final static String XPATH_LINE_LABEL_SHOWBG = "/theme/field[@name='linelabelshowbg']/@default"; + public final static String XPATH_SHOW_WIDTH = + "/theme/field[@name='showwidth']/@default"; + + public final static String XPATH_SHOW_LEVEL = + "/theme/field[@name='showwidth']/@default"; + public final static String XPATH_TRANSPARENCY = "/theme/field[@name='transparent']/@default"; @@ -343,6 +349,16 @@ } + public static boolean parseShowWidth(Document theme) { + String show = XMLUtils.xpathString(theme, XPATH_SHOW_WIDTH, null); + return parseBoolean(show, false); + } + + public static boolean parseShowLevel(Document theme) { + String show = XMLUtils.xpathString(theme, XPATH_SHOW_LEVEL, null); + return parseBoolean(show, false); + } + /** * Parses the textorientation, defaults to 'vertical'. * @param theme The theme.