annotate artifacts/src/main/java/org/dive4elements/river/utils/ThemeUtil.java @ 6049:2f50591aacc7

Add an extra class for values >= the largest class Fixes: flys/issue560
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 17 May 2013 18:21:53 +0200
parents caf9d989bd84
children ebfc161cc5c4
rev   line source
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
6 * documentation coming with Dive4Elements River for details.
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5655
diff changeset
9 package org.dive4elements.river.utils;
1090
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
10
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5655
diff changeset
11 import org.dive4elements.artifacts.common.utils.XMLUtils;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5655
diff changeset
12 import org.dive4elements.river.artifacts.model.MapserverStyle;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5655
diff changeset
13 import org.dive4elements.river.artifacts.model.MapserverStyle.Clazz;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5655
diff changeset
14 import org.dive4elements.river.artifacts.model.MapserverStyle.Expression;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5655
diff changeset
15 import org.dive4elements.river.artifacts.model.MapserverStyle.Label;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5655
diff changeset
16 import org.dive4elements.river.artifacts.model.MapserverStyle.Style;
4573
b87073a05f9d flys-client: Patch to render combobox options as clickable links.
Christian Lins <christian.lins@intevation.de>
parents: 4389
diff changeset
17
1090
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
18 import java.awt.Color;
1738
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
19 import java.awt.Font;
1090
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
20
3254
9a4707ec7800 Add styles for W(t) chart domain markers
Christian Lins <christian.lins@intevation.de>
parents: 3251
diff changeset
21 import org.apache.log4j.Logger;
1090
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
22 import org.w3c.dom.Document;
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
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 * Utility to deal with themes and their representations.
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
27 */
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
28 public class ThemeUtil {
1738
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
29
3624
84a19de5f16a issue695, fix path to showlevel style property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3561
diff changeset
30 /** Private logger. */
1738
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
31 private static Logger logger =
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
32 Logger.getLogger(ThemeUtil.class);
1738
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
33
2016
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
34 public final static String XPATH_FILL_COLOR =
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
35 "/theme/field[@name='fillcolor']/@default";
2016
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
36
1711
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
37 public final static String XPATH_LINE_COLOR =
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
38 "/theme/field[@name='linecolor']/@default";
1711
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
39
4686
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
40 public final static String XPATH_AREA_LINE_COLOR =
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
41 "/theme/field[@name='areabordercolor']/@default";
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
42
1711
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
43 public static final String XPATH_LINE_SIZE =
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
44 "/theme/field[@name='linesize']/@default";
1711
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
45
1753
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
46 public static final String XPATH_LINE_STYLE =
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
47 "/theme/field[@name='linetype']/@default";
1753
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
48
2076
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
49 public static final String XPATH_POINT_SIZE =
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
50 "/theme/field[@name='pointsize']/@default";
2076
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
51
3090
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
52 public static final String XPATH_POINT_COLOR =
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
53 "/theme/field[@name='pointcolor']/@default";
3090
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
54
2016
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
55 public final static String XPATH_SHOW_BORDER =
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
56 "/theme/field[@name='showborder']/@default";
2016
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
57
4686
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
58 public final static String XPATH_AREA_SHOW_BORDER =
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
59 "/theme/field[@name='showborder']/@default";
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
60
1748
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
61 public final static String XPATH_SHOW_POINTS =
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
62 "/theme/field[@name='showpoints']/@default";
1748
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
63
1753
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
64 public final static String XPATH_SHOW_LINE =
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
65 "/theme/field[@name='showlines']/@default";
1753
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
66
2996
55f91fae8a7b Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2674
diff changeset
67 public final static String XPATH_SHOW_VERTICAL_LINE =
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
68 "/theme/field[@name='showverticalline']/@default";
2996
55f91fae8a7b Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2674
diff changeset
69
55f91fae8a7b Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2674
diff changeset
70 public final static String XPATH_SHOW_HORIZONTAL_LINE =
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
71 "/theme/field[@name='showhorizontalline']/@default";
2996
55f91fae8a7b Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2674
diff changeset
72
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
73 public final static String XPATH_SHOW_LINE_LABEL =
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
74 "/theme/field[@name='showlinelabel']/@default";
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
75
3286
f062b5a90e26 Add showpointlabel style attribute
Christian Lins <christian.lins@intevation.de>
parents: 3256
diff changeset
76 public final static String XPATH_SHOW_POINT_LABEL =
f062b5a90e26 Add showpointlabel style attribute
Christian Lins <christian.lins@intevation.de>
parents: 3256
diff changeset
77 "/theme/field[@name='showpointlabel']/@default";
f062b5a90e26 Add showpointlabel style attribute
Christian Lins <christian.lins@intevation.de>
parents: 3256
diff changeset
78
2663
33d61e2a49a2 Added and respect two new properties of waterlevels in cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
79 public final static String XPATH_SHOW_WIDTH =
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
80 "/theme/field[@name='showwidth']/@default";
2663
33d61e2a49a2 Added and respect two new properties of waterlevels in cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
81
33d61e2a49a2 Added and respect two new properties of waterlevels in cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
82 public final static String XPATH_SHOW_LEVEL =
3624
84a19de5f16a issue695, fix path to showlevel style property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3561
diff changeset
83 "/theme/field[@name='showlevel']/@default";
2663
33d61e2a49a2 Added and respect two new properties of waterlevels in cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
84
3738
34da25796c21 Theme transparency attribute support (#840)
Christian Lins <christian.lins@intevation.de>
parents: 3624
diff changeset
85 public final static String XPATH_TRANSPARENCY =
34da25796c21 Theme transparency attribute support (#840)
Christian Lins <christian.lins@intevation.de>
parents: 3624
diff changeset
86 "/theme/field[@name='transparency']/@default";
2032
5746c74c69cf Added a transparency setting to area theme style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2016
diff changeset
87
4686
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
88 public final static String XPATH_AREA_TRANSPARENCY =
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
89 "/theme/field[@name='areatransparency']/@default";
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
90
2666
6da7e064ae90 Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2663
diff changeset
91 public final static String XPATH_SHOW_AREA =
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
92 "/theme/field[@name='showarea']/@default";
2666
6da7e064ae90 Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2663
diff changeset
93
2674
2be59d5b342c Added and respect theme prop whether or not to display (not yet calculated) middle height.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2666
diff changeset
94 public final static String XPATH_SHOW_MIDDLE_HEIGHT =
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
95 "/theme/field[@name='showmiddleheight']/@default";
1738
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
96
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
97 public final static String XPATH_LABEL_FONT_COLOR =
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
98 "/theme/field[@name='labelfontcolor']/@default";
1738
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
99
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
100 public final static String XPATH_LABEL_FONT_SIZE =
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
101 "/theme/field[@name='labelfontsize']/@default";
1711
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
102
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
103 public final static String XPATH_LABEL_FONT_FACE =
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
104 "/theme/field[@name='labelfontface']/@default";
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
105
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
106 public final static String XPATH_LABEL_FONT_STYLE =
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
107 "/theme/field[@name='labelfontstyle']/@default";
1748
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
108
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
109 public final static String XPATH_TEXT_ORIENTATION =
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
110 "/theme/field[@name='textorientation']/@default";
1748
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
111
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
112 public final static String XPATH_LABEL_BGCOLOR =
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
113 "/theme/field[@name='labelbgcolor']/@default";
1748
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
114
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
115 public final static String XPATH_LABEL_SHOW_BACKGROUND =
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
116 "/theme/field[@name='labelshowbg']/@default";
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
117
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
118 public final static String XPATH_BACKGROUND_COLOR =
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
119 "/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
120
4686
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
121 public final static String XPATH_AREA_BACKGROUND_COLOR =
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
122 "/theme/field[@name='areabgcolor']/@default";
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
123
1816
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
124 public final static String XPATH_SYMBOL =
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
125 "/theme/field[@name='symbol']/@default";
1816
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
126
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
127 public final static String XPATH_SHOW_MINIMUM =
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
128 "/theme/field[@name='showminimum']/@default";
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
129
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
130 public final static String XPATH_SHOW_MAXIMUM =
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
131 "/theme/field[@name='showmaximum']/@default";
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
132
2616
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
133 public final static String XPATH_WSPLGEN_FIELDS =
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
134 "/theme[@name='WSPLGEN']/field";
2616
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
135
4577
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4573
diff changeset
136 public final static String XPATH_WSPLGEN_STARTCOLOR =
4592
11545c3b9111 Floodmap can now be classified in the range 5 to 20 (incl.).
Christian Lins <christian.lins@intevation.de>
parents: 4577
diff changeset
137 "/theme/field[@name='startcolor']/@default";
4577
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4573
diff changeset
138
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4573
diff changeset
139 public final static String XPATH_WSPLGEN_ENDCOLOR =
4592
11545c3b9111 Floodmap can now be classified in the range 5 to 20 (incl.).
Christian Lins <christian.lins@intevation.de>
parents: 4577
diff changeset
140 "/theme/field[@name='endcolor']/@default";
4577
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4573
diff changeset
141
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4573
diff changeset
142 public final static String XPATH_WSPLGEN_NUMCLASSES =
4592
11545c3b9111 Floodmap can now be classified in the range 5 to 20 (incl.).
Christian Lins <christian.lins@intevation.de>
parents: 4577
diff changeset
143 "/theme/field[@name='numclasses']/@default";
4577
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4573
diff changeset
144
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3394
diff changeset
145 /** XPATH to bandwidth field. */
3394
f091f2f55f88 Partial implementation of bandwidths for curves (issue720).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3286
diff changeset
146 public final static String XPATH_BANDWIDTH =
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
147 "/theme/field[@name='bandwidth']/@default";
3394
f091f2f55f88 Partial implementation of bandwidths for curves (issue720).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3286
diff changeset
148
4389
ecd237428af6 ThemeUtil: Method to parse/access showextramark theme prop.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4283
diff changeset
149 /** XPATH to find showextramark field. */
ecd237428af6 ThemeUtil: Method to parse/access showextramark theme prop.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4283
diff changeset
150 public final static String XPATH_SHOWEXTRAMARK =
ecd237428af6 ThemeUtil: Method to parse/access showextramark theme prop.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4283
diff changeset
151 "/theme/field[@name='showextramark']/@default";
2016
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
152
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
153 /** 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
154 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
155 if (value == null || value.length() == 0) {
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
156 return defaultsTo;
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
157 }
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
158 if (value.equals("false")) {
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
159 return false;
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
160 }
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
161 else if (value.equals("true")) {
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
162 return true;
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
163 }
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
164 else {
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
165 return defaultsTo;
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
166 }
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
167 }
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
168
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
169
3399
e08a6352fe24 Change bandwidth theme attribute type to double (but bugged).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3395
diff changeset
170 /**
e08a6352fe24 Change bandwidth theme attribute type to double (but bugged).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3395
diff changeset
171 * Attempt converting \param value to an integer, in failing cases,
e08a6352fe24 Change bandwidth theme attribute type to double (but bugged).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3395
diff changeset
172 * return \param defaultsTo.
e08a6352fe24 Change bandwidth theme attribute type to double (but bugged).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3395
diff changeset
173 * @param value String to be converted to integer.
e08a6352fe24 Change bandwidth theme attribute type to double (but bugged).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3395
diff changeset
174 * @param defaultsTo Default to return if conversion failed.
e08a6352fe24 Change bandwidth theme attribute type to double (but bugged).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3395
diff changeset
175 * @return \param value as integer or defaultsto if conversion failed.
e08a6352fe24 Change bandwidth theme attribute type to double (but bugged).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3395
diff changeset
176 */
2076
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
177 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
178 if (value == null || value.length() == 0) {
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
179 return defaultsTo;
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
180 }
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
181
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
182 try {
3405
b0ba96bbf01d Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3399
diff changeset
183 return Integer.parseInt(value);
2076
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
184 }
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
185 catch (NumberFormatException nfe) {
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
186 // do nothing
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
187 }
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
188
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
189 return defaultsTo;
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
190 }
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
191
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
192
1711
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
193 /**
3399
e08a6352fe24 Change bandwidth theme attribute type to double (but bugged).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3395
diff changeset
194 * Attempt converting \param value to a double, in failing cases,
e08a6352fe24 Change bandwidth theme attribute type to double (but bugged).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3395
diff changeset
195 * return \param defaultsTo.
e08a6352fe24 Change bandwidth theme attribute type to double (but bugged).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3395
diff changeset
196 * @param value String to be converted to double.
e08a6352fe24 Change bandwidth theme attribute type to double (but bugged).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3395
diff changeset
197 * @param defaultsTo Default to return if conversion failed.
e08a6352fe24 Change bandwidth theme attribute type to double (but bugged).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3395
diff changeset
198 * @return \param value as integer or defaultsto if conversion failed.
e08a6352fe24 Change bandwidth theme attribute type to double (but bugged).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3395
diff changeset
199 */
e08a6352fe24 Change bandwidth theme attribute type to double (but bugged).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3395
diff changeset
200 public static double parseDouble(String value, double defaultsTo) {
e08a6352fe24 Change bandwidth theme attribute type to double (but bugged).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3395
diff changeset
201 if (value == null || value.length() == 0) {
e08a6352fe24 Change bandwidth theme attribute type to double (but bugged).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3395
diff changeset
202 return defaultsTo;
e08a6352fe24 Change bandwidth theme attribute type to double (but bugged).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3395
diff changeset
203 }
e08a6352fe24 Change bandwidth theme attribute type to double (but bugged).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3395
diff changeset
204
e08a6352fe24 Change bandwidth theme attribute type to double (but bugged).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3395
diff changeset
205 try {
3561
f7e6b35f0b5c Partly reverted Double->double change of clins.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3464
diff changeset
206 return Double.parseDouble(value);
3399
e08a6352fe24 Change bandwidth theme attribute type to double (but bugged).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3395
diff changeset
207 }
e08a6352fe24 Change bandwidth theme attribute type to double (but bugged).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3395
diff changeset
208 catch (NumberFormatException nfe) {
e08a6352fe24 Change bandwidth theme attribute type to double (but bugged).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3395
diff changeset
209 // do nothing
e08a6352fe24 Change bandwidth theme attribute type to double (but bugged).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3395
diff changeset
210 }
e08a6352fe24 Change bandwidth theme attribute type to double (but bugged).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3395
diff changeset
211
e08a6352fe24 Change bandwidth theme attribute type to double (but bugged).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3395
diff changeset
212 return defaultsTo;
e08a6352fe24 Change bandwidth theme attribute type to double (but bugged).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3395
diff changeset
213 }
e08a6352fe24 Change bandwidth theme attribute type to double (but bugged).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3395
diff changeset
214
e08a6352fe24 Change bandwidth theme attribute type to double (but bugged).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3395
diff changeset
215
e08a6352fe24 Change bandwidth theme attribute type to double (but bugged).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3395
diff changeset
216 /**
1711
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
217 * 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
218 * @param theme the theme
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
219 */
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
220 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
221 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
222 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
223 return 0;
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
224 }
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
225
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
226 try {
3405
b0ba96bbf01d Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3399
diff changeset
227 return Integer.parseInt(size);
1711
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
228 }
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
229 catch (NumberFormatException nfe) {
1753
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
230 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
231 }
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
232 return 0;
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
233 }
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1090
diff changeset
234
1090
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
235
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3394
diff changeset
236 /**
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3394
diff changeset
237 * Parse band width, defaulting to 0.
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3394
diff changeset
238 * @param theme the theme.
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3394
diff changeset
239 */
3399
e08a6352fe24 Change bandwidth theme attribute type to double (but bugged).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3395
diff changeset
240 public static double parseBandWidth(Document theme) {
3394
f091f2f55f88 Partial implementation of bandwidths for curves (issue720).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3286
diff changeset
241 String bandWidth = XMLUtils.xpathString(theme, XPATH_BANDWIDTH, null);
f091f2f55f88 Partial implementation of bandwidths for curves (issue720).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3286
diff changeset
242
3399
e08a6352fe24 Change bandwidth theme attribute type to double (but bugged).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3395
diff changeset
243 return parseDouble(bandWidth, 0);
3394
f091f2f55f88 Partial implementation of bandwidths for curves (issue720).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3286
diff changeset
244 }
f091f2f55f88 Partial implementation of bandwidths for curves (issue720).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3286
diff changeset
245
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3394
diff changeset
246
2076
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
247 public static int parsePointWidth(Document theme) {
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
248 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
249
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
250 return parseInteger(width, 3);
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
251 }
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
252
41037d51c8b6 Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2072
diff changeset
253
3090
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
254 public static Color parsePointColor(Document theme) {
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
255 String color = XMLUtils.xpathString(theme, XPATH_POINT_COLOR, null);
3155
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3098
diff changeset
256 logger.debug("parsePointColor(): color = " + color);
3090
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
257 return parseColor(color);
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
258 }
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
259
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
260
1090
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
261 /**
1753
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
262 * Parses the line style, defaulting to '10'.
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
263 * @param theme The theme.
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
264 */
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
265 public static float[] parseLineStyle(Document theme) {
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
266 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
267
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
268 float[] def = {10};
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
269 if (dash == null || dash.length() == 0) {
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
270 return def;
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
271 }
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
272
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
273 String[] pattern = dash.split(",");
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
274 if(pattern.length == 1) {
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
275 return def;
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
276 }
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
277
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
278 try {
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
279 float[] dashes = new float[pattern.length];
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
280 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
281 dashes[i] = Float.parseFloat(pattern[i]);
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
282 }
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
283 return dashes;
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
284 }
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
285 catch(NumberFormatException nfe) {
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
286 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
287 return def;
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
288 }
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
289 }
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
290
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
291
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
292 /**
1738
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
293 * Parses text size, defaulting to 10.
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
294 * @param theme The theme.
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
295 */
2656
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2648
diff changeset
296 public static int parseTextSize(Document theme, String path) {
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2648
diff changeset
297 String size = XMLUtils.xpathString(theme, path, null);
1738
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
298 if (size == null || size.length() == 0) {
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
299 return 10;
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
300 }
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
301
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
302 try {
3405
b0ba96bbf01d Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3399
diff changeset
303 return Integer.parseInt(size);
1738
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
304 }
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
305 catch (NumberFormatException nfe) {
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
306 }
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
307 return 10;
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
308 }
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
309
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
310
2656
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2648
diff changeset
311 public static int parseTextSize(Document theme) {
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
312 return parseTextSize(theme, XPATH_LABEL_FONT_SIZE);
2656
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2648
diff changeset
313 }
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2648
diff changeset
314
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2648
diff changeset
315
1738
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
316 /**
4389
ecd237428af6 ThemeUtil: Method to parse/access showextramark theme prop.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4283
diff changeset
317 * Parses the attribute 'showextramark', defaults to false.
ecd237428af6 ThemeUtil: Method to parse/access showextramark theme prop.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4283
diff changeset
318 * @param theme The theme.
ecd237428af6 ThemeUtil: Method to parse/access showextramark theme prop.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4283
diff changeset
319 */
ecd237428af6 ThemeUtil: Method to parse/access showextramark theme prop.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4283
diff changeset
320 public static boolean parseShowExtraMark(Document theme) {
ecd237428af6 ThemeUtil: Method to parse/access showextramark theme prop.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4283
diff changeset
321 String show = XMLUtils.xpathString(theme, XPATH_SHOWEXTRAMARK, null);
ecd237428af6 ThemeUtil: Method to parse/access showextramark theme prop.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4283
diff changeset
322 return parseBoolean(show, false);
ecd237428af6 ThemeUtil: Method to parse/access showextramark theme prop.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4283
diff changeset
323 }
ecd237428af6 ThemeUtil: Method to parse/access showextramark theme prop.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4283
diff changeset
324
ecd237428af6 ThemeUtil: Method to parse/access showextramark theme prop.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4283
diff changeset
325 /**
1748
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
326 * 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
327 * @param theme The theme.
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
328 */
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
329 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
330 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
331 return parseBoolean(show, false);
1748
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
332 }
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
333
2666
6da7e064ae90 Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2663
diff changeset
334 /**
2674
2be59d5b342c Added and respect theme prop whether or not to display (not yet calculated) middle height.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2666
diff changeset
335 * Parses the attribute 'showmiddleheight', defaults to false.
2be59d5b342c Added and respect theme prop whether or not to display (not yet calculated) middle height.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2666
diff changeset
336 * @param theme The theme.
2be59d5b342c Added and respect theme prop whether or not to display (not yet calculated) middle height.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2666
diff changeset
337 */
2be59d5b342c Added and respect theme prop whether or not to display (not yet calculated) middle height.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2666
diff changeset
338 public static boolean parseShowMiddleHeight(Document theme) {
2be59d5b342c Added and respect theme prop whether or not to display (not yet calculated) middle height.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2666
diff changeset
339 String show = XMLUtils.xpathString(theme, XPATH_SHOW_MIDDLE_HEIGHT, null);
2be59d5b342c Added and respect theme prop whether or not to display (not yet calculated) middle height.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2666
diff changeset
340 return parseBoolean(show, false);
2be59d5b342c Added and respect theme prop whether or not to display (not yet calculated) middle height.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2666
diff changeset
341 }
2be59d5b342c Added and respect theme prop whether or not to display (not yet calculated) middle height.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2666
diff changeset
342
2be59d5b342c Added and respect theme prop whether or not to display (not yet calculated) middle height.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2666
diff changeset
343 /**
2666
6da7e064ae90 Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2663
diff changeset
344 * Parses the attribute 'showarea', defaults to false.
6da7e064ae90 Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2663
diff changeset
345 * @param theme The theme.
6da7e064ae90 Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2663
diff changeset
346 */
6da7e064ae90 Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2663
diff changeset
347 public static boolean parseShowArea(Document theme) {
6da7e064ae90 Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2663
diff changeset
348 String show = XMLUtils.xpathString(theme, XPATH_SHOW_AREA, null);
6da7e064ae90 Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2663
diff changeset
349 return parseBoolean(show, false);
6da7e064ae90 Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2663
diff changeset
350 }
1748
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
351
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
352 /**
2996
55f91fae8a7b Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2674
diff changeset
353 * Parses the attribute 'showverticalline', defaults to true.
55f91fae8a7b Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2674
diff changeset
354 * @param theme The theme.
55f91fae8a7b Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2674
diff changeset
355 */
55f91fae8a7b Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2674
diff changeset
356 public static boolean parseShowVerticalLine(Document theme) {
55f91fae8a7b Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2674
diff changeset
357 String show = XMLUtils.xpathString(theme, XPATH_SHOW_VERTICAL_LINE, null);
55f91fae8a7b Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2674
diff changeset
358 return parseBoolean(show, true);
55f91fae8a7b Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2674
diff changeset
359 }
55f91fae8a7b Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2674
diff changeset
360
55f91fae8a7b Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2674
diff changeset
361 /**
55f91fae8a7b Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2674
diff changeset
362 * Parses the attribute 'showhorizontalline', defaults to true.
55f91fae8a7b Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2674
diff changeset
363 * @param theme The theme.
55f91fae8a7b Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2674
diff changeset
364 */
55f91fae8a7b Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2674
diff changeset
365 public static boolean parseShowHorizontalLine(Document theme) {
55f91fae8a7b Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2674
diff changeset
366 String show = XMLUtils.xpathString(theme, XPATH_SHOW_HORIZONTAL_LINE, null);
55f91fae8a7b Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2674
diff changeset
367 return parseBoolean(show, true);
55f91fae8a7b Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2674
diff changeset
368 }
55f91fae8a7b Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2674
diff changeset
369
55f91fae8a7b Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2674
diff changeset
370 /**
1753
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
371 * Parses the attribute 'showlines', defaults to true.
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
372 * @param theme The theme.
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
373 */
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
374 public static boolean parseShowLine(Document theme) {
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
375 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
376 return parseBoolean(show, true);
1753
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
377 }
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
378
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
379 /**
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
380 * 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
381 * @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
382 */
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
383 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
384 String show = XMLUtils.xpathString(theme, XPATH_SHOW_LINE_LABEL, null);
3098
1d79c85bd8c2 Line labels are not visible until the option is set by the user (or configured in a theme).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3090
diff changeset
385 return parseBoolean(show, false);
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
386 }
1753
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
387
3286
f062b5a90e26 Add showpointlabel style attribute
Christian Lins <christian.lins@intevation.de>
parents: 3256
diff changeset
388 public static boolean parseShowPointLabel(Document theme) {
f062b5a90e26 Add showpointlabel style attribute
Christian Lins <christian.lins@intevation.de>
parents: 3256
diff changeset
389 String show = XMLUtils.xpathString(theme, XPATH_SHOW_POINT_LABEL, null);
f062b5a90e26 Add showpointlabel style attribute
Christian Lins <christian.lins@intevation.de>
parents: 3256
diff changeset
390 return parseBoolean(show, false);
f062b5a90e26 Add showpointlabel style attribute
Christian Lins <christian.lins@intevation.de>
parents: 3256
diff changeset
391 }
f062b5a90e26 Add showpointlabel style attribute
Christian Lins <christian.lins@intevation.de>
parents: 3256
diff changeset
392
1753
741ba9e34c7d Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1750
diff changeset
393 /**
1738
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
394 * Parses text color.
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
395 * @param theme The theme.
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
396 */
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
397 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
398 return parseRGB(getTextColorString(theme));
1738
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
399 }
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
400
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2996
diff changeset
401
1738
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
402 /**
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
403 * Parses the font.
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
404 * @param theme The theme.
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
405 */
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
406 public static Font parseTextFont(Document theme) {
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
407 String font = XMLUtils.xpathString(theme, XPATH_LABEL_FONT_FACE, null);
1738
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
408 if (font == null || font.length() == 0) {
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
409 return null;
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
410 }
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
411
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
412 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
413 int style = parseTextStyle(theme);
415ec0223dff Renamed text background attribute and parse text attributes correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1748
diff changeset
414 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
415 return f;
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
416 }
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
417
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
418
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
419 /**
1748
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
420 * 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
421 * @param theme The theme.
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
422 */
2656
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2648
diff changeset
423 public static int parseTextStyle(Document theme, String path) {
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2648
diff changeset
424 String style = XMLUtils.xpathString(theme, path, null);
1748
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
425 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
426 return Font.PLAIN;
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
427 }
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
428
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
429 if (style.equals("italic")) {
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
430 return Font.ITALIC;
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
431 }
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
432 else if (style.equals("bold")) {
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
433 return Font.BOLD;
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
434 }
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
435 else {
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
436 return Font.PLAIN;
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
437 }
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
438 }
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
439
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
440
2656
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2648
diff changeset
441 public static int parseTextStyle(Document theme) {
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
442 return parseTextStyle(theme, XPATH_LABEL_FONT_STYLE);
2656
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2648
diff changeset
443 }
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2648
diff changeset
444
f1dcd5f94ffa Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2648
diff changeset
445
2663
33d61e2a49a2 Added and respect two new properties of waterlevels in cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
446 public static boolean parseShowWidth(Document theme) {
33d61e2a49a2 Added and respect two new properties of waterlevels in cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
447 String show = XMLUtils.xpathString(theme, XPATH_SHOW_WIDTH, null);
33d61e2a49a2 Added and respect two new properties of waterlevels in cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
448 return parseBoolean(show, false);
33d61e2a49a2 Added and respect two new properties of waterlevels in cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
449 }
33d61e2a49a2 Added and respect two new properties of waterlevels in cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
450
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
451
2663
33d61e2a49a2 Added and respect two new properties of waterlevels in cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
452 public static boolean parseShowLevel(Document theme) {
33d61e2a49a2 Added and respect two new properties of waterlevels in cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
453 String show = XMLUtils.xpathString(theme, XPATH_SHOW_LEVEL, null);
33d61e2a49a2 Added and respect two new properties of waterlevels in cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
454 return parseBoolean(show, false);
33d61e2a49a2 Added and respect two new properties of waterlevels in cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
455 }
33d61e2a49a2 Added and respect two new properties of waterlevels in cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2662
diff changeset
456
1748
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
457 /**
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
458 * 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
459 * @param theme The theme.
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
460 */
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
461 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
462 String o = XMLUtils.xpathString(theme, XPATH_TEXT_ORIENTATION, null);
3205
bbb488b145ce Set text orientation to horizontal for points in Fixation W/Q curve
Christian Lins <christian.lins@intevation.de>
parents: 3160
diff changeset
463 if ("true".equals(o)) {
1750
415ec0223dff Renamed text background attribute and parse text attributes correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1748
diff changeset
464 return "horizontal";
415ec0223dff Renamed text background attribute and parse text attributes correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1748
diff changeset
465 }
415ec0223dff Renamed text background attribute and parse text attributes correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1748
diff changeset
466 else {
415ec0223dff Renamed text background attribute and parse text attributes correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1748
diff changeset
467 return "vertical";
415ec0223dff Renamed text background attribute and parse text attributes correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1748
diff changeset
468 }
1748
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
469 }
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
470
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
471
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
472 /**
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
473 * 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
474 * @param theme The theme.
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
475 */
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
476 public static Color parseTextBackground(Document theme) {
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
477 String color = getLabelBackgroundColorString(theme);
1748
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
478 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
479 return Color.WHITE;
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
480 }
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
481 return parseRGB(color);
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
482 }
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
483
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
484
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
485 /**
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
486 * 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
487 * false.
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
488 * @param theme The theme.
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
489 */
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
490 public static boolean parseLabelShowBackground(Document theme) {
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
491 String show = XMLUtils.xpathString(theme, XPATH_LABEL_SHOW_BACKGROUND, null);
2662
bdc86e61428c Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2660
diff changeset
492 return parseBoolean(show, false);
bdc86e61428c Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2660
diff changeset
493 }
bdc86e61428c Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2660
diff changeset
494
3090
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
495
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
496 public static Color parseColor(String colorString) {
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
497 if (colorString == null || colorString.length() == 0) {
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
498 return null;
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
499 }
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
500 else if (colorString.indexOf("#") == 0) {
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
501 return parseHexColor(colorString);
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
502 }
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
503 else if (colorString.indexOf(",") >= 0) {
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
504 return parseRGB(colorString);
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
505 }
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
506
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
507 return null;
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
508 }
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
509
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
510
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
511 /**
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
512 * Parse a string like "#00CC22" and return the corresponding color.
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
513 *
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
514 * @param hex The hex color value.
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
515 *
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
516 * @return a Color or null, if <i>hex</i> is empty.
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
517 */
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
518 public static Color parseHexColor(String hex) {
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
519 if (hex == null) {
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
520 return null;
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
521 }
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
522
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
523 return Color.decode(hex);
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
524 }
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
525
2662
bdc86e61428c Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2660
diff changeset
526 /**
1090
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
527 * 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
528 * @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
529 * @return Color, null in case of issues.
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
530 */
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
531 public static Color parseRGB(String rgbtext) {
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
532 if (rgbtext == null) {
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
533 return null;
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
534 }
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
535 String rgb[] = rgbtext.split(",");
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
536 Color c = null;
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
537 try {
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
538 c = new Color(
3405
b0ba96bbf01d Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3399
diff changeset
539 Integer.parseInt(rgb[0].trim()),
b0ba96bbf01d Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3399
diff changeset
540 Integer.parseInt(rgb[1].trim()),
b0ba96bbf01d Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3399
diff changeset
541 Integer.parseInt(rgb[2].trim()));
1090
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
542 }
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
543 catch (NumberFormatException nfe) {
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
544 c = null;
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
545 }
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
546 return c;
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
547 }
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
548
1748
d56b94325bec Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1738
diff changeset
549
1793
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
550 public static String getLineColorString(Document theme) {
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
551 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
552 }
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
553
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
554
2016
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
555 /** Get show border as string. */
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
556 public static String getShowBorderString(Document theme) {
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
557 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
558 }
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
559
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
560
2016
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
561 /** Get fill color as string. */
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
562 public static String getFillColorString(Document theme) {
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
563 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
564 }
1793
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
565
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
566
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
567 public static String getLabelBackgroundColorString(Document theme) {
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
568 return XMLUtils.xpathString(theme, XPATH_LABEL_BGCOLOR, null);
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
569 }
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
570
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
571
1878
84cf67a2a19e Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1876
diff changeset
572 public static String getBackgroundColorString(Document theme) {
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
573 return XMLUtils.xpathString(theme, XPATH_BACKGROUND_COLOR, null);
1878
84cf67a2a19e Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1876
diff changeset
574 }
84cf67a2a19e Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1876
diff changeset
575
84cf67a2a19e Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1876
diff changeset
576
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
577 public static String getTextColorString(Document theme) {
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
578 String textColor = XMLUtils.xpathString(theme, XPATH_LABEL_FONT_COLOR, null);
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
579 return textColor;
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
580 }
dd467951335c Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
581
dd467951335c Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
582
1816
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
583 public static String getSymbol(Document theme) {
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
584 return XMLUtils.xpathString(theme, XPATH_SYMBOL, null);
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
585 }
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
586
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
587
2032
5746c74c69cf Added a transparency setting to area theme style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2016
diff changeset
588 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
589 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
590 }
3256
17ca0a43027a Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3254
diff changeset
591
17ca0a43027a Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3254
diff changeset
592
4686
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
593 public static String getAreaTransparencyString(Document theme) {
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
594 return XMLUtils.xpathString(theme, XPATH_AREA_TRANSPARENCY, null);
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
595 }
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
596
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
597
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
598 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
599 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
600 }
3256
17ca0a43027a Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3254
diff changeset
601
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
602
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
603 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
604 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
605 }
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
606
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
607
1090
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
608 /**
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
609 * Gets color from color field.
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
610 * @param theme the theme document.
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
611 * @return color.
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
612 */
2016
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
613 public static Color parseFillColorField(Document theme) {
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
614 return parseRGB(getFillColorString(theme));
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
615 }
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
616
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
617
2016
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
618 public static boolean parseShowBorder(Document theme) {
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
619 return parseBoolean(getShowBorderString(theme), false);
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
620 }
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
621
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
622
3889
940cd2ef149f Area transparency fix
Christian Lins <christian.lins@intevation.de>
parents: 3738
diff changeset
623 public static int parseTransparency(Document theme) {
940cd2ef149f Area transparency fix
Christian Lins <christian.lins@intevation.de>
parents: 3738
diff changeset
624 return parseInteger(getTransparencyString(theme), 50);
2032
5746c74c69cf Added a transparency setting to area theme style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2016
diff changeset
625 }
2016
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
626
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
627
2016
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
628 /**
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
629 * Gets color from color field.
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
630 * @param theme the theme document.
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
631 * @return color.
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
632 */
1090
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
633 public static Color parseLineColorField(Document theme) {
3155
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3098
diff changeset
634 String lineColorStr = getLineColorString(theme);
3160
8c78c707aa2d Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3155
diff changeset
635 logger.debug("parseLineColorField: lineColorStr = " +
3155
74c974b10c75 Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents: 3098
diff changeset
636 (lineColorStr == null ? "null" : lineColorStr));
4283
7140bb0f92b0 Added new themes for W and Q markers in Historical Discharge WQ charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3889
diff changeset
637 return parseColor(lineColorStr);
1793
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
638 }
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
639
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
640
4686
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
641 public static Color parseAreaLineColorField(Document theme) {
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
642 String lineColorStr = getAreaLineColorString(theme);
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
643 logger.debug("parseLineColorField: lineColorStr = " +
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
644 (lineColorStr == null ? "null" : lineColorStr));
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
645 return parseColor(lineColorStr);
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
646 }
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
647
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
648
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
649 private static String getAreaLineColorString(Document theme) {
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
650 return XMLUtils.xpathString(theme, XPATH_AREA_LINE_COLOR, null);
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
651 }
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
652
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
653
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
654 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
655 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
656 }
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
657
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
658
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
659 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
660 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
661 }
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
662
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
663
4633
fc52ee878412 Preparations for autogenerated riveraxis WMSs.
Christian Lins <christian.lins@intevation.de>
parents: 4593
diff changeset
664 /**
fc52ee878412 Preparations for autogenerated riveraxis WMSs.
Christian Lins <christian.lins@intevation.de>
parents: 4593
diff changeset
665 * Creates a MapserverStyle from the given XML theme.
fc52ee878412 Preparations for autogenerated riveraxis WMSs.
Christian Lins <christian.lins@intevation.de>
parents: 4593
diff changeset
666 * This method uses a start- and endcolor to interpolate a
fc52ee878412 Preparations for autogenerated riveraxis WMSs.
Christian Lins <christian.lins@intevation.de>
parents: 4593
diff changeset
667 * given number of color classes for the MapserverStyle.
fc52ee878412 Preparations for autogenerated riveraxis WMSs.
Christian Lins <christian.lins@intevation.de>
parents: 4593
diff changeset
668 * @param theme
fc52ee878412 Preparations for autogenerated riveraxis WMSs.
Christian Lins <christian.lins@intevation.de>
parents: 4593
diff changeset
669 * @return String representation of the MapserverStyle
fc52ee878412 Preparations for autogenerated riveraxis WMSs.
Christian Lins <christian.lins@intevation.de>
parents: 4593
diff changeset
670 */
5655
53a2ceeae9a3 Create floodmap colorrange dynamically from artifact parameters. Theme setting for colorrange classes is currently not functioning (wasn't before either).
Christian Lins <christian.lins@intevation.de>
parents: 4864
diff changeset
671 public static String createDynamicMapserverStyle(Document theme,
53a2ceeae9a3 Create floodmap colorrange dynamically from artifact parameters. Theme setting for colorrange classes is currently not functioning (wasn't before either).
Christian Lins <christian.lins@intevation.de>
parents: 4864
diff changeset
672 float from, float to, float step)
53a2ceeae9a3 Create floodmap colorrange dynamically from artifact parameters. Theme setting for colorrange classes is currently not functioning (wasn't before either).
Christian Lins <christian.lins@intevation.de>
parents: 4864
diff changeset
673 {
4577
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4573
diff changeset
674 MapserverStyle ms = new MapserverStyle();
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4573
diff changeset
675
4592
11545c3b9111 Floodmap can now be classified in the range 5 to 20 (incl.).
Christian Lins <christian.lins@intevation.de>
parents: 4577
diff changeset
676 String strStartColor = XMLUtils.xpathString(theme, XPATH_WSPLGEN_STARTCOLOR, null);
11545c3b9111 Floodmap can now be classified in the range 5 to 20 (incl.).
Christian Lins <christian.lins@intevation.de>
parents: 4577
diff changeset
677 Color startColor = strStartColor != null ? parseColor(strStartColor) : new Color(178, 201, 215);
11545c3b9111 Floodmap can now be classified in the range 5 to 20 (incl.).
Christian Lins <christian.lins@intevation.de>
parents: 4577
diff changeset
678 String strEndColor = XMLUtils.xpathString(theme, XPATH_WSPLGEN_ENDCOLOR, null);
11545c3b9111 Floodmap can now be classified in the range 5 to 20 (incl.).
Christian Lins <christian.lins@intevation.de>
parents: 4577
diff changeset
679 Color endColor = strEndColor != null? parseColor(strEndColor) : new Color(2, 27, 42);
4577
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4573
diff changeset
680
6048
caf9d989bd84 Fix waterlevel classes and change defaults for them.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
681 to = to != 0 ? to : 9999;
caf9d989bd84 Fix waterlevel classes and change defaults for them.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
682 step = step != 0 ? step : to;
5655
53a2ceeae9a3 Create floodmap colorrange dynamically from artifact parameters. Theme setting for colorrange classes is currently not functioning (wasn't before either).
Christian Lins <christian.lins@intevation.de>
parents: 4864
diff changeset
683
53a2ceeae9a3 Create floodmap colorrange dynamically from artifact parameters. Theme setting for colorrange classes is currently not functioning (wasn't before either).
Christian Lins <christian.lins@intevation.de>
parents: 4864
diff changeset
684 int numClasses = (int)((to - from) / step);
4577
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4573
diff changeset
685
4593
047c965ea542 Use floating point calculation for floodmap colors.
Christian Lins <christian.lins@intevation.de>
parents: 4592
diff changeset
686 float rd = (endColor.getRed() - startColor.getRed()) / (float)numClasses;
047c965ea542 Use floating point calculation for floodmap colors.
Christian Lins <christian.lins@intevation.de>
parents: 4592
diff changeset
687 float gd = (endColor.getGreen() - startColor.getGreen()) / (float)numClasses;
047c965ea542 Use floating point calculation for floodmap colors.
Christian Lins <christian.lins@intevation.de>
parents: 4592
diff changeset
688 float bd = (endColor.getBlue() - startColor.getBlue()) / (float)numClasses;
4577
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4573
diff changeset
689
6049
2f50591aacc7 Add an extra class for values >= the largest class
Andre Heinecke <aheinecke@intevation.de>
parents: 6048
diff changeset
690 if (numClasses > 1) {
2f50591aacc7 Add an extra class for values >= the largest class
Andre Heinecke <aheinecke@intevation.de>
parents: 6048
diff changeset
691 // Desktop Flys always added a last "and larger class"
2f50591aacc7 Add an extra class for values >= the largest class
Andre Heinecke <aheinecke@intevation.de>
parents: 6048
diff changeset
692 numClasses += 1;
2f50591aacc7 Add an extra class for values >= the largest class
Andre Heinecke <aheinecke@intevation.de>
parents: 6048
diff changeset
693 }
2f50591aacc7 Add an extra class for values >= the largest class
Andre Heinecke <aheinecke@intevation.de>
parents: 6048
diff changeset
694
4577
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4573
diff changeset
695 for (int n = 0; n < numClasses; n++) {
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4573
diff changeset
696 StringBuilder newColor = new StringBuilder();
4593
047c965ea542 Use floating point calculation for floodmap colors.
Christian Lins <christian.lins@intevation.de>
parents: 4592
diff changeset
697 newColor.append(startColor.getRed() + Math.round(n * rd));
4577
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4573
diff changeset
698 newColor.append(' ');
4593
047c965ea542 Use floating point calculation for floodmap colors.
Christian Lins <christian.lins@intevation.de>
parents: 4592
diff changeset
699 newColor.append(startColor.getGreen() + Math.round(n * gd));
4577
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4573
diff changeset
700 newColor.append(' ');
4593
047c965ea542 Use floating point calculation for floodmap colors.
Christian Lins <christian.lins@intevation.de>
parents: 4592
diff changeset
701 newColor.append(startColor.getBlue() + Math.round(n * bd));
4577
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4573
diff changeset
702
5655
53a2ceeae9a3 Create floodmap colorrange dynamically from artifact parameters. Theme setting for colorrange classes is currently not functioning (wasn't before either).
Christian Lins <christian.lins@intevation.de>
parents: 4864
diff changeset
703 String expr = createWSPLGENExpression(from + n * step, step, n + 1, numClasses);
4592
11545c3b9111 Floodmap can now be classified in the range 5 to 20 (incl.).
Christian Lins <christian.lins@intevation.de>
parents: 4577
diff changeset
704
11545c3b9111 Floodmap can now be classified in the range 5 to 20 (incl.).
Christian Lins <christian.lins@intevation.de>
parents: 4577
diff changeset
705 Clazz c = new Clazz(expr);
4577
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4573
diff changeset
706 Style s = new Style();
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4573
diff changeset
707 s.setColor(newColor.toString());
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4573
diff changeset
708 s.setSize(5);
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4573
diff changeset
709
2616
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
710 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
711 c.addItem(s);
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
712
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
713 ms.addClazz(c);
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
714 }
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
715
4592
11545c3b9111 Floodmap can now be classified in the range 5 to 20 (incl.).
Christian Lins <christian.lins@intevation.de>
parents: 4577
diff changeset
716 return ms.toString();
2616
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
717 }
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
718
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
719
5655
53a2ceeae9a3 Create floodmap colorrange dynamically from artifact parameters. Theme setting for colorrange classes is currently not functioning (wasn't before either).
Christian Lins <christian.lins@intevation.de>
parents: 4864
diff changeset
720 protected static String createWSPLGENExpression(float val, float step, int idx, int maxIdx) {
4592
11545c3b9111 Floodmap can now be classified in the range 5 to 20 (incl.).
Christian Lins <christian.lins@intevation.de>
parents: 4577
diff changeset
721 if (idx < maxIdx) {
5655
53a2ceeae9a3 Create floodmap colorrange dynamically from artifact parameters. Theme setting for colorrange classes is currently not functioning (wasn't before either).
Christian Lins <christian.lins@intevation.de>
parents: 4864
diff changeset
722 return "[DIFF] >= " + val + " AND [DIFF] < " + (val + step);
2616
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
723 }
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
724 else {
5655
53a2ceeae9a3 Create floodmap colorrange dynamically from artifact parameters. Theme setting for colorrange classes is currently not functioning (wasn't before either).
Christian Lins <christian.lins@intevation.de>
parents: 4864
diff changeset
725 return "[DIFF] >= " + val;
2616
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
726 }
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
727 }
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
728
27cc95e65f18 Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2076
diff changeset
729
1793
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
730 public static String createMapserverStyle(Document theme) {
1816
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
731 String symbol = getSymbol(theme);
3464
0b9b2a0c4e64 Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents: 3405
diff changeset
732 String backcolor = getLabelBackgroundColorString(theme);
1793
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
733 String linecolor = getLineColorString(theme);
4864
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4686
diff changeset
734 if (linecolor == null || "".equals(linecolor)) {
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4686
diff changeset
735 logger.warn("createMapserverStyle: linecolor String is empty");
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4686
diff changeset
736 linecolor = "0,128,255";
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4686
diff changeset
737 }
1816
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
738
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
739 int linewidth = parseLineWidth(theme);
1793
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
740
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
741 MapserverStyle ms = new MapserverStyle();
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
742
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
743 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
744
dd467951335c Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
745 Style s = new Style();
4864
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4686
diff changeset
746 s.setOutlineColor(linecolor.replace(",", " "));
1878
84cf67a2a19e Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1876
diff changeset
747
84cf67a2a19e Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1876
diff changeset
748 if (backcolor != null && backcolor.length() > 0) {
4864
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4686
diff changeset
749 s.setColor(backcolor.replace(",", " "));
1878
84cf67a2a19e Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1876
diff changeset
750 }
84cf67a2a19e Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1876
diff changeset
751
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
752 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
753 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
754 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
755
dd467951335c Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
756 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
757 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
758
dd467951335c Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
759 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
760 Label l = new Label();
4864
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4686
diff changeset
761 l.setColor(textcolor.replace(",", " "));
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
762 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
763 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
764 }
1793
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
765
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
766 ms.addClazz(c);
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
767
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1753
diff changeset
768 return ms.toString();
1090
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
769 }
4686
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
770
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
771
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
772 public static String getAreaBackgroundColorString(Document theme) {
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
773 return XMLUtils.xpathString(theme, XPATH_AREA_BACKGROUND_COLOR, null);
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
774 }
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
775
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
776
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
777 public static Color parseAreaBackgroundColor(Document theme) {
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
778 return parseColor(getAreaBackgroundColorString(theme));
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
779 }
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
780
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
781
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
782 public static int parseAreaTransparency(Document theme) {
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
783 return parseInteger(getAreaTransparencyString(theme), 50);
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
784 }
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
785
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
786
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
787 public static boolean parseAreaShowBorder(Document theme) {
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
788 return parseBoolean(getAreaShowBorderString(theme), false);
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
789 }
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
790
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
791
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
792 private static String getAreaShowBorderString(Document theme) {
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
793 return XMLUtils.xpathString(theme, XPATH_AREA_SHOW_BORDER, null);
85876e3a5346 Fixed and improved theme handling for areas.
Raimund Renkert <rrenkert@intevation.de>
parents: 4633
diff changeset
794 }
1090
9324839684a4 New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
795 }
2016
796dfe96b6b2 Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1878
diff changeset
796 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org