comparison flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java @ 1878:84cf67a2a19e

Added support for fillcolors of polygons in floodmaps. flys-artifacts/trunk@3237 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 11 Nov 2011 11:28:15 +0000
parents dd467951335c
children 796dfe96b6b2
comparison
equal deleted inserted replaced
1877:1a6018d5f0b7 1878:84cf67a2a19e
237 /** 237 /**
238 * Parses the text background color, defaults to white. 238 * Parses the text background color, defaults to white.
239 * @param theme The theme. 239 * @param theme The theme.
240 */ 240 */
241 public static Color parseTextBackground(Document theme) { 241 public static Color parseTextBackground(Document theme) {
242 String color = XMLUtils.xpathString(theme, XPATH_TEXT_BACKGROUND, null); 242 String color = getBackgroundColorString(theme);
243 if (color == null || color.length() == 0) { 243 if (color == null || color.length() == 0) {
244 return Color.WHITE; 244 return Color.WHITE;
245 } 245 }
246 return parseRGB(color); 246 return parseRGB(color);
247 } 247 }
294 public static String getLineColorString(Document theme) { 294 public static String getLineColorString(Document theme) {
295 return XMLUtils.xpathString(theme, XPATH_LINE_COLOR, null); 295 return XMLUtils.xpathString(theme, XPATH_LINE_COLOR, null);
296 } 296 }
297 297
298 298
299 public static String getBackgroundColorString(Document theme) {
300 return XMLUtils.xpathString(theme, XPATH_TEXT_BACKGROUND, null);
301 }
302
303
299 public static String getTextColorString(Document theme) { 304 public static String getTextColorString(Document theme) {
300 return XMLUtils.xpathString(theme, XPATH_TEXT_COLOR, null); 305 return XMLUtils.xpathString(theme, XPATH_TEXT_COLOR, null);
301 } 306 }
302 307
303 308
316 } 321 }
317 322
318 323
319 public static String createMapserverStyle(Document theme) { 324 public static String createMapserverStyle(Document theme) {
320 String symbol = getSymbol(theme); 325 String symbol = getSymbol(theme);
326 String backcolor = getBackgroundColorString(theme);
321 String linecolor = getLineColorString(theme); 327 String linecolor = getLineColorString(theme);
322 linecolor = linecolor.replace(",", "");
323 328
324 int linewidth = parseLineWidth(theme); 329 int linewidth = parseLineWidth(theme);
325 330
326 MapserverStyle ms = new MapserverStyle(); 331 MapserverStyle ms = new MapserverStyle();
327 332
328 Clazz c = new Clazz(" "); 333 Clazz c = new Clazz(" ");
329 334
330 Style s = new Style(); 335 Style s = new Style();
331 s.setOutlineColor(linecolor); 336 s.setOutlineColor(linecolor.replace(",", ""));
337
338 if (backcolor != null && backcolor.length() > 0) {
339 s.setColor(backcolor.replace(",", ""));
340 }
341
332 s.setSize(linewidth); 342 s.setSize(linewidth);
333 s.setSymbol(symbol); 343 s.setSymbol(symbol);
334 c.addItem(s); 344 c.addItem(s);
335 345
336 String textcolor = getTextColorString(theme); 346 String textcolor = getTextColorString(theme);

http://dive4elements.wald.intevation.org