comparison flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java @ 1711:f708120cb7bc

Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering). flys-artifacts/trunk@2975 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Mon, 17 Oct 2011 08:45:26 +0000
parents 9324839684a4
children 6cdc7a77d3d4
comparison
equal deleted inserted replaced
1710:055f32a5388a 1711:f708120cb7bc
9 9
10 /** 10 /**
11 * Utility to deal with themes and their representations. 11 * Utility to deal with themes and their representations.
12 */ 12 */
13 public class ThemeUtil { 13 public class ThemeUtil {
14 public final static String XPATH_LINE_COLOR = "/theme/field[@name='linecolor']/@default"; 14 public final static String XPATH_LINE_COLOR =
15 "/theme/field[@name='linecolor']/@default";
16
17 public static final String XPATH_LINE_SIZE =
18 "/theme/field[@name='linesize']/@default";
19
20
21 /**
22 * Parses line width, defaulting to 0.
23 * @param theme the theme
24 */
25 public static int parseLineWidth(Document theme) {
26 String size = XMLUtils.xpathString(theme, XPATH_LINE_SIZE, null);
27 if (size == null || size.length() == 0) {
28 return 0;
29 }
30
31 try {
32 return Integer.valueOf(size);
33 }
34 catch (NumberFormatException nfe) {
35 //logger.warn("Unable to set line size from string: '" + size + "'");
36 }
37 return 0;
38 }
39
15 40
16 /** 41 /**
17 * Parse a string like "103, 100, 0" and return a corresping color. 42 * Parse a string like "103, 100, 0" and return a corresping color.
18 * @param rgbtext Color as string representation, e.g. "255,0,20". 43 * @param rgbtext Color as string representation, e.g. "255,0,20".
19 * @return Color, null in case of issues. 44 * @return Color, null in case of issues.

http://dive4elements.wald.intevation.org