# HG changeset patch # User Felix Wolfsteller # Date 1324393601 0 # Node ID 5746c74c69cf117be9f3f803e0b54dca99e8427a # Parent 8e7e56db96a58ad9e123fedaf8f569d1ebdfb509 Added a transparency setting to area theme style. flys-artifacts/trunk@3497 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 8e7e56db96a5 -r 5746c74c69cf flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Tue Dec 20 12:06:35 2011 +0000 +++ b/flys-artifacts/ChangeLog Tue Dec 20 15:06:41 2011 +0000 @@ -1,3 +1,13 @@ +2011-12-20 Felix Wolfsteller + + * doc/conf/themes.xml: Add transparency setting to area theme style. + + * src/main/java/de/intevation/flys/utils/ThemeUtil.java: Helper to + access transparency setting in theme. + + * src/main/java/de/intevation/flys/exports/StyledAreaSeriesCollection.java: + + 2011-12-20 Felix Wolfsteller * src/main/java/de/intevation/flys/artifacts/model/WKmsFacet.java: diff -r 8e7e56db96a5 -r 5746c74c69cf flys-artifacts/doc/conf/themes.xml --- a/flys-artifacts/doc/conf/themes.xml Tue Dec 20 12:06:35 2011 +0000 +++ b/flys-artifacts/doc/conf/themes.xml Tue Dec 20 15:06:41 2011 +0000 @@ -732,6 +732,7 @@ + diff -r 8e7e56db96a5 -r 5746c74c69cf flys-artifacts/src/main/java/de/intevation/flys/exports/StyledAreaSeriesCollection.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/StyledAreaSeriesCollection.java Tue Dec 20 12:06:35 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/StyledAreaSeriesCollection.java Tue Dec 20 15:06:41 2011 +0000 @@ -1,5 +1,6 @@ package de.intevation.flys.exports; +import java.awt.Color; import java.awt.Paint; import org.apache.log4j.Logger; @@ -73,10 +74,25 @@ * Blindly (for now) apply the postiviepaint of renderer. */ protected void applyFillColor(StableXYDifferenceRenderer renderer) { - Paint paint = ThemeUtil.parseFillColorField(theme); - if (paint != null) + // Get color. + Color paint = ThemeUtil.parseFillColorField(theme); + // Get half-transparency flag. + if (ThemeUtil.parseTransparency(theme)) { + paint = new Color(paint.getRed(), paint.getGreen(), paint.getBlue(), + 128); + } + if (paint != null && this.getMode() == FILL_MODE.ABOVE) { renderer.setPositivePaint(paint); - // TODO set negativepaint? Dependend on the over/under/between settings + renderer.setNegativePaint(new Color(0,0,0,0)); + } + else if (paint != null && this.getMode() == FILL_MODE.UNDER) { + renderer.setNegativePaint(paint); + renderer.setPositivePaint(new Color(0,0,0,0)); + } + else { + renderer.setPositivePaint(paint); + renderer.setNegativePaint(paint); + } } /** diff -r 8e7e56db96a5 -r 5746c74c69cf flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java --- a/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java Tue Dec 20 12:06:35 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java Tue Dec 20 15:06:41 2011 +0000 @@ -44,6 +44,9 @@ public final static String XPATH_SHOW_LINE = "/theme/field[@name='showlines']/@default"; + public final static String XPATH_TRANSPARENCY = + "/theme/field[@name='transparent']/@default"; + public final static String XPATH_TEXT_COLOR = "/theme/field[@name='textcolor']/@default"; @@ -318,6 +321,10 @@ return XMLUtils.xpathString(theme, XPATH_SYMBOL, null); } + public static String getTransparencyString(Document theme) { + return XMLUtils.xpathString(theme, XPATH_TRANSPARENCY, null); + } + /** * Gets color from color field. @@ -332,6 +339,9 @@ return parseBoolean(getShowBorderString(theme), false); } + public static boolean parseTransparency(Document theme) { + return parseBoolean(getTransparencyString(theme), false); + } /** * Gets color from color field.