annotate flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java @ 2648:8aaa7f4ce06a

Let theme define whether or not to display a (yet static) label for line). flys-artifacts/trunk@4306 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 26 Apr 2012 09:51:13 +0000
parents 27cc95e65f18
children f1dcd5f94ffa
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
2616
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
8 import javax.xml.xpath.XPathConstants;
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
9
1090
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
10 import org.w3c.dom.Document;
2616
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
11 import org.w3c.dom.Element;
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
12 import org.w3c.dom.NodeList;
1090
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
13
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
14 import de.intevation.artifacts.common.utils.XMLUtils;
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
15
1793
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
16 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
17 import de.intevation.flys.artifacts.model.MapserverStyle.Clazz;
2616
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
18 import de.intevation.flys.artifacts.model.MapserverStyle.Expression;
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
19 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
20 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
21
1090
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
22
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
23 /**
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
24 * Utility to deal with themes and their representations.
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
25 */
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
26 public class ThemeUtil {
1738
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
27
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
28 private static Logger logger =
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
29 Logger.getLogger(ThemeUtil.class);
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
30
2016
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
31 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
32 "/theme/field[@name='fillcolor']/@default";
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
33
1711
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
34 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
35 "/theme/field[@name='linecolor']/@default";
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
36
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
37 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
38 "/theme/field[@name='linesize']/@default";
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
39
1753
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
40 public static final String XPATH_LINE_STYLE =
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
41 "/theme/field[@name='linetype']/@default";
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
42
2076
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
43 public static final String XPATH_POINT_SIZE =
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
44 "/theme/field[@name='pointsize']/@default";
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
45
2016
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
46 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
47 "/theme/field[@name='showborder']/@default";
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
48
1748
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
49 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
50 "/theme/field[@name='showpoints']/@default";
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
51
1753
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
52 public final static String XPATH_SHOW_LINE =
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
53 "/theme/field[@name='showlines']/@default";
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
54
2648
8aaa7f4ce06a Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2616
diff changeset
55 public final static String XPATH_SHOW_LINE_LABEL =
8aaa7f4ce06a Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2616
diff changeset
56 "/theme/field[@name='showlinelabel']/@default";
8aaa7f4ce06a Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2616
diff changeset
57
2032
5746c74c69cf Added a transparency setting to area theme style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2016
diff changeset
58 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
59 "/theme/field[@name='transparent']/@default";
5746c74c69cf Added a transparency setting to area theme style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2016
diff changeset
60
1738
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
61 public final static String XPATH_TEXT_COLOR =
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
62 "/theme/field[@name='textcolor']/@default";
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
63
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
64 public final static String XPATH_TEXT_SIZE =
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
65 "/theme/field[@name='textsize']/@default";
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
66
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
67 public final static String XPATH_TEXT_FONT =
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
68 "/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
69
1748
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
70 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
71 "/theme/field[@name='textstyle']/@default";
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
72
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
73 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
74 "/theme/field[@name='textorientation']/@default";
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
75
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
76 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
77 "/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
78
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
79 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
80 "/theme/field[@name='showbackground']/@default";
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
81
1816
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
82 public final static String XPATH_SYMBOL =
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
83 "/theme/field[@name='symbol']/@default";
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
84
2072
4cdd9c4896f6 #393 Added a new Renderer and Options in Themes that allow displaying minimum and maximum of a chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2032
diff changeset
85 public final static String XPATH_SHOW_MINIMUM =
4cdd9c4896f6 #393 Added a new Renderer and Options in Themes that allow displaying minimum and maximum of a chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2032
diff changeset
86 "/theme/field[@name='showminimum']/@default";
4cdd9c4896f6 #393 Added a new Renderer and Options in Themes that allow displaying minimum and maximum of a chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2032
diff changeset
87
4cdd9c4896f6 #393 Added a new Renderer and Options in Themes that allow displaying minimum and maximum of a chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2032
diff changeset
88 public final static String XPATH_SHOW_MAXIMUM =
4cdd9c4896f6 #393 Added a new Renderer and Options in Themes that allow displaying minimum and maximum of a chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2032
diff changeset
89 "/theme/field[@name='showmaximum']/@default";
4cdd9c4896f6 #393 Added a new Renderer and Options in Themes that allow displaying minimum and maximum of a chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2032
diff changeset
90
2616
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
91 public final static String XPATH_WSPLGEN_FIELDS =
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
92 "/theme[@name='WSPLGEN']/field";
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
93
2016
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
94
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
95 /** 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
96 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
97 if (value == null || value.length() == 0) {
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
98 return defaultsTo;
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
99 }
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
100 if (value.equals("false")) {
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
101 return false;
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
102 }
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
103 else if (value.equals("true")) {
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
104 return true;
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
105 }
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
106 else {
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
107 return defaultsTo;
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
108 }
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
109 }
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
110
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
111
2076
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
112 public static int parseInteger(String value, int defaultsTo) {
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
113 if (value == null || value.length() == 0) {
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
114 return defaultsTo;
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
115 }
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
116
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
117 try {
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
118 return Integer.valueOf(value);
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
119 }
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
120 catch (NumberFormatException nfe) {
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
121 // do nothing
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
122 }
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
123
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
124 return defaultsTo;
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
125 }
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
126
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
127
1711
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
128 /**
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
129 * 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
130 * @param theme the theme
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
131 */
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
132 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
133 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
134 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
135 return 0;
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
136 }
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
137
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
138 try {
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
139 return Integer.valueOf(size);
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
140 }
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
141 catch (NumberFormatException nfe) {
1753
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
142 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
143 }
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
144 return 0;
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
145 }
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
146
1090
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
147
2076
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
148 public static int parsePointWidth(Document theme) {
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
149 String width = XMLUtils.xpathString(theme, XPATH_POINT_SIZE, null);
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
150
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
151 return parseInteger(width, 3);
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
152 }
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
153
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
154
1090
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
155 /**
1753
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
156 * Parses the line style, defaulting to '10'.
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
157 * @param theme The theme.
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
158 */
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
159 public static float[] parseLineStyle(Document theme) {
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
160 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
161
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
162 float[] def = {10};
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
163 if (dash == null || dash.length() == 0) {
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
164 return def;
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
165 }
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
166
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
167 String[] pattern = dash.split(",");
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
168 if(pattern.length == 1) {
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
169 return def;
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
170 }
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
171
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
172 try {
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
173 float[] dashes = new float[pattern.length];
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
174 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
175 dashes[i] = Float.parseFloat(pattern[i]);
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
176 }
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
177 return dashes;
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
178 }
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
179 catch(NumberFormatException nfe) {
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
180 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
181 return def;
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
182 }
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
183 }
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
184
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
185
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
186 /**
1738
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
187 * Parses text size, defaulting to 10.
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
188 * @param theme The theme.
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 public static int parseTextSize(Document theme) {
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
191 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
192 if (size == null || size.length() == 0) {
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
193 return 10;
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
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
196 try {
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
197 return Integer.valueOf(size);
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
198 }
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
199 catch (NumberFormatException nfe) {
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 return 10;
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
202 }
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
203
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
204
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
205 /**
1748
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
206 * 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
207 * @param theme The theme.
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
208 */
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
209 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
210 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
211 return parseBoolean(show, false);
1748
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
212 }
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
213
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
214
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
215 /**
1753
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
216 * Parses the attribute 'showlines', defaults to true.
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
217 * @param theme The theme.
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
218 */
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
219 public static boolean parseShowLine(Document theme) {
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
220 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
221 return parseBoolean(show, true);
1753
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
222 }
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
223
2648
8aaa7f4ce06a Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2616
diff changeset
224 /**
8aaa7f4ce06a Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2616
diff changeset
225 * Parses the attribute 'showlinelabel', defaults to true.
8aaa7f4ce06a Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2616
diff changeset
226 * @param theme The theme.
8aaa7f4ce06a Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2616
diff changeset
227 */
8aaa7f4ce06a Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2616
diff changeset
228 public static boolean parseShowLineLabel(Document theme) {
8aaa7f4ce06a Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2616
diff changeset
229 String show = XMLUtils.xpathString(theme, XPATH_SHOW_LINE_LABEL, null);
8aaa7f4ce06a Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2616
diff changeset
230 return parseBoolean(show, true);
8aaa7f4ce06a Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2616
diff changeset
231 }
1753
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
232
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
233 /**
1738
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
234 * Parses text color.
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
235 * @param theme The theme.
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
236 */
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
237 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
238 return parseRGB(getTextColorString(theme));
1738
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
239 }
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
240
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
241
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
242 /**
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
243 * Parses the font.
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
244 * @param theme The theme.
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
245 */
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
246 public static Font parseTextFont(Document theme) {
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
247 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
248 if (font == null || font.length() == 0) {
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
249 return null;
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
250 }
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
251
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
252 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
253 int style = parseTextStyle(theme);
415ec0223dff Renamed text background attribute and parse text attributes correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1748
diff changeset
254 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
255 return f;
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
256 }
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
257
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
258
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
259 /**
1748
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
260 * 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
261 * @param theme The theme.
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
262 */
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
263 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
264 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
265 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
266 return Font.PLAIN;
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
267 }
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
268
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
269 if (style.equals("italic")) {
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
270 return Font.ITALIC;
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 else if (style.equals("bold")) {
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
273 return Font.BOLD;
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
274 }
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
275 else {
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
276 return Font.PLAIN;
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
277 }
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
278 }
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
279
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
280
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
281 /**
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
282 * 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
283 * @param theme The theme.
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
284 */
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
285 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
286 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
287 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
288 return "vertical";
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
289 }
1750
415ec0223dff Renamed text background attribute and parse text attributes correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1748
diff changeset
290 if(o.equals("true")) {
415ec0223dff Renamed text background attribute and parse text attributes correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1748
diff changeset
291 return "horizontal";
415ec0223dff Renamed text background attribute and parse text attributes correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1748
diff changeset
292 }
415ec0223dff Renamed text background attribute and parse text attributes correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1748
diff changeset
293 else {
415ec0223dff Renamed text background attribute and parse text attributes correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1748
diff changeset
294 return "vertical";
415ec0223dff Renamed text background attribute and parse text attributes correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1748
diff changeset
295 }
1748
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
296 }
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
297
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
298
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
299 /**
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
300 * 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
301 * @param theme The theme.
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
302 */
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
303 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
304 String color = getBackgroundColorString(theme);
1748
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
305 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
306 return Color.WHITE;
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
307 }
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
308 return parseRGB(color);
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
309 }
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
310
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
311
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
312 /**
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
313 * 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
314 * false.
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
315 * @param theme The theme.
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
316 */
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
317 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
318 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
319 return parseBoolean(show, false);
1748
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
320 }
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
321
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
322
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
323 /**
1090
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
324 * 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
325 * @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
326 * @return Color, null in case of issues.
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
327 */
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
328 public static Color parseRGB(String rgbtext) {
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
329 if (rgbtext == null) {
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
330 return null;
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
331 }
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
332 String rgb[] = rgbtext.split(",");
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
333 Color c = null;
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
334 try {
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
335 c = new Color(
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
336 Integer.valueOf(rgb[0].trim()),
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
337 Integer.valueOf(rgb[1].trim()),
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
338 Integer.valueOf(rgb[2].trim()));
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
339 }
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
340 catch (NumberFormatException nfe) {
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
341 c = null;
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
342 }
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
343 return c;
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
344 }
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
345
1748
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
346
1793
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
347 public static String getLineColorString(Document theme) {
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
348 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
349 }
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
350
2016
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
351 /** Get show border as string. */
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
352 public static String getShowBorderString(Document theme) {
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
353 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
354 }
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
355
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
356 /** Get fill color as string. */
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
357 public static String getFillColorString(Document theme) {
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
358 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
359 }
1793
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
360
1878
84cf67a2a19e Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1876
diff changeset
361 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
362 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
363 }
84cf67a2a19e Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1876
diff changeset
364
84cf67a2a19e Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1876
diff changeset
365
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 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
367 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
368 }
dd467951335c Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
369
dd467951335c Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
370
1816
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
371 public static String getSymbol(Document theme) {
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
372 return XMLUtils.xpathString(theme, XPATH_SYMBOL, null);
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
373 }
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
374
2032
5746c74c69cf Added a transparency setting to area theme style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2016
diff changeset
375 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
376 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
377 }
5746c74c69cf Added a transparency setting to area theme style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2016
diff changeset
378
1816
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
379
2072
4cdd9c4896f6 #393 Added a new Renderer and Options in Themes that allow displaying minimum and maximum of a chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2032
diff changeset
380 public static String getShowMinimum(Document theme) {
4cdd9c4896f6 #393 Added a new Renderer and Options in Themes that allow displaying minimum and maximum of a chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2032
diff changeset
381 return XMLUtils.xpathString(theme, XPATH_SHOW_MINIMUM, null);
4cdd9c4896f6 #393 Added a new Renderer and Options in Themes that allow displaying minimum and maximum of a chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2032
diff changeset
382 }
4cdd9c4896f6 #393 Added a new Renderer and Options in Themes that allow displaying minimum and maximum of a chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2032
diff changeset
383
4cdd9c4896f6 #393 Added a new Renderer and Options in Themes that allow displaying minimum and maximum of a chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2032
diff changeset
384
4cdd9c4896f6 #393 Added a new Renderer and Options in Themes that allow displaying minimum and maximum of a chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2032
diff changeset
385 public static String getShowMaximum(Document theme) {
4cdd9c4896f6 #393 Added a new Renderer and Options in Themes that allow displaying minimum and maximum of a chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2032
diff changeset
386 return XMLUtils.xpathString(theme, XPATH_SHOW_MAXIMUM, null);
4cdd9c4896f6 #393 Added a new Renderer and Options in Themes that allow displaying minimum and maximum of a chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2032
diff changeset
387 }
4cdd9c4896f6 #393 Added a new Renderer and Options in Themes that allow displaying minimum and maximum of a chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2032
diff changeset
388
4cdd9c4896f6 #393 Added a new Renderer and Options in Themes that allow displaying minimum and maximum of a chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2032
diff changeset
389
1090
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
390 /**
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
391 * Gets color from color field.
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
392 * @param theme the theme document.
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
393 * @return color.
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
394 */
2016
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
395 public static Color parseFillColorField(Document theme) {
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
396 return parseRGB(getFillColorString(theme));
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
397 }
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
398
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
399 public static boolean parseShowBorder(Document theme) {
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
400 return parseBoolean(getShowBorderString(theme), false);
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
401 }
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
402
2032
5746c74c69cf Added a transparency setting to area theme style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2016
diff changeset
403 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
404 return parseBoolean(getTransparencyString(theme), false);
5746c74c69cf Added a transparency setting to area theme style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2016
diff changeset
405 }
2016
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
406
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
407 /**
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
408 * Gets color from color field.
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
409 * @param theme the theme document.
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
410 * @return color.
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
411 */
1090
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
412 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
413 return parseRGB(getLineColorString(theme));
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
414 }
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
415
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
416
2072
4cdd9c4896f6 #393 Added a new Renderer and Options in Themes that allow displaying minimum and maximum of a chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2032
diff changeset
417 public static boolean parseShowMinimum(Document theme) {
4cdd9c4896f6 #393 Added a new Renderer and Options in Themes that allow displaying minimum and maximum of a chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2032
diff changeset
418 return parseBoolean(getShowMinimum(theme), false);
4cdd9c4896f6 #393 Added a new Renderer and Options in Themes that allow displaying minimum and maximum of a chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2032
diff changeset
419 }
4cdd9c4896f6 #393 Added a new Renderer and Options in Themes that allow displaying minimum and maximum of a chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2032
diff changeset
420
4cdd9c4896f6 #393 Added a new Renderer and Options in Themes that allow displaying minimum and maximum of a chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2032
diff changeset
421 public static boolean parseShowMaximum(Document theme) {
4cdd9c4896f6 #393 Added a new Renderer and Options in Themes that allow displaying minimum and maximum of a chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2032
diff changeset
422 return parseBoolean(getShowMaximum(theme), false);
4cdd9c4896f6 #393 Added a new Renderer and Options in Themes that allow displaying minimum and maximum of a chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2032
diff changeset
423 }
4cdd9c4896f6 #393 Added a new Renderer and Options in Themes that allow displaying minimum and maximum of a chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2032
diff changeset
424
4cdd9c4896f6 #393 Added a new Renderer and Options in Themes that allow displaying minimum and maximum of a chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2032
diff changeset
425
2616
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
426 public static String createWSPLGENStyle(Document theme) {
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
427 NodeList categories = (NodeList) XMLUtils.xpath(
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
428 theme,
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
429 XPATH_WSPLGEN_FIELDS,
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
430 XPathConstants.NODESET);
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
431
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
432 return createWSPLGENStyle(categories).toString();
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
433 }
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
434
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
435 protected static MapserverStyle createWSPLGENStyle(NodeList categories) {
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
436 MapserverStyle ms = new MapserverStyle();
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
437
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
438 for (int i = 0, n = categories.getLength(); i < n; i++) {
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
439 Element cat = (Element) categories.item(i);
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
440 String color = cat.getAttribute("default");
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
441 String name = cat.getAttribute("name");
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
442
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
443 String expr;
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
444
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
445 try {
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
446 int length = name.length();
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
447 int idx = Integer.valueOf(name.substring(length-1, length));
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
448
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
449 expr = createWSPLGENExpression(idx);
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
450 }
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
451 catch (NumberFormatException nfe) {
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
452 logger.warn("Error while parsing WSPLGEN category.", nfe);
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
453 continue;
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
454 }
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
455
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
456 Clazz c = new Clazz(expr);
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
457 Style s = new Style();
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
458 s.setColor(color.replace(",", ""));
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
459 s.setSize(5);
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
460
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
461 c.addItem(new Expression("(" + expr + ")"));
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
462 c.addItem(s);
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
463
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
464 ms.addClazz(c);
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
465 }
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
466
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
467 return ms;
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
468 }
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
469
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
470
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
471 protected static String createWSPLGENExpression(int idx) {
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
472 if (idx < 5) {
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
473 int lower = idx - 1;
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
474 return "[DIFF] >= " + lower + " AND [DIFF] < " + idx;
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
475 }
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
476 else {
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
477 return "[DIFF] >= 4";
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
478 }
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
479 }
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
480
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
481
1793
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
482 public static String createMapserverStyle(Document theme) {
1816
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
483 String symbol = getSymbol(theme);
1878
84cf67a2a19e Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1876
diff changeset
484 String backcolor = getBackgroundColorString(theme);
1793
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
485 String linecolor = getLineColorString(theme);
1816
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
486
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
487 int linewidth = parseLineWidth(theme);
1793
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
488
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
489 MapserverStyle ms = new MapserverStyle();
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
490
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
491 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
492
dd467951335c Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
493 Style s = new Style();
1878
84cf67a2a19e Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1876
diff changeset
494 s.setOutlineColor(linecolor.replace(",", ""));
84cf67a2a19e Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1876
diff changeset
495
84cf67a2a19e Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1876
diff changeset
496 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
497 s.setColor(backcolor.replace(",", ""));
84cf67a2a19e Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1876
diff changeset
498 }
84cf67a2a19e Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1876
diff changeset
499
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
500 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
501 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
502 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
503
dd467951335c Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
504 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
505 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
506
dd467951335c Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
507 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
508 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
509 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
510 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
511 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
512 }
1793
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
513
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
514 ms.addClazz(c);
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
515
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
516 return ms.toString();
1090
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
517 }
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
518 }
2016
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
519 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org