Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java @ 3273:739aa90eb79e
Fix issue694.
flys-artifacts/trunk@4917 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 10 Jul 2012 16:04:44 +0000 |
parents | 17ca0a43027a |
children | f062b5a90e26 |
rev | line source |
---|---|
1090
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.utils; |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 |
3254
9a4707ec7800
Add styles for W(t) chart domain markers
Christian Lins <christian.lins@intevation.de>
parents:
3251
diff
changeset
|
3 import de.intevation.artifacts.common.utils.XMLUtils; |
9a4707ec7800
Add styles for W(t) chart domain markers
Christian Lins <christian.lins@intevation.de>
parents:
3251
diff
changeset
|
4 import de.intevation.flys.artifacts.model.MapserverStyle; |
9a4707ec7800
Add styles for W(t) chart domain markers
Christian Lins <christian.lins@intevation.de>
parents:
3251
diff
changeset
|
5 import de.intevation.flys.artifacts.model.MapserverStyle.Clazz; |
9a4707ec7800
Add styles for W(t) chart domain markers
Christian Lins <christian.lins@intevation.de>
parents:
3251
diff
changeset
|
6 import de.intevation.flys.artifacts.model.MapserverStyle.Expression; |
9a4707ec7800
Add styles for W(t) chart domain markers
Christian Lins <christian.lins@intevation.de>
parents:
3251
diff
changeset
|
7 import de.intevation.flys.artifacts.model.MapserverStyle.Label; |
9a4707ec7800
Add styles for W(t) chart domain markers
Christian Lins <christian.lins@intevation.de>
parents:
3251
diff
changeset
|
8 import de.intevation.flys.artifacts.model.MapserverStyle.Style; |
1738
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
9 |
1090
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 import java.awt.Color; |
1738
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
11 import java.awt.Font; |
1090
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
12 |
2616
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
13 import javax.xml.xpath.XPathConstants; |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
14 |
3254
9a4707ec7800
Add styles for W(t) chart domain markers
Christian Lins <christian.lins@intevation.de>
parents:
3251
diff
changeset
|
15 import org.apache.log4j.Logger; |
1090
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 import org.w3c.dom.Document; |
2616
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
17 import org.w3c.dom.Element; |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
18 import org.w3c.dom.NodeList; |
1090
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
20 |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
21 /** |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
22 * Utility to deal with themes and their representations. |
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 public class ThemeUtil { |
1738
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
25 |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
26 private static Logger logger = |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
27 Logger.getLogger(ThemeUtil.class); |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
28 |
2016
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
29 public final static String XPATH_FILL_COLOR = |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
30 "/theme/field[@name='fillcolor']/@default"; |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
31 |
1711
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
32 public final static String XPATH_LINE_COLOR = |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
33 "/theme/field[@name='linecolor']/@default"; |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
34 |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
35 public static final String XPATH_LINE_SIZE = |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
36 "/theme/field[@name='linesize']/@default"; |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
37 |
1753
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
38 public static final String XPATH_LINE_STYLE = |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
39 "/theme/field[@name='linetype']/@default"; |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
40 |
2076
41037d51c8b6
Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2072
diff
changeset
|
41 public static final String XPATH_POINT_SIZE = |
41037d51c8b6
Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2072
diff
changeset
|
42 "/theme/field[@name='pointsize']/@default"; |
41037d51c8b6
Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2072
diff
changeset
|
43 |
3090
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
44 public static final String XPATH_POINT_COLOR = |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
45 "/theme/field[@name='pointcolor']/@default"; |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
46 |
2016
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
47 public final static String XPATH_SHOW_BORDER = |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
48 "/theme/field[@name='showborder']/@default"; |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
49 |
1748
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
50 public final static String XPATH_SHOW_POINTS = |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
51 "/theme/field[@name='showpoints']/@default"; |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
52 |
1753
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
53 public final static String XPATH_SHOW_LINE = |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
54 "/theme/field[@name='showlines']/@default"; |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
55 |
2996
55f91fae8a7b
Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2674
diff
changeset
|
56 public final static String XPATH_SHOW_VERTICAL_LINE = |
55f91fae8a7b
Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2674
diff
changeset
|
57 "/theme/field[@name='showverticalline']/@default"; |
55f91fae8a7b
Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2674
diff
changeset
|
58 |
55f91fae8a7b
Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2674
diff
changeset
|
59 public final static String XPATH_SHOW_HORIZONTAL_LINE = |
55f91fae8a7b
Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2674
diff
changeset
|
60 "/theme/field[@name='showhorizontalline']/@default"; |
55f91fae8a7b
Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2674
diff
changeset
|
61 |
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
|
62 public final static String XPATH_SHOW_LINE_LABEL = |
8aaa7f4ce06a
Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2616
diff
changeset
|
63 "/theme/field[@name='showlinelabel']/@default"; |
8aaa7f4ce06a
Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2616
diff
changeset
|
64 |
2656
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
65 public final static String XPATH_LINE_LABEL_FONT = |
2659
4d8959a4b49d
Actually use font specified in theme document for linelabel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
66 "/theme/field[@name='linelabelfont']/@default"; |
2656
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
67 |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
68 public final static String XPATH_LINE_LABEL_COLOR = |
2659
4d8959a4b49d
Actually use font specified in theme document for linelabel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
69 "/theme/field[@name='linelabelcolor']/@default"; |
2656
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
70 |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
71 public final static String XPATH_LINE_LABEL_SIZE = |
2659
4d8959a4b49d
Actually use font specified in theme document for linelabel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
72 "/theme/field[@name='linelabelsize']/@default"; |
2656
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
73 |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
74 public final static String XPATH_LINE_LABEL_STYLE = |
2659
4d8959a4b49d
Actually use font specified in theme document for linelabel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
75 "/theme/field[@name='linelabelstyle']/@default"; |
2656
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
76 |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
77 public final static String XPATH_LINE_LABEL_BGCOLOR = |
2659
4d8959a4b49d
Actually use font specified in theme document for linelabel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
78 "/theme/field[@name='linelabelbgcolor']/@default"; |
2656
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
79 |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
80 public final static String XPATH_LINE_LABEL_SHOWBG = |
2659
4d8959a4b49d
Actually use font specified in theme document for linelabel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
81 "/theme/field[@name='linelabelshowbg']/@default"; |
2656
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
82 |
2663
33d61e2a49a2
Added and respect two new properties of waterlevels in cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2662
diff
changeset
|
83 public final static String XPATH_SHOW_WIDTH = |
33d61e2a49a2
Added and respect two new properties of waterlevels in cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2662
diff
changeset
|
84 "/theme/field[@name='showwidth']/@default"; |
33d61e2a49a2
Added and respect two new properties of waterlevels in cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2662
diff
changeset
|
85 |
33d61e2a49a2
Added and respect two new properties of waterlevels in cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2662
diff
changeset
|
86 public final static String XPATH_SHOW_LEVEL = |
33d61e2a49a2
Added and respect two new properties of waterlevels in cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2662
diff
changeset
|
87 "/theme/field[@name='showwidth']/@default"; |
33d61e2a49a2
Added and respect two new properties of waterlevels in cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2662
diff
changeset
|
88 |
2032
5746c74c69cf
Added a transparency setting to area theme style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2016
diff
changeset
|
89 public final static String XPATH_TRANSPARENCY = |
5746c74c69cf
Added a transparency setting to area theme style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2016
diff
changeset
|
90 "/theme/field[@name='transparent']/@default"; |
3256
17ca0a43027a
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3254
diff
changeset
|
91 |
3254
9a4707ec7800
Add styles for W(t) chart domain markers
Christian Lins <christian.lins@intevation.de>
parents:
3251
diff
changeset
|
92 public final static String XPATH_TRANSPARENCY_ALPHA = |
9a4707ec7800
Add styles for W(t) chart domain markers
Christian Lins <christian.lins@intevation.de>
parents:
3251
diff
changeset
|
93 "/theme/field[@name='alpha']/@default"; |
2032
5746c74c69cf
Added a transparency setting to area theme style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2016
diff
changeset
|
94 |
2666
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2663
diff
changeset
|
95 public final static String XPATH_SHOW_AREA = |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2663
diff
changeset
|
96 "/theme/field[@name='showarea']/@default"; |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2663
diff
changeset
|
97 |
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
|
98 public final static String XPATH_SHOW_MIDDLE_HEIGHT = |
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
|
99 "/theme/field[@name='showmiddleheight']/@default"; |
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
|
100 |
1738
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
101 public final static String XPATH_TEXT_COLOR = |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
102 "/theme/field[@name='textcolor']/@default"; |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
103 |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
104 public final static String XPATH_TEXT_SIZE = |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
105 "/theme/field[@name='textsize']/@default"; |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
106 |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
107 public final static String XPATH_TEXT_FONT = |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
108 "/theme/field[@name='font']/@default"; |
1711
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
109 |
1748
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
110 public final static String XPATH_TEXT_STYLE = |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
111 "/theme/field[@name='textstyle']/@default"; |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
112 |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
113 public final static String XPATH_TEXT_ORIENTATION = |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
114 "/theme/field[@name='textorientation']/@default"; |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
115 |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
116 public final static String XPATH_TEXT_BACKGROUND = |
1750
415ec0223dff
Renamed text background attribute and parse text attributes correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1748
diff
changeset
|
117 "/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
|
118 |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
119 public final static String XPATH_SHOW_BACKGROUND = |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
120 "/theme/field[@name='showbackground']/@default"; |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
121 |
1816
5364b86a0880
Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1793
diff
changeset
|
122 public final static String XPATH_SYMBOL = |
5364b86a0880
Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1793
diff
changeset
|
123 "/theme/field[@name='symbol']/@default"; |
5364b86a0880
Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1793
diff
changeset
|
124 |
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
|
125 public final static String XPATH_SHOW_MINIMUM = |
4cdd9c4896f6
#393 Added a new Renderer and Options in Themes that allow displaying minimum and maximum of a chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2032
diff
changeset
|
126 "/theme/field[@name='showminimum']/@default"; |
4cdd9c4896f6
#393 Added a new Renderer and Options in Themes that allow displaying minimum and maximum of a chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2032
diff
changeset
|
127 |
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
|
128 public final static String XPATH_SHOW_MAXIMUM = |
4cdd9c4896f6
#393 Added a new Renderer and Options in Themes that allow displaying minimum and maximum of a chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2032
diff
changeset
|
129 "/theme/field[@name='showmaximum']/@default"; |
4cdd9c4896f6
#393 Added a new Renderer and Options in Themes that allow displaying minimum and maximum of a chart series.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2032
diff
changeset
|
130 |
2616
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
131 public final static String XPATH_WSPLGEN_FIELDS = |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
132 "/theme[@name='WSPLGEN']/field"; |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
133 |
2016
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
134 |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
135 /** 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
|
136 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
|
137 if (value == null || value.length() == 0) { |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
138 return defaultsTo; |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
139 } |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
140 if (value.equals("false")) { |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
141 return false; |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
142 } |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
143 else if (value.equals("true")) { |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
144 return true; |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
145 } |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
146 else { |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
147 return defaultsTo; |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
148 } |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
149 } |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
150 |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
151 |
2076
41037d51c8b6
Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2072
diff
changeset
|
152 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
|
153 if (value == null || value.length() == 0) { |
41037d51c8b6
Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2072
diff
changeset
|
154 return defaultsTo; |
41037d51c8b6
Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2072
diff
changeset
|
155 } |
41037d51c8b6
Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2072
diff
changeset
|
156 |
41037d51c8b6
Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2072
diff
changeset
|
157 try { |
41037d51c8b6
Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2072
diff
changeset
|
158 return Integer.valueOf(value); |
41037d51c8b6
Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2072
diff
changeset
|
159 } |
41037d51c8b6
Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2072
diff
changeset
|
160 catch (NumberFormatException nfe) { |
41037d51c8b6
Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2072
diff
changeset
|
161 // do nothing |
41037d51c8b6
Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2072
diff
changeset
|
162 } |
41037d51c8b6
Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2072
diff
changeset
|
163 |
41037d51c8b6
Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2072
diff
changeset
|
164 return defaultsTo; |
41037d51c8b6
Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2072
diff
changeset
|
165 } |
41037d51c8b6
Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2072
diff
changeset
|
166 |
41037d51c8b6
Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2072
diff
changeset
|
167 |
1711
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
168 /** |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
169 * 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
|
170 * @param theme the theme |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
171 */ |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
172 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
|
173 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
|
174 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
|
175 return 0; |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
176 } |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
177 |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
178 try { |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
179 return Integer.valueOf(size); |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
180 } |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
181 catch (NumberFormatException nfe) { |
1753
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
182 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
|
183 } |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
184 return 0; |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
185 } |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
186 |
1090
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
187 |
2076
41037d51c8b6
Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2072
diff
changeset
|
188 public static int parsePointWidth(Document theme) { |
41037d51c8b6
Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2072
diff
changeset
|
189 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
|
190 |
41037d51c8b6
Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2072
diff
changeset
|
191 return parseInteger(width, 3); |
41037d51c8b6
Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2072
diff
changeset
|
192 } |
41037d51c8b6
Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2072
diff
changeset
|
193 |
41037d51c8b6
Added support for pointsize in chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2072
diff
changeset
|
194 |
3090
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
195 public static Color parsePointColor(Document theme) { |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
196 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
|
197 logger.debug("parsePointColor(): color = " + color); |
3090
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
198 return parseColor(color); |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
199 } |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
200 |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
201 |
1090
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
202 /** |
1753
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
203 * Parses the line style, defaulting to '10'. |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
204 * @param theme The theme. |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
205 */ |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
206 public static float[] parseLineStyle(Document theme) { |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
207 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
|
208 |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
209 float[] def = {10}; |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
210 if (dash == null || dash.length() == 0) { |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
211 return def; |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
212 } |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
213 |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
214 String[] pattern = dash.split(","); |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
215 if(pattern.length == 1) { |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
216 return def; |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
217 } |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
218 |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
219 try { |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
220 float[] dashes = new float[pattern.length]; |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
221 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
|
222 dashes[i] = Float.parseFloat(pattern[i]); |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
223 } |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
224 return dashes; |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
225 } |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
226 catch(NumberFormatException nfe) { |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
227 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
|
228 return def; |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
229 } |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
230 } |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
231 |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
232 |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
233 /** |
1738
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
234 * Parses text size, defaulting to 10. |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
235 * @param theme The theme. |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
236 */ |
2656
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
237 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
|
238 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
|
239 if (size == null || size.length() == 0) { |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
240 return 10; |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
241 } |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
242 |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
243 try { |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
244 return Integer.valueOf(size); |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
245 } |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
246 catch (NumberFormatException nfe) { |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
247 } |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
248 return 10; |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
249 } |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
250 |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
251 |
2656
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
252 public static int parseTextSize(Document theme) { |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
253 return parseTextSize(theme, XPATH_TEXT_SIZE); |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
254 } |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
255 |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
256 |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
257 public static int parseLineLabelSize(Document theme) { |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
258 return parseTextSize(theme, XPATH_LINE_LABEL_SIZE); |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
259 } |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
260 |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
261 |
1738
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
262 /** |
1748
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
263 * 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
|
264 * @param theme The theme. |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
265 */ |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
266 public static boolean parseShowPoints(Document theme) { |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
267 String show = XMLUtils.xpathString(theme, XPATH_SHOW_POINTS, null); |
2016
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
268 return parseBoolean(show, false); |
1748
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
269 } |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
270 |
2666
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2663
diff
changeset
|
271 /** |
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
|
272 * 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
|
273 * @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
|
274 */ |
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
|
275 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
|
276 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
|
277 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
|
278 } |
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
|
279 |
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
|
280 /** |
2666
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2663
diff
changeset
|
281 * 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
|
282 * @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
|
283 */ |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2663
diff
changeset
|
284 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
|
285 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
|
286 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
|
287 } |
1748
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
288 |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
289 /** |
2996
55f91fae8a7b
Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2674
diff
changeset
|
290 * 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
|
291 * @param theme The theme. |
55f91fae8a7b
Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2674
diff
changeset
|
292 */ |
55f91fae8a7b
Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2674
diff
changeset
|
293 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
|
294 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
|
295 return parseBoolean(show, true); |
55f91fae8a7b
Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2674
diff
changeset
|
296 } |
55f91fae8a7b
Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2674
diff
changeset
|
297 |
55f91fae8a7b
Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2674
diff
changeset
|
298 /** |
55f91fae8a7b
Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2674
diff
changeset
|
299 * 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
|
300 * @param theme The theme. |
55f91fae8a7b
Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2674
diff
changeset
|
301 */ |
55f91fae8a7b
Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2674
diff
changeset
|
302 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
|
303 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
|
304 return parseBoolean(show, true); |
55f91fae8a7b
Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2674
diff
changeset
|
305 } |
55f91fae8a7b
Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2674
diff
changeset
|
306 |
55f91fae8a7b
Respect new theme setting when drawing line to curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2674
diff
changeset
|
307 /** |
1753
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
308 * Parses the attribute 'showlines', defaults to true. |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
309 * @param theme The theme. |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
310 */ |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
311 public static boolean parseShowLine(Document theme) { |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
312 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
|
313 return parseBoolean(show, true); |
1753
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
314 } |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
315 |
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
|
316 /** |
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
|
317 * 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
|
318 * @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
|
319 */ |
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
|
320 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
|
321 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
|
322 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
|
323 } |
1753
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
324 |
741ba9e34c7d
Apply the attributes 'showpoints' and 'showline'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1750
diff
changeset
|
325 /** |
1738
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
326 * Parses text color. |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
327 * @param theme The theme. |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
328 */ |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
329 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
|
330 return parseRGB(getTextColorString(theme)); |
1738
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
331 } |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
332 |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2996
diff
changeset
|
333 |
2660
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2659
diff
changeset
|
334 /** Parse color for line label(s text). */ |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2659
diff
changeset
|
335 public static Color parseLineLabelTextColor(Document theme) { |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2659
diff
changeset
|
336 return parseRGB(getLineLabelTextColorString(theme)); |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2659
diff
changeset
|
337 } |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2659
diff
changeset
|
338 |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2659
diff
changeset
|
339 /** Parse bg color for line label(s text). */ |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2659
diff
changeset
|
340 public static Color parseLineLabelBGColor(Document theme) { |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2659
diff
changeset
|
341 return parseRGB(getLineLabelBGColorString(theme)); |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2659
diff
changeset
|
342 } |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2659
diff
changeset
|
343 |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2659
diff
changeset
|
344 // TODO showbg and bg color for linelabels |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2659
diff
changeset
|
345 |
1738
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
346 |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
347 /** |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
348 * Parses the font. |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
349 * @param theme The theme. |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
350 */ |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
351 public static Font parseTextFont(Document theme) { |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
352 String font = XMLUtils.xpathString(theme, XPATH_TEXT_FONT, null); |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
353 if (font == null || font.length() == 0) { |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
354 return null; |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
355 } |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
356 |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
357 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
|
358 int style = parseTextStyle(theme); |
415ec0223dff
Renamed text background attribute and parse text attributes correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1748
diff
changeset
|
359 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
|
360 return f; |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
361 } |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
362 |
2656
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
363 /** Parse font (name, size and style) for linelabels. */ |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
364 public static Font parseLineLabelFont(Document theme) { |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
365 String font = XMLUtils.xpathString(theme, XPATH_LINE_LABEL_FONT, null); |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
366 if (font == null || font.length() == 0) { |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
367 return null; |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
368 } |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
369 |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
370 int size = parseLineLabelSize(theme); |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
371 int style = parseLineLabelStyle(theme); |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
372 |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
373 Font f = new Font (font, style, size); |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
374 return f; |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
375 } |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
376 |
1738
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
377 |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
378 /** |
1748
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
379 * 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
|
380 * @param theme The theme. |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
381 */ |
2656
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
382 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
|
383 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
|
384 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
|
385 return Font.PLAIN; |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
386 } |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
387 |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
388 if (style.equals("italic")) { |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
389 return Font.ITALIC; |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
390 } |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
391 else if (style.equals("bold")) { |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
392 return Font.BOLD; |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
393 } |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
394 else { |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
395 return Font.PLAIN; |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
396 } |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
397 } |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
398 |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
399 |
2656
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
400 public static int parseTextStyle(Document theme) { |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
401 return parseTextStyle(theme, XPATH_TEXT_STYLE); |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
402 } |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
403 |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
404 |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
405 public static int parseLineLabelStyle(Document theme) { |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
406 return parseTextStyle(theme, XPATH_LINE_LABEL_STYLE); |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
407 } |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
408 |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
409 |
2663
33d61e2a49a2
Added and respect two new properties of waterlevels in cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2662
diff
changeset
|
410 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
|
411 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
|
412 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
|
413 } |
33d61e2a49a2
Added and respect two new properties of waterlevels in cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2662
diff
changeset
|
414 |
33d61e2a49a2
Added and respect two new properties of waterlevels in cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2662
diff
changeset
|
415 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
|
416 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
|
417 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
|
418 } |
33d61e2a49a2
Added and respect two new properties of waterlevels in cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2662
diff
changeset
|
419 |
1748
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
420 /** |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
421 * 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
|
422 * @param theme The theme. |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
423 */ |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
424 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
|
425 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
|
426 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
|
427 return "horizontal"; |
415ec0223dff
Renamed text background attribute and parse text attributes correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1748
diff
changeset
|
428 } |
415ec0223dff
Renamed text background attribute and parse text attributes correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1748
diff
changeset
|
429 else { |
415ec0223dff
Renamed text background attribute and parse text attributes correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1748
diff
changeset
|
430 return "vertical"; |
415ec0223dff
Renamed text background attribute and parse text attributes correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1748
diff
changeset
|
431 } |
1748
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
432 } |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
433 |
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 /** |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
436 * 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
|
437 * @param theme The theme. |
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 public static Color parseTextBackground(Document theme) { |
1878
84cf67a2a19e
Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1876
diff
changeset
|
440 String color = getBackgroundColorString(theme); |
1748
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
441 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
|
442 return Color.WHITE; |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
443 } |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
444 return parseRGB(color); |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
445 } |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
446 |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
447 |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
448 /** |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
449 * 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
|
450 * false. |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
451 * @param theme The theme. |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
452 */ |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
453 public static boolean parseShowTextBackground(Document theme) { |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
454 String show = XMLUtils.xpathString(theme, XPATH_SHOW_BACKGROUND, null); |
2016
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
455 return parseBoolean(show, false); |
1748
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
456 } |
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 |
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
459 /** |
2662
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
460 * Parses the attribute whether to show line labels background or not, |
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
461 * defaults to false. |
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
462 * @param theme The theme. |
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
463 */ |
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
464 public static boolean parseShowLineLabelBG(Document theme) { |
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
465 String show = XMLUtils.xpathString(theme, XPATH_LINE_LABEL_SHOWBG, null); |
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
466 return parseBoolean(show, false); |
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
467 } |
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
468 |
3090
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
469 |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
470 public static Color parseColor(String colorString) { |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
471 if (colorString == null || colorString.length() == 0) { |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
472 return null; |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
473 } |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
474 else if (colorString.indexOf("#") == 0) { |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
475 return parseHexColor(colorString); |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
476 } |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
477 else if (colorString.indexOf(",") >= 0) { |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
478 return parseRGB(colorString); |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
479 } |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
480 |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
481 return null; |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
482 } |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
483 |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
484 |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
485 /** |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
486 * 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
|
487 * |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
488 * @param hex The hex color value. |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
489 * |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
490 * @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
|
491 */ |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
492 public static Color parseHexColor(String hex) { |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
493 if (hex == null) { |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
494 return null; |
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 |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
497 return Color.decode(hex); |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
498 } |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
499 |
2662
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
500 /** |
1090
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
501 * 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
|
502 * @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
|
503 * @return Color, null in case of issues. |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
504 */ |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
505 public static Color parseRGB(String rgbtext) { |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
506 if (rgbtext == null) { |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
507 return null; |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
508 } |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
509 String rgb[] = rgbtext.split(","); |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
510 Color c = null; |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
511 try { |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
512 c = new Color( |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
513 Integer.valueOf(rgb[0].trim()), |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
514 Integer.valueOf(rgb[1].trim()), |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
515 Integer.valueOf(rgb[2].trim())); |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
516 } |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
517 catch (NumberFormatException nfe) { |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
518 c = null; |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
519 } |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
520 return c; |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
521 } |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
522 |
1748
d56b94325bec
Added methods to extract further attributes from theme.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1738
diff
changeset
|
523 |
1793
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
524 public static String getLineColorString(Document theme) { |
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
525 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
|
526 } |
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
527 |
2016
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
528 /** Get show border as string. */ |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
529 public static String getShowBorderString(Document theme) { |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
530 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
|
531 } |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
532 |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
533 /** Get fill color as string. */ |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
534 public static String getFillColorString(Document theme) { |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
535 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
|
536 } |
1793
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
537 |
1878
84cf67a2a19e
Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1876
diff
changeset
|
538 public static String getBackgroundColorString(Document theme) { |
84cf67a2a19e
Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1876
diff
changeset
|
539 return XMLUtils.xpathString(theme, XPATH_TEXT_BACKGROUND, null); |
84cf67a2a19e
Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1876
diff
changeset
|
540 } |
84cf67a2a19e
Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1876
diff
changeset
|
541 |
84cf67a2a19e
Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1876
diff
changeset
|
542 |
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
|
543 public static String getTextColorString(Document theme) { |
dd467951335c
Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1816
diff
changeset
|
544 return XMLUtils.xpathString(theme, XPATH_TEXT_COLOR, null); |
dd467951335c
Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1816
diff
changeset
|
545 } |
dd467951335c
Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1816
diff
changeset
|
546 |
2660
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2659
diff
changeset
|
547 public static String getLineLabelTextColorString(Document theme) { |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2659
diff
changeset
|
548 return XMLUtils.xpathString(theme, XPATH_LINE_LABEL_COLOR, null); |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2659
diff
changeset
|
549 } |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2659
diff
changeset
|
550 |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2659
diff
changeset
|
551 public static String getLineLabelBGColorString(Document theme) { |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2659
diff
changeset
|
552 return XMLUtils.xpathString(theme, XPATH_LINE_LABEL_BGCOLOR, null); |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2659
diff
changeset
|
553 } |
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
|
554 |
1816
5364b86a0880
Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1793
diff
changeset
|
555 public static String getSymbol(Document theme) { |
5364b86a0880
Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1793
diff
changeset
|
556 return XMLUtils.xpathString(theme, XPATH_SYMBOL, null); |
5364b86a0880
Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1793
diff
changeset
|
557 } |
5364b86a0880
Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1793
diff
changeset
|
558 |
2032
5746c74c69cf
Added a transparency setting to area theme style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2016
diff
changeset
|
559 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
|
560 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
|
561 } |
3256
17ca0a43027a
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3254
diff
changeset
|
562 |
17ca0a43027a
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3254
diff
changeset
|
563 |
3254
9a4707ec7800
Add styles for W(t) chart domain markers
Christian Lins <christian.lins@intevation.de>
parents:
3251
diff
changeset
|
564 public static String getTransparencyAlpha(Document theme) { |
9a4707ec7800
Add styles for W(t) chart domain markers
Christian Lins <christian.lins@intevation.de>
parents:
3251
diff
changeset
|
565 return XMLUtils.xpathString(theme, XPATH_TRANSPARENCY_ALPHA, null); |
9a4707ec7800
Add styles for W(t) chart domain markers
Christian Lins <christian.lins@intevation.de>
parents:
3251
diff
changeset
|
566 } |
2032
5746c74c69cf
Added a transparency setting to area theme style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2016
diff
changeset
|
567 |
1816
5364b86a0880
Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1793
diff
changeset
|
568 |
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
|
569 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
|
570 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
|
571 } |
3256
17ca0a43027a
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3254
diff
changeset
|
572 |
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
|
573 |
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
|
574 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
|
575 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
|
576 } |
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
|
577 |
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
|
578 |
1090
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
579 /** |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
580 * Gets color from color field. |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
581 * @param theme the theme document. |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
582 * @return color. |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
583 */ |
2016
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
584 public static Color parseFillColorField(Document theme) { |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
585 return parseRGB(getFillColorString(theme)); |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
586 } |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
587 |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
588 public static boolean parseShowBorder(Document theme) { |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
589 return parseBoolean(getShowBorderString(theme), false); |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
590 } |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
591 |
2032
5746c74c69cf
Added a transparency setting to area theme style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2016
diff
changeset
|
592 public static boolean parseTransparency(Document theme) { |
5746c74c69cf
Added a transparency setting to area theme style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2016
diff
changeset
|
593 return parseBoolean(getTransparencyString(theme), false); |
5746c74c69cf
Added a transparency setting to area theme style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2016
diff
changeset
|
594 } |
2016
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
595 |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
596 /** |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
597 * Gets color from color field. |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
598 * @param theme the theme document. |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
599 * @return color. |
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
600 */ |
1090
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
601 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
|
602 String lineColorStr = getLineColorString(theme); |
3160
8c78c707aa2d
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3155
diff
changeset
|
603 logger.debug("parseLineColorField: lineColorStr = " + |
3155
74c974b10c75
Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents:
3098
diff
changeset
|
604 (lineColorStr == null ? "null" : lineColorStr)); |
74c974b10c75
Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents:
3098
diff
changeset
|
605 return parseRGB(lineColorStr); |
1793
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
606 } |
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
607 |
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
608 |
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
|
609 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
|
610 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
|
611 } |
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
|
612 |
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
|
613 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
|
614 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
|
615 } |
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
|
616 |
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
|
617 |
2616
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
618 public static String createWSPLGENStyle(Document theme) { |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
619 NodeList categories = (NodeList) XMLUtils.xpath( |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
620 theme, |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
621 XPATH_WSPLGEN_FIELDS, |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
622 XPathConstants.NODESET); |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
623 |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
624 return createWSPLGENStyle(categories).toString(); |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
625 } |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
626 |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
627 protected static MapserverStyle createWSPLGENStyle(NodeList categories) { |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
628 MapserverStyle ms = new MapserverStyle(); |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
629 |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
630 for (int i = 0, n = categories.getLength(); i < n; i++) { |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
631 Element cat = (Element) categories.item(i); |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
632 String color = cat.getAttribute("default"); |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
633 String name = cat.getAttribute("name"); |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
634 |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
635 String expr; |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
636 |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
637 try { |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
638 int length = name.length(); |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
639 int idx = Integer.valueOf(name.substring(length-1, length)); |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
640 |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
641 expr = createWSPLGENExpression(idx); |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
642 } |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
643 catch (NumberFormatException nfe) { |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
644 logger.warn("Error while parsing WSPLGEN category.", nfe); |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
645 continue; |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
646 } |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
647 |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
648 Clazz c = new Clazz(expr); |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
649 Style s = new Style(); |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
650 s.setColor(color.replace(",", "")); |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
651 s.setSize(5); |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
652 |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
653 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
|
654 c.addItem(s); |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
655 |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
656 ms.addClazz(c); |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
657 } |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
658 |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
659 return ms; |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
660 } |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
661 |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
662 |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
663 protected static String createWSPLGENExpression(int idx) { |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
664 if (idx < 5) { |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
665 int lower = idx - 1; |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
666 return "[DIFF] >= " + lower + " AND [DIFF] < " + idx; |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
667 } |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
668 else { |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
669 return "[DIFF] >= 4"; |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
670 } |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
671 } |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
672 |
27cc95e65f18
Defined a style for WSPLGEN layers which are now modifiable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2076
diff
changeset
|
673 |
1793
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
674 public static String createMapserverStyle(Document theme) { |
1816
5364b86a0880
Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1793
diff
changeset
|
675 String symbol = getSymbol(theme); |
1878
84cf67a2a19e
Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1876
diff
changeset
|
676 String backcolor = getBackgroundColorString(theme); |
1793
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
677 String linecolor = getLineColorString(theme); |
1816
5364b86a0880
Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1793
diff
changeset
|
678 |
5364b86a0880
Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1793
diff
changeset
|
679 int linewidth = parseLineWidth(theme); |
1793
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
680 |
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
681 MapserverStyle ms = new MapserverStyle(); |
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
682 |
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
683 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
|
684 |
dd467951335c
Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1816
diff
changeset
|
685 Style s = new Style(); |
1878
84cf67a2a19e
Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1876
diff
changeset
|
686 s.setOutlineColor(linecolor.replace(",", "")); |
84cf67a2a19e
Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1876
diff
changeset
|
687 |
84cf67a2a19e
Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1876
diff
changeset
|
688 if (backcolor != null && backcolor.length() > 0) { |
84cf67a2a19e
Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1876
diff
changeset
|
689 s.setColor(backcolor.replace(",", "")); |
84cf67a2a19e
Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1876
diff
changeset
|
690 } |
84cf67a2a19e
Added support for fillcolors of polygons in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1876
diff
changeset
|
691 |
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
|
692 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
|
693 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
|
694 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
|
695 |
dd467951335c
Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1816
diff
changeset
|
696 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
|
697 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
|
698 |
dd467951335c
Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1816
diff
changeset
|
699 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
|
700 Label l = new Label(); |
dd467951335c
Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1816
diff
changeset
|
701 l.setColor(textcolor.replace(",", "")); |
dd467951335c
Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1816
diff
changeset
|
702 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
|
703 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
|
704 } |
1793
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
705 |
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
706 ms.addClazz(c); |
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
707 |
1636686070f7
Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1753
diff
changeset
|
708 return ms.toString(); |
1090
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
709 } |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
710 } |
2016
796dfe96b6b2
Refactoring, added Style accessors for area styles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1878
diff
changeset
|
711 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |