# HG changeset patch # User Felix Wolfsteller # Date 1342549894 0 # Node ID f091f2f55f88e1d10d70ab6f763e6ea0df2482af # Parent 525e976102acc498472cf48ae4840b27f653bb99 Partial implementation of bandwidths for curves (issue720). flys-artifacts/trunk@5024 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 525e976102ac -r f091f2f55f88 flys-artifacts/doc/conf/default-themes.xml --- a/flys-artifacts/doc/conf/default-themes.xml Tue Jul 17 07:22:17 2012 +0000 +++ b/flys-artifacts/doc/conf/default-themes.xml Tue Jul 17 18:31:34 2012 +0000 @@ -48,6 +48,8 @@ + diff -r 525e976102ac -r f091f2f55f88 flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java Tue Jul 17 07:22:17 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java Tue Jul 17 18:31:34 2012 +0000 @@ -27,6 +27,7 @@ import de.intevation.flys.utils.FLYSUtils; import de.intevation.flys.utils.DataUtil; +import de.intevation.flys.utils.ThemeUtil; import de.intevation.flys.artifacts.geom.Lines; @@ -429,9 +430,23 @@ XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); StyledSeriesBuilder.addPoints(series, wkms); + XYSeries seriesDown = new StyledXYSeries(aandf.getFacetDescription()+"-",false, theme); + XYSeries seriesUp = new StyledXYSeries(aandf.getFacetDescription()+"+",false, theme); + StyledSeriesBuilder.addUpperBand(seriesUp, wkms, 5d); + StyledSeriesBuilder.addLowerBand(seriesDown, wkms, 5d); addAxisSeries(series, YAXIS.W.idx, visible); + int bandWidth = ThemeUtil.parseBandWidth(theme); + if (bandWidth > 0 ) { + StyledAreaSeriesCollection area = new StyledAreaSeriesCollection(theme); + area.addSeries(seriesUp); + area.addSeries(seriesDown); + area.setMode(StyledAreaSeriesCollection.FILL_MODE.BETWEEN); + addAreaSeries(area, YAXIS.W.idx, visible); + } + + if (needInvertAxis(wkms)) { setInverted(true); } diff -r 525e976102ac -r f091f2f55f88 flys-artifacts/src/main/java/de/intevation/flys/exports/StyledSeriesBuilder.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/StyledSeriesBuilder.java Tue Jul 17 07:22:17 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/StyledSeriesBuilder.java Tue Jul 17 18:31:34 2012 +0000 @@ -74,6 +74,21 @@ } } + public static void addUpperBand(XYSeries series, WKms wkms, double off) { + if (wkms == null) { + return; + } + + int size = wkms.size(); + + for (int i = 0; i < size; i++) { + series.add(wkms.getKm(i), wkms.getW(i)+off, false); + } + } + + public static void addLowerBand(XYSeries series, WKms wkms, double off) { + addUpperBand(series, wkms, -off); + } /** * Add points to series (km to 1st dim, q to 2nd dim). diff -r 525e976102ac -r f091f2f55f88 flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java --- a/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java Tue Jul 17 07:22:17 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java Tue Jul 17 18:31:34 2012 +0000 @@ -134,6 +134,9 @@ public final static String XPATH_WSPLGEN_FIELDS = "/theme[@name='WSPLGEN']/field"; + public final static String XPATH_BANDWIDTH = + "/theme/field[@name='bandwidth']/@default"; + /** Parse string to be boolean with default if empty or unrecognized. */ public static boolean parseBoolean(String value, boolean defaultsTo) { @@ -188,6 +191,12 @@ } + public static int parseBandWidth(Document theme) { + String bandWidth = XMLUtils.xpathString(theme, XPATH_BANDWIDTH, null); + + return parseInteger(bandWidth, 0); + } + public static int parsePointWidth(Document theme) { String width = XMLUtils.xpathString(theme, XPATH_POINT_SIZE, null);