# HG changeset patch # User Ingo Weinzierl # Date 1321010895 0 # Node ID 84cf67a2a19e49f05093f480b4b6de2f9565a646 # Parent 1a6018d5f0b75b39402e3a3736f54a6a5da64b88 Added support for fillcolors of polygons in floodmaps. flys-artifacts/trunk@3237 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 1a6018d5f0b7 -r 84cf67a2a19e flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Fri Nov 11 11:00:31 2011 +0000 +++ b/flys-artifacts/ChangeLog Fri Nov 11 11:28:15 2011 +0000 @@ -1,3 +1,15 @@ +2011-11-11 Ingo Weinzierl + + * doc/conf/themes.xml: Modified some floodmap styles and added a + backgroundcolor attribute to polygon themes. + + * src/main/java/de/intevation/flys/artifacts/model/MapserverStyle.java: + Added support for backgroundcolor. + + * src/main/java/de/intevation/flys/utils/ThemeUtil.java: Parse + backgroundcolor from theme document. If a value is given, the + backgroundcolor is set on the Mapserver style. + 2011-11-11 Ingo Weinzierl * src/main/java/de/intevation/flys/artifacts/model/MapserverStyle.java: diff -r 1a6018d5f0b7 -r 84cf67a2a19e flys-artifacts/doc/conf/themes.xml --- a/flys-artifacts/doc/conf/themes.xml Fri Nov 11 11:00:31 2011 +0000 +++ b/flys-artifacts/doc/conf/themes.xml Fri Nov 11 11:28:15 2011 +0000 @@ -719,7 +719,7 @@ - + @@ -736,7 +736,7 @@ - + @@ -744,35 +744,37 @@ - + - + - - + + + - - + + + - + diff -r 1a6018d5f0b7 -r 84cf67a2a19e flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MapserverStyle.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MapserverStyle.java Fri Nov 11 11:00:31 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MapserverStyle.java Fri Nov 11 11:28:15 2011 +0000 @@ -42,10 +42,15 @@ } public static class Style implements ClazzItem { + protected String color; protected String outlinecolor; protected String symbol; protected int size; + public void setColor(String color) { + this.color = color; + } + public void setOutlineColor(String outlinecolor) { this.outlinecolor = outlinecolor; } @@ -65,6 +70,10 @@ sb.append("WIDTH " + String.valueOf(size) + "\n"); sb.append("OUTLINECOLOR " + outlinecolor + "\n"); + if (color != null) { + sb.append("COLOR " + color + "\n"); + } + if (symbol != null) { sb.append("SYMBOL '" + symbol + "'\n"); } diff -r 1a6018d5f0b7 -r 84cf67a2a19e flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java --- a/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java Fri Nov 11 11:00:31 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java Fri Nov 11 11:28:15 2011 +0000 @@ -239,7 +239,7 @@ * @param theme The theme. */ public static Color parseTextBackground(Document theme) { - String color = XMLUtils.xpathString(theme, XPATH_TEXT_BACKGROUND, null); + String color = getBackgroundColorString(theme); if (color == null || color.length() == 0) { return Color.WHITE; } @@ -296,6 +296,11 @@ } + public static String getBackgroundColorString(Document theme) { + return XMLUtils.xpathString(theme, XPATH_TEXT_BACKGROUND, null); + } + + public static String getTextColorString(Document theme) { return XMLUtils.xpathString(theme, XPATH_TEXT_COLOR, null); } @@ -318,8 +323,8 @@ public static String createMapserverStyle(Document theme) { String symbol = getSymbol(theme); + String backcolor = getBackgroundColorString(theme); String linecolor = getLineColorString(theme); - linecolor = linecolor.replace(",", ""); int linewidth = parseLineWidth(theme); @@ -328,7 +333,12 @@ Clazz c = new Clazz(" "); Style s = new Style(); - s.setOutlineColor(linecolor); + s.setOutlineColor(linecolor.replace(",", "")); + + if (backcolor != null && backcolor.length() > 0) { + s.setColor(backcolor.replace(",", "")); + } + s.setSize(linewidth); s.setSymbol(symbol); c.addItem(s);