# HG changeset patch # User Christian Lins # Date 1348173344 0 # Node ID 940cd2ef149f4eb5f1c2ce49c6ccbcdf6bd85638 # Parent 44a07145570974005e58141b770163fa45d61f21 Area transparency fix flys-artifacts/trunk@5542 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 44a071455709 -r 940cd2ef149f flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Thu Sep 20 09:35:31 2012 +0000 +++ b/flys-artifacts/ChangeLog Thu Sep 20 20:35:44 2012 +0000 @@ -1,3 +1,12 @@ +2012-09-20 Christian Lins + + * doc/conf/second-themes.xml, + doc/conf/default-themes.xml, + src/main/java/de/intevation/flys/utils/ThemeUtil.java, + src/main/java/de/intevation/flys/jfree/StyledAreaSeriesCollection.java, + src/main/java/de/intevation/flys/jfree/StyledDomainMarker.java: + Theme area transparency fixed for longitudinal section chart (#879). + 2012-09-20 Felix Wolfsteller Improvements for manual points in fixation diags. diff -r 44a071455709 -r 940cd2ef149f flys-artifacts/doc/conf/default-themes.xml --- a/flys-artifacts/doc/conf/default-themes.xml Thu Sep 20 09:35:31 2012 +0000 +++ b/flys-artifacts/doc/conf/default-themes.xml Thu Sep 20 20:35:44 2012 +0000 @@ -1456,10 +1456,8 @@ - - @@ -1467,10 +1465,8 @@ - - @@ -1478,10 +1474,8 @@ - - @@ -1489,10 +1483,8 @@ - - @@ -1500,10 +1492,8 @@ - - diff -r 44a071455709 -r 940cd2ef149f flys-artifacts/doc/conf/second-themes.xml --- a/flys-artifacts/doc/conf/second-themes.xml Thu Sep 20 09:35:31 2012 +0000 +++ b/flys-artifacts/doc/conf/second-themes.xml Thu Sep 20 20:35:44 2012 +0000 @@ -1467,10 +1467,8 @@ - - @@ -1478,10 +1476,8 @@ - - @@ -1489,10 +1485,8 @@ - - @@ -1500,10 +1494,8 @@ - - diff -r 44a071455709 -r 940cd2ef149f flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledAreaSeriesCollection.java --- a/flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledAreaSeriesCollection.java Thu Sep 20 09:35:31 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledAreaSeriesCollection.java Thu Sep 20 20:35:44 2012 +0000 @@ -4,7 +4,6 @@ import java.awt.Color; import java.awt.Stroke; -import org.apache.log4j.Logger; import org.jfree.data.xy.XYSeriesCollection; import org.w3c.dom.Document; @@ -20,6 +19,8 @@ * dataset. */ public class StyledAreaSeriesCollection extends XYSeriesCollection { + private static final long serialVersionUID = 5274940965666948237L; + /** Mode, how to draw/which areas to fill. */ public enum FILL_MODE {UNDER, ABOVE, BETWEEN}; @@ -29,10 +30,6 @@ /** The theme-document with attributes about actual visual representation. */ protected Document theme; - /** Own logger. */ - private static final Logger logger = - Logger.getLogger(StyledAreaSeriesCollection.class); - /** * @param theme the theme-document. @@ -85,17 +82,19 @@ } - /** - * Blindly (for now) apply the positivepaint of renderer. - */ protected void applyFillColor(StableXYDifferenceRenderer renderer) { - // 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); + Color paint = ThemeUtil.parseColor( + ThemeUtil.getBackgroundColorString(theme)); + + int transparency = ThemeUtil.parseTransparency(theme); + if (transparency > 0) { + paint = new Color( + paint.getRed(), + paint.getGreen(), + paint.getBlue(), + (int)((100 - transparency) * 2.55f)); } + if (paint != null && this.getMode() == FILL_MODE.ABOVE) { renderer.setPositivePaint(paint); renderer.setNegativePaint(new Color(0,0,0,0)); @@ -105,15 +104,14 @@ renderer.setPositivePaint(new Color(0,0,0,0)); } else { - if (paint == null) paint = new Color(177, 117, 102); + if (paint == null) + paint = new Color(177, 117, 102); renderer.setPositivePaint(paint); renderer.setNegativePaint(paint); } } - /** - * Blindly (for now) apply the postiviepaint of renderer. - */ + protected void applyShowShape(StableXYDifferenceRenderer renderer) { boolean show = ThemeUtil.parseShowBorder(theme); renderer.setDrawOutline(show); diff -r 44a071455709 -r 940cd2ef149f flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledDomainMarker.java --- a/flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledDomainMarker.java Thu Sep 20 09:35:31 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledDomainMarker.java Thu Sep 20 20:35:44 2012 +0000 @@ -9,6 +9,7 @@ /** * Marker that represents a highlighted interval. + * * @author Christian Lins */ public class StyledDomainMarker extends IntervalMarker { @@ -26,7 +27,8 @@ ThemeUtil.getFillColorString(theme)); useSecondColor(false); - int alpha = 100 - ThemeUtil.parseInteger(ThemeUtil.getTransparency(theme), 50); + int alpha = 100 - ThemeUtil.parseInteger( + ThemeUtil.getTransparencyString(theme), 50); setAlpha(alpha / 100.0f); } diff -r 44a071455709 -r 940cd2ef149f flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java --- a/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java Thu Sep 20 09:35:31 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java Thu Sep 20 20:35:44 2012 +0000 @@ -72,9 +72,6 @@ public final static String XPATH_SHOW_LEVEL = "/theme/field[@name='showlevel']/@default"; - public final static String XPATH_TRANSPARENT = - "/theme/field[@name='transparent']/@default"; - public final static String XPATH_TRANSPARENCY = "/theme/field[@name='transparency']/@default"; @@ -556,11 +553,6 @@ } - public static String getTransparency(Document theme) { - return XMLUtils.xpathString(theme, XPATH_TRANSPARENCY, null); - } - - public static String getShowMinimum(Document theme) { return XMLUtils.xpathString(theme, XPATH_SHOW_MINIMUM, null); } @@ -586,8 +578,8 @@ } - public static boolean parseTransparency(Document theme) { - return parseBoolean(getTransparencyString(theme), false); + public static int parseTransparency(Document theme) { + return parseInteger(getTransparencyString(theme), 50); }