Mercurial > dive4elements > river
changeset 3394:f091f2f55f88
Partial implementation of bandwidths for curves (issue720).
flys-artifacts/trunk@5024 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 17 Jul 2012 18:31:34 +0000 |
parents | 525e976102ac |
children | 2a8919e0ed28 |
files | flys-artifacts/doc/conf/default-themes.xml flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java flys-artifacts/src/main/java/de/intevation/flys/exports/StyledSeriesBuilder.java flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java |
diffstat | 4 files changed, 41 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ <inherit from="MinMaxPoints" /> </inherits> <fields> + <field name="bandwidth" type="int" display="Bandbreite" + default="0"/> <field name="linecolor" type="Color" display="Linienfarbe" default="204, 204, 204" /> </fields>
--- 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); }
--- 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).
--- 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);