comparison flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java @ 1816:5364b86a0880

Improved styles of WMS layers. flys-artifacts/trunk@3145 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 02 Nov 2011 15:02:23 +0000
parents 1636686070f7
children dd467951335c
comparison
equal deleted inserted replaced
1815:a97764363ba2 1816:5364b86a0880
54 public final static String XPATH_TEXT_BACKGROUND = 54 public final static String XPATH_TEXT_BACKGROUND =
55 "/theme/field[@name='backgroundcolor']/@default"; 55 "/theme/field[@name='backgroundcolor']/@default";
56 56
57 public final static String XPATH_SHOW_BACKGROUND = 57 public final static String XPATH_SHOW_BACKGROUND =
58 "/theme/field[@name='showbackground']/@default"; 58 "/theme/field[@name='showbackground']/@default";
59
60 public final static String XPATH_SYMBOL =
61 "/theme/field[@name='symbol']/@default";
59 62
60 /** 63 /**
61 * Parses line width, defaulting to 0. 64 * Parses line width, defaulting to 0.
62 * @param theme the theme 65 * @param theme the theme
63 */ 66 */
290 public static String getLineColorString(Document theme) { 293 public static String getLineColorString(Document theme) {
291 return XMLUtils.xpathString(theme, XPATH_LINE_COLOR, null); 294 return XMLUtils.xpathString(theme, XPATH_LINE_COLOR, null);
292 } 295 }
293 296
294 297
298 public static String getSymbol(Document theme) {
299 return XMLUtils.xpathString(theme, XPATH_SYMBOL, null);
300 }
301
302
295 /** 303 /**
296 * Gets color from color field. 304 * Gets color from color field.
297 * @param theme the theme document. 305 * @param theme the theme document.
298 * @return color. 306 * @return color.
299 */ 307 */
301 return parseRGB(getLineColorString(theme)); 309 return parseRGB(getLineColorString(theme));
302 } 310 }
303 311
304 312
305 public static String createMapserverStyle(Document theme) { 313 public static String createMapserverStyle(Document theme) {
314 String symbol = getSymbol(theme);
306 String linecolor = getLineColorString(theme); 315 String linecolor = getLineColorString(theme);
307 int linewidth = parseLineWidth(theme); 316 linecolor = linecolor.replace(",", "");
317
318 int linewidth = parseLineWidth(theme);
308 319
309 MapserverStyle ms = new MapserverStyle(); 320 MapserverStyle ms = new MapserverStyle();
310 321
311 Clazz c = new Clazz(" "); 322 Clazz c = new Clazz(" ");
312 c.setOutlineColor(linecolor); 323 c.setOutlineColor(linecolor);
313 c.setSize(linewidth); 324 c.setSize(linewidth);
325 c.setSymbol(symbol);
314 326
315 ms.addClazz(c); 327 ms.addClazz(c);
316 328
317 return ms.toString(); 329 return ms.toString();
318 } 330 }

http://dive4elements.wald.intevation.org