Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java @ 2070:48fd8b06bce5
#104 Use Wst.determineMinMaxQFree() to determine the min/max Qs at a given kilometer.
flys-artifacts/trunk@3572 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 03 Jan 2012 10:12:49 +0000 |
parents | 5746c74c69cf |
children | 4cdd9c4896f6 |
rev | line source |
---|---|
1090
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.utils; |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 |
1738
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
3 import org.apache.log4j.Logger; |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
4 |
1090
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
5 import java.awt.Color; |
1738
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
6 import java.awt.Font; |
1090
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
7 |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 import org.w3c.dom.Document; |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
9 |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.artifacts.common.utils.XMLUtils; |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
11 |
1793
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
12 import de.intevation.flys.artifacts.model.MapserverStyle; |
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
13 import de.intevation.flys.artifacts.model.MapserverStyle.Clazz; |
1876
dd467951335c
Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1816
diff
changeset
|
14 import de.intevation.flys.artifacts.model.MapserverStyle.Style; |
dd467951335c
Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1816
diff
changeset
|
15 import de.intevation.flys.artifacts.model.MapserverStyle.Label; |
1793
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
16 |
1090
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
17 |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
18 /** |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 * Utility to deal with themes and their representations. |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
20 */ |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
21 public class ThemeUtil { |
1738
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
22 |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
23 private static Logger logger = |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
24 Logger.getLogger(ThemeUtil.class); |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
25 |
2016
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
26 public final static String XPATH_FILL_COLOR = |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
27 "/theme/field[@name='fillcolor']/@default"; |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
28 |
1711
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
29 public final static String XPATH_LINE_COLOR = |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
30 "/theme/field[@name='linecolor']/@default"; |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
31 |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
32 public static final String XPATH_LINE_SIZE = |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
33 "/theme/field[@name='linesize']/@default"; |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
34 |
1753
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
35 public static final String XPATH_LINE_STYLE = |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
36 "/theme/field[@name='linetype']/@default"; |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
37 |
2016
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
38 public final static String XPATH_SHOW_BORDER = |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
39 "/theme/field[@name='showborder']/@default"; |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
40 |
1748
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
41 public final static String XPATH_SHOW_POINTS = |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
42 "/theme/field[@name='showpoints']/@default"; |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
43 |
1753
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
44 public final static String XPATH_SHOW_LINE = |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
45 "/theme/field[@name='showlines']/@default"; |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
46 |
2032
5746c74c69cf
Added a transparency setting to area theme style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2016
diff
changeset
|
47 public final static String XPATH_TRANSPARENCY = |
5746c74c69cf
Added a transparency setting to area theme style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2016
diff
changeset
|
48 "/theme/field[@name='transparent']/@default"; |
5746c74c69cf
Added a transparency setting to area theme style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2016
diff
changeset
|
49 |
1738
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
50 public final static String XPATH_TEXT_COLOR = |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
51 "/theme/field[@name='textcolor']/@default"; |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
52 |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
53 public final static String XPATH_TEXT_SIZE = |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
54 "/theme/field[@name='textsize']/@default"; |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
55 |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
56 public final static String XPATH_TEXT_FONT = |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
57 "/theme/field[@name='font']/@default"; |
1711
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
58 |
1748
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
59 public final static String XPATH_TEXT_STYLE = |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
60 "/theme/field[@name='textstyle']/@default"; |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
61 |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
62 public final static String XPATH_TEXT_ORIENTATION = |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
63 "/theme/field[@name='textorientation']/@default"; |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
64 |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
65 public final static String XPATH_TEXT_BACKGROUND = |
1750
415ec0223dff
Renamed text background attribute and parse text attributes correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1748
diff
changeset
|
66 "/theme/field[@name='backgroundcolor']/@default"; |
1748
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
67 |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
68 public final static String XPATH_SHOW_BACKGROUND = |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
69 "/theme/field[@name='showbackground']/@default"; |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
70 |
1816
5364b86a0880
Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1793
diff
changeset
|
71 public final static String XPATH_SYMBOL = |
5364b86a0880
Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1793
diff
changeset
|
72 "/theme/field[@name='symbol']/@default"; |
5364b86a0880
Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1793
diff
changeset
|
73 |
2016
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
74 |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
75 /** Parse string to be boolean with default if empty or unrecognized. */ |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
76 public static boolean parseBoolean(String value, boolean defaultsTo) { |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
77 if (value == null || value.length() == 0) { |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
78 return defaultsTo; |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
79 } |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
80 if (value.equals("false")) { |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
81 return false; |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
82 } |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
83 else if (value.equals("true")) { |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
84 return true; |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
85 } |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
86 else { |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
87 return defaultsTo; |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
88 } |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
89 } |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
90 |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
91 |
1711
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
92 /** |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
93 * Parses line width, defaulting to 0. |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
94 * @param theme the theme |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
95 */ |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
96 public static int parseLineWidth(Document theme) { |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
97 String size = XMLUtils.xpathString(theme, XPATH_LINE_SIZE, null); |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
98 if (size == null || size.length() == 0) { |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
99 return 0; |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
100 } |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
101 |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
102 try { |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
103 return Integer.valueOf(size); |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
104 } |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
105 catch (NumberFormatException nfe) { |
1753
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
106 logger.warn("Unable to set line size from string: '" + size + "'"); |
1711
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
107 } |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
108 return 0; |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
109 } |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
110 |
1090
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
111 |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
112 /** |
1753
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
113 * Parses the line style, defaulting to '10'. |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
114 * @param theme The theme. |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
115 */ |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
116 public static float[] parseLineStyle(Document theme) { |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
117 String dash = XMLUtils.xpathString(theme, XPATH_LINE_STYLE, null); |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
118 |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
119 float[] def = {10}; |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
120 if (dash == null || dash.length() == 0) { |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
121 return def; |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
122 } |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
123 |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
124 String[] pattern = dash.split(","); |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
125 if(pattern.length == 1) { |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
126 return def; |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
127 } |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
128 |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
129 try { |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
130 float[] dashes = new float[pattern.length]; |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
131 for (int i = 0; i < pattern.length; i++) { |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
132 dashes[i] = Float.parseFloat(pattern[i]); |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
133 } |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
134 return dashes; |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
135 } |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
136 catch(NumberFormatException nfe) { |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
137 logger.warn("Unable to set dash from string: '" + dash + "'"); |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
138 return def; |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
139 } |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
140 } |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
141 |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
142 |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
143 /** |
1738
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
144 * Parses text size, defaulting to 10. |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
145 * @param theme The theme. |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
146 */ |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
147 public static int parseTextSize(Document theme) { |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
148 String size = XMLUtils.xpathString(theme, XPATH_TEXT_SIZE, null); |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
149 if (size == null || size.length() == 0) { |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
150 return 10; |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
151 } |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
152 |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
153 try { |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
154 return Integer.valueOf(size); |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
155 } |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
156 catch (NumberFormatException nfe) { |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
157 } |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
158 return 10; |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
159 } |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
160 |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
161 |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
162 /** |
1748
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
163 * Parses the attribute 'showpoints', defaults to false. |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
164 * @param theme The theme. |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
165 */ |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
166 public static boolean parseShowPoints(Document theme) { |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
167 String show = XMLUtils.xpathString(theme, XPATH_SHOW_POINTS, null); |
2016
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
168 return parseBoolean(show, false); |
1748
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
169 } |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
170 |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
171 |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
172 /** |
1753
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
173 * Parses the attribute 'showlines', defaults to true. |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
174 * @param theme The theme. |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
175 */ |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
176 public static boolean parseShowLine(Document theme) { |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
177 String show = XMLUtils.xpathString(theme, XPATH_SHOW_LINE, null); |
2016
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
178 return parseBoolean(show, true); |
1753
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
179 } |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
180 |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
181 |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
182 /** |
1738
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
183 * Parses text color. |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
184 * @param theme The theme. |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
185 */ |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
186 public static Color parseTextColor(Document theme) { |
1876
dd467951335c
Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1816
diff
changeset
|
187 return parseRGB(getTextColorString(theme)); |
1738
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
188 } |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
189 |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
190 |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
191 /** |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
192 * Parses the font. |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
193 * @param theme The theme. |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
194 */ |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
195 public static Font parseTextFont(Document theme) { |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
196 String font = XMLUtils.xpathString(theme, XPATH_TEXT_FONT, null); |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
197 if (font == null || font.length() == 0) { |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
198 return null; |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
199 } |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
200 |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
201 int size = parseTextSize(theme); |
1750
415ec0223dff
Renamed text background attribute and parse text attributes correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1748
diff
changeset
|
202 int style = parseTextStyle(theme); |
415ec0223dff
Renamed text background attribute and parse text attributes correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1748
diff
changeset
|
203 Font f = new Font (font, style, size); |
1738
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
204 return f; |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
205 } |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
206 |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
207 |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
208 /** |
1748
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
209 * Parses the text style, defaults to 'Font.PLAIN'. |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
210 * @param theme The theme. |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
211 */ |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
212 public static int parseTextStyle(Document theme) { |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
213 String style = XMLUtils.xpathString(theme, XPATH_TEXT_STYLE, null); |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
214 if (style == null || style.length() == 0) { |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
215 return Font.PLAIN; |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
216 } |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
217 |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
218 if (style.equals("italic")) { |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
219 return Font.ITALIC; |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
220 } |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
221 else if (style.equals("bold")) { |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
222 return Font.BOLD; |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
223 } |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
224 else { |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
225 return Font.PLAIN; |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
226 } |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
227 } |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
228 |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
229 |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
230 /** |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
231 * Parses the textorientation, defaults to 'vertical'. |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
232 * @param theme The theme. |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
233 */ |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
234 public static String parseTextOrientation(Document theme) { |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
235 String o = XMLUtils.xpathString(theme, XPATH_TEXT_ORIENTATION, null); |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
236 if (o == null || o.length() == 0) { |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
237 return "vertical"; |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
238 } |
1750
415ec0223dff
Renamed text background attribute and parse text attributes correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1748
diff
changeset
|
239 if(o.equals("true")) { |
415ec0223dff
Renamed text background attribute and parse text attributes correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1748
diff
changeset
|
240 return "horizontal"; |
415ec0223dff
Renamed text background attribute and parse text attributes correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1748
diff
changeset
|
241 } |
415ec0223dff
Renamed text background attribute and parse text attributes correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1748
diff
changeset
|
242 else { |
415ec0223dff
Renamed text background attribute and parse text attributes correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1748
diff
changeset
|
243 return "vertical"; |
415ec0223dff
Renamed text background attribute and parse text attributes correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1748
diff
changeset
|
244 } |
1748
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
245 } |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
246 |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
247 |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
248 /** |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
249 * Parses the text background color, defaults to white. |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
250 * @param theme The theme. |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
251 */ |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
252 public static Color parseTextBackground(Document theme) { |
1878
84cf67a2a19e
Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1876
diff
changeset
|
253 String color = getBackgroundColorString(theme); |
1748
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
254 if (color == null || color.length() == 0) { |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
255 return Color.WHITE; |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
256 } |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
257 return parseRGB(color); |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
258 } |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
259 |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
260 |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
261 /** |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
262 * Parses the attribute whether to show background or not, defaults to |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
263 * false. |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
264 * @param theme The theme. |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
265 */ |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
266 public static boolean parseShowTextBackground(Document theme) { |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
267 String show = XMLUtils.xpathString(theme, XPATH_SHOW_BACKGROUND, null); |
2016
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
268 return parseBoolean(show, false); |
1748
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
269 } |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
270 |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
271 |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
272 /** |
1090
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
273 * Parse a string like "103, 100, 0" and return a corresping color. |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
274 * @param rgbtext Color as string representation, e.g. "255,0,20". |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
275 * @return Color, null in case of issues. |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
276 */ |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
277 public static Color parseRGB(String rgbtext) { |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
278 if (rgbtext == null) { |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
279 return null; |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
280 } |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
281 String rgb[] = rgbtext.split(","); |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
282 Color c = null; |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
283 try { |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
284 c = new Color( |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
285 Integer.valueOf(rgb[0].trim()), |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
286 Integer.valueOf(rgb[1].trim()), |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
287 Integer.valueOf(rgb[2].trim())); |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
288 } |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
289 catch (NumberFormatException nfe) { |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
290 c = null; |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
291 } |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
292 return c; |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
293 } |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
294 |
1748
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
295 |
1793
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
296 public static String getLineColorString(Document theme) { |
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
297 return XMLUtils.xpathString(theme, XPATH_LINE_COLOR, null); |
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
298 } |
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
299 |
2016
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
300 /** Get show border as string. */ |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
301 public static String getShowBorderString(Document theme) { |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
302 return XMLUtils.xpathString(theme, XPATH_SHOW_BORDER, null); |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
303 } |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
304 |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
305 /** Get fill color as string. */ |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
306 public static String getFillColorString(Document theme) { |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
307 return XMLUtils.xpathString(theme, XPATH_FILL_COLOR, null); |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
308 } |
1793
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
309 |
1878
84cf67a2a19e
Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1876
diff
changeset
|
310 public static String getBackgroundColorString(Document theme) { |
84cf67a2a19e
Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1876
diff
changeset
|
311 return XMLUtils.xpathString(theme, XPATH_TEXT_BACKGROUND, null); |
84cf67a2a19e
Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1876
diff
changeset
|
312 } |
84cf67a2a19e
Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1876
diff
changeset
|
313 |
84cf67a2a19e
Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1876
diff
changeset
|
314 |
1876
dd467951335c
Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1816
diff
changeset
|
315 public static String getTextColorString(Document theme) { |
dd467951335c
Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1816
diff
changeset
|
316 return XMLUtils.xpathString(theme, XPATH_TEXT_COLOR, null); |
dd467951335c
Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1816
diff
changeset
|
317 } |
dd467951335c
Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1816
diff
changeset
|
318 |
dd467951335c
Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1816
diff
changeset
|
319 |
1816
5364b86a0880
Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1793
diff
changeset
|
320 public static String getSymbol(Document theme) { |
5364b86a0880
Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1793
diff
changeset
|
321 return XMLUtils.xpathString(theme, XPATH_SYMBOL, null); |
5364b86a0880
Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1793
diff
changeset
|
322 } |
5364b86a0880
Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1793
diff
changeset
|
323 |
2032
5746c74c69cf
Added a transparency setting to area theme style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2016
diff
changeset
|
324 public static String getTransparencyString(Document theme) { |
5746c74c69cf
Added a transparency setting to area theme style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2016
diff
changeset
|
325 return XMLUtils.xpathString(theme, XPATH_TRANSPARENCY, null); |
5746c74c69cf
Added a transparency setting to area theme style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2016
diff
changeset
|
326 } |
5746c74c69cf
Added a transparency setting to area theme style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2016
diff
changeset
|
327 |
1816
5364b86a0880
Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1793
diff
changeset
|
328 |
1090
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
329 /** |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
330 * Gets color from color field. |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
331 * @param theme the theme document. |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
332 * @return color. |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
333 */ |
2016
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
334 public static Color parseFillColorField(Document theme) { |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
335 return parseRGB(getFillColorString(theme)); |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
336 } |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
337 |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
338 public static boolean parseShowBorder(Document theme) { |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
339 return parseBoolean(getShowBorderString(theme), false); |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
340 } |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
341 |
2032
5746c74c69cf
Added a transparency setting to area theme style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2016
diff
changeset
|
342 public static boolean parseTransparency(Document theme) { |
5746c74c69cf
Added a transparency setting to area theme style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2016
diff
changeset
|
343 return parseBoolean(getTransparencyString(theme), false); |
5746c74c69cf
Added a transparency setting to area theme style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2016
diff
changeset
|
344 } |
2016
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
345 |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
346 /** |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
347 * Gets color from color field. |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
348 * @param theme the theme document. |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
349 * @return color. |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
350 */ |
1090
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
351 public static Color parseLineColorField(Document theme) { |
1793
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
352 return parseRGB(getLineColorString(theme)); |
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
353 } |
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
354 |
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
355 |
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
356 public static String createMapserverStyle(Document theme) { |
1816
5364b86a0880
Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1793
diff
changeset
|
357 String symbol = getSymbol(theme); |
1878
84cf67a2a19e
Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1876
diff
changeset
|
358 String backcolor = getBackgroundColorString(theme); |
1793
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
359 String linecolor = getLineColorString(theme); |
1816
5364b86a0880
Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1793
diff
changeset
|
360 |
5364b86a0880
Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1793
diff
changeset
|
361 int linewidth = parseLineWidth(theme); |
1793
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
362 |
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
363 MapserverStyle ms = new MapserverStyle(); |
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
364 |
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
365 Clazz c = new Clazz(" "); |
1876
dd467951335c
Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1816
diff
changeset
|
366 |
dd467951335c
Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1816
diff
changeset
|
367 Style s = new Style(); |
1878
84cf67a2a19e
Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1876
diff
changeset
|
368 s.setOutlineColor(linecolor.replace(",", "")); |
84cf67a2a19e
Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1876
diff
changeset
|
369 |
84cf67a2a19e
Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1876
diff
changeset
|
370 if (backcolor != null && backcolor.length() > 0) { |
84cf67a2a19e
Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1876
diff
changeset
|
371 s.setColor(backcolor.replace(",", "")); |
84cf67a2a19e
Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1876
diff
changeset
|
372 } |
84cf67a2a19e
Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1876
diff
changeset
|
373 |
1876
dd467951335c
Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1816
diff
changeset
|
374 s.setSize(linewidth); |
dd467951335c
Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1816
diff
changeset
|
375 s.setSymbol(symbol); |
dd467951335c
Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1816
diff
changeset
|
376 c.addItem(s); |
dd467951335c
Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1816
diff
changeset
|
377 |
dd467951335c
Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1816
diff
changeset
|
378 String textcolor = getTextColorString(theme); |
dd467951335c
Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1816
diff
changeset
|
379 int textsize = parseTextSize(theme); |
dd467951335c
Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1816
diff
changeset
|
380 |
dd467951335c
Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1816
diff
changeset
|
381 if (textcolor != null && textcolor.length() > 0 && textsize > 0) { |
dd467951335c
Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1816
diff
changeset
|
382 Label l = new Label(); |
dd467951335c
Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1816
diff
changeset
|
383 l.setColor(textcolor.replace(",", "")); |
dd467951335c
Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1816
diff
changeset
|
384 l.setSize(textsize); |
dd467951335c
Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1816
diff
changeset
|
385 c.addItem(l); |
dd467951335c
Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1816
diff
changeset
|
386 } |
1793
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
387 |
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
388 ms.addClazz(c); |
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
389 |
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
390 return ms.toString(); |
1090
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
391 } |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
392 } |
2016
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
393 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |