diff 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
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java	Fri Oct 14 11:13:04 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java	Mon Oct 17 08:45:26 2011 +0000
@@ -11,7 +11,32 @@
  * Utility to deal with themes and their representations.
  */
 public class ThemeUtil {
-    public final static String XPATH_LINE_COLOR = "/theme/field[@name='linecolor']/@default";
+    public final static String XPATH_LINE_COLOR =
+        "/theme/field[@name='linecolor']/@default";
+
+    public static final String XPATH_LINE_SIZE =
+        "/theme/field[@name='linesize']/@default";
+
+
+    /**
+     * Parses line width, defaulting to 0.
+     * @param theme the theme
+     */
+    public static int parseLineWidth(Document theme) {
+        String size = XMLUtils.xpathString(theme, XPATH_LINE_SIZE, null);
+        if (size == null || size.length() == 0) {
+            return 0;
+        }
+
+        try {
+            return Integer.valueOf(size);
+        }
+        catch (NumberFormatException nfe) {
+            //logger.warn("Unable to set line size from string: '" + size + "'");
+        }
+        return 0;
+    }
+
 
     /**
      * Parse a string like "103, 100, 0" and return a corresping color.

http://dive4elements.wald.intevation.org