Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java @ 1876:dd467951335c
Added support for labels in Mapserver layers and options to modify its style.
flys-artifacts/trunk@3234 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 11 Nov 2011 09:43:36 +0000 |
parents | 5364b86a0880 |
children | 84cf67a2a19e |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java Fri Nov 11 07:59:42 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java Fri Nov 11 09:43:36 2011 +0000 @@ -11,6 +11,8 @@ import de.intevation.flys.artifacts.model.MapserverStyle; import de.intevation.flys.artifacts.model.MapserverStyle.Clazz; +import de.intevation.flys.artifacts.model.MapserverStyle.Style; +import de.intevation.flys.artifacts.model.MapserverStyle.Label; /** @@ -171,8 +173,7 @@ * @param theme The theme. */ public static Color parseTextColor(Document theme) { - String color = XMLUtils.xpathString(theme, XPATH_TEXT_COLOR, null); - return parseRGB(color); + return parseRGB(getTextColorString(theme)); } @@ -295,6 +296,11 @@ } + public static String getTextColorString(Document theme) { + return XMLUtils.xpathString(theme, XPATH_TEXT_COLOR, null); + } + + public static String getSymbol(Document theme) { return XMLUtils.xpathString(theme, XPATH_SYMBOL, null); } @@ -320,9 +326,22 @@ MapserverStyle ms = new MapserverStyle(); Clazz c = new Clazz(" "); - c.setOutlineColor(linecolor); - c.setSize(linewidth); - c.setSymbol(symbol); + + Style s = new Style(); + s.setOutlineColor(linecolor); + s.setSize(linewidth); + s.setSymbol(symbol); + c.addItem(s); + + String textcolor = getTextColorString(theme); + int textsize = parseTextSize(theme); + + if (textcolor != null && textcolor.length() > 0 && textsize > 0) { + Label l = new Label(); + l.setColor(textcolor.replace(",", "")); + l.setSize(textsize); + c.addItem(l); + } ms.addClazz(c);