annotate artifacts/src/main/java/org/dive4elements/river/themes/ThemeDocument.java @ 9602:6b2496d71936

Reimplemented baseline for tkh. Extended area-dataset to be able to draw baseline.
author gernotbelger
date Tue, 12 Feb 2019 14:08:16 +0100
parents ef5754ba5573
children
rev   line source
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
3 *
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
6 * documentation coming with Dive4Elements River for details.
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
7 */
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
8
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
9 package org.dive4elements.river.themes;
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
10
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
11 import java.awt.Color;
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
12 import java.awt.Font;
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
13 import java.util.HashMap;
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
14 import java.util.Map;
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
15
8910
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8885
diff changeset
16 import org.apache.commons.lang.StringUtils;
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
17 import org.apache.log4j.Logger;
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
18 import org.dive4elements.artifacts.CallMeta;
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
19 import org.dive4elements.river.artifacts.model.MapserverStyle;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
20 import org.dive4elements.river.artifacts.model.MapserverStyle.Clazz;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
21 import org.dive4elements.river.artifacts.model.MapserverStyle.Expression;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
22 import org.dive4elements.river.artifacts.model.MapserverStyle.Label;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
23 import org.dive4elements.river.artifacts.model.MapserverStyle.Style;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
24 import org.dive4elements.river.artifacts.resources.Resources;
8910
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8885
diff changeset
25 import org.dive4elements.river.jfree.AreaFillPattern;
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
26 import org.w3c.dom.Document;
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
27 import org.w3c.dom.Element;
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
28 import org.w3c.dom.NodeList;
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
29
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
30 public class ThemeDocument
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
31 {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7820
diff changeset
32 private static Logger log = Logger.getLogger(ThemeDocument.class);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
33
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
34 private static final String MSG_ISOBATH_CLASS = "floodmap.isobath.class";
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
35
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8635
diff changeset
36 private static final String MSG_ISOBATH_LASTCLASS =
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
37 "floodmap.isobath.lastclass";
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
38
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
39 public final static String FILL_COLOR = "fillcolor";
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
40
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
41 public final static String LINE_COLOR = "linecolor";
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
42
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
43 public final static String AREA_LINE_COLOR = "areabordercolor";
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
44
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
45 public static final String LINE_SIZE = "linesize";
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
46
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
47 public static final String LINE_STYLE = "linetype";
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
48
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
49 public static final String POINT_SIZE = "pointsize";
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
50
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
51 public static final String POINT_COLOR = "pointcolor";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
52
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
53 public final static String SHOW_BORDER = "showborder";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
54
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
55 public final static String AREA_SHOW_BORDER = "showborder";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
56
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
57 public final static String SHOW_POINTS = "showpoints";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
58
9325
094ed9d1f2ad Fixed: change of point style of interpolated data did not change in WQ chart of fixanalysis
gernotbelger
parents: 8910
diff changeset
59 public final static String SHOW_POINTS_OUTLINE = "showpointsoutline";
094ed9d1f2ad Fixed: change of point style of interpolated data did not change in WQ chart of fixanalysis
gernotbelger
parents: 8910
diff changeset
60
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
61 public final static String SHOW_LINE = "showlines";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
62
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
63 public final static String SHOW_VERTICAL_LINE = "showverticalline";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
64
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
65 public final static String SHOW_HORIZONTAL_LINE = "showhorizontalline";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
66
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
67 public final static String SHOW_LINE_LABEL = "showlinelabel";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
68
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
69 public final static String SHOW_POINT_LABEL = "showpointlabel";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
70
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
71 public final static String SHOW_WIDTH = "showwidth";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
72
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
73 public final static String SHOW_LEVEL = "showlevel";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
74
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
75 public final static String TRANSPARENCY = "transparency";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
76
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
77 public final static String AREA_TRANSPARENCY = "areatransparency";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
78
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
79 public final static String SHOW_AREA = "showarea";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
80
7119
988dde49ae65 Fix area label rendering.
Andre Heinecke <aheinecke@intevation.de>
parents: 6962
diff changeset
81 public final static String SHOW_AREA_LABEL = "showarealabel";
988dde49ae65 Fix area label rendering.
Andre Heinecke <aheinecke@intevation.de>
parents: 6962
diff changeset
82
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
83 public final static String SHOW_MIDDLE_HEIGHT = "showmiddleheight";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
84
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
85 public final static String LABEL_FONT_COLOR = "labelfontcolor";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
86
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
87 public final static String LABEL_FONT_SIZE = "labelfontsize";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
88
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
89 public final static String LABEL_FONT_FACE = "labelfontface";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
90
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
91 public final static String LABEL_FONT_STYLE = "labelfontstyle";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
92
7582
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
93 public final static String FONT = "font";
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
94
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
95 public final static String TEXT_SIZE = "textsize";
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
96
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
97 public final static String TEXT_STYLE = "textstyle";
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
98
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
99 public final static String TEXT_ORIENTATION = "textorientation";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
100
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
101 public final static String LABEL_BGCOLOR = "labelbgcolor";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
102
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
103 public final static String LABEL_SHOW_BACKGROUND = "labelshowbg";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
104
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
105 public final static String BACKGROUND_COLOR = "backgroundcolor";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
106
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
107 public final static String AREA_BACKGROUND_COLOR = "areabgcolor";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
108
8910
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8885
diff changeset
109 private static final String AREA_BACKGROUND_PATTERN = "areabgpattern";
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8885
diff changeset
110
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
111 public final static String SYMBOL = "symbol";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
112
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
113 public final static String SHOW_MINIMUM = "showminimum";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
114
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
115 public final static String SHOW_MAXIMUM = "showmaximum";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
116
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
117 public final static String WSPLGEN_STARTCOLOR = "startcolor";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
118
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
119 public final static String WSPLGEN_ENDCOLOR = "endcolor";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
120
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
121 public final static String WSPLGEN_NUMCLASSES = "numclasses";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
122
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
123 public final static String BANDWIDTH = "bandwidth";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
124
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
125 public final static String SHOWEXTRAMARK = "showextramark";
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
126
9602
6b2496d71936 Reimplemented baseline for tkh. Extended area-dataset to be able to draw baseline.
gernotbelger
parents: 9555
diff changeset
127 private final static String BASE_LINE_COLOR = "baselineColor";
6b2496d71936 Reimplemented baseline for tkh. Extended area-dataset to be able to draw baseline.
gernotbelger
parents: 9555
diff changeset
128
8885
e5f688820951 Some minor changes on chart: allow area-themes to consider range; allow for axis-margins
gernotbelger
parents: 8856
diff changeset
129 /* boolean parameter if the range of this theme should be considered when auto-zooming. Only works for area-series at the moment */
e5f688820951 Some minor changes on chart: allow area-themes to consider range; allow for axis-margins
gernotbelger
parents: 8856
diff changeset
130 private static final String CALCULATE_RANGE = "calculateRange";
e5f688820951 Some minor changes on chart: allow area-themes to consider range; allow for axis-margins
gernotbelger
parents: 8856
diff changeset
131
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
132 private Map<String, String> values;
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
133
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
134 public ThemeDocument() {
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
135 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
136
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
137 public ThemeDocument(final Document document) {
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
138 this.values = extractValues(document);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
139 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
140
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
141 public ThemeDocument(final ThemeDocument other) {
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
142 this.values = new HashMap<>(other.values);
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
143 }
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
144
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
145 public String getValue(final String key) {
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
146 return this.values.get(key);
7545
4dbbdf0c8b2c More on flys/issue1585: Do not fill circle for interpolated W/Q points.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7119
diff changeset
147 }
4dbbdf0c8b2c More on flys/issue1585: Do not fill circle for interpolated W/Q points.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7119
diff changeset
148
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
149 public void setValue(final String key, final String value) {
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
150 this.values.put(key, value);
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
151 }
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
152
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
153 private static Map<String, String> extractValues(final Document document) {
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
154 final Map<String, String> values = new HashMap<>();
6962
234b1a3b527d Workaround for flys/issue14070. TODO: Find the reason why a null document is given to the ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6912
diff changeset
155 if (document == null) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7820
diff changeset
156 log.error("Invalid null document given.");
6962
234b1a3b527d Workaround for flys/issue14070. TODO: Find the reason why a null document is given to the ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6912
diff changeset
157 return values;
234b1a3b527d Workaround for flys/issue14070. TODO: Find the reason why a null document is given to the ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6912
diff changeset
158 }
234b1a3b527d Workaround for flys/issue14070. TODO: Find the reason why a null document is given to the ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6912
diff changeset
159
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
160 final NodeList fields = document.getElementsByTagName("field");
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
161 for (int i = 0, N = fields.getLength(); i < N; ++i) {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
162 final Element field = (Element)fields.item(i);
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
163 final String name = field.getAttribute("name");
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
164 final String value = field.getAttribute("default");
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
165 if (!name.isEmpty() && !value.isEmpty()) {
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
166 values.put(name, value);
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
167 }
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
168 }
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7820
diff changeset
169 if (log.isDebugEnabled()) {
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7820
diff changeset
170 log.debug("Theme values: " + values);
6912
058b8dc4e8b6 Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6909
diff changeset
171 }
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
172 return values;
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
173 }
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
174
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
175 /** Parse string to be boolean with default if empty or unrecognized. */
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
176 private static boolean parseBoolean(final String value, final boolean defaultsTo) {
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
177 if (value == null) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
178 return defaultsTo;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
179 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
180 if (value.equals("false")) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
181 return false;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
182 }
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
183 if (value.equals("true")) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
184 return true;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
185 }
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
186 return defaultsTo;
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
187 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
188
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
189
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
190 /**
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
191 * Attempt converting \param value to an integer, in failing cases,
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
192 * return \param defaultsTo.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
193 * @param value String to be converted to integer.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
194 * @param defaultsTo Default to return if conversion failed.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
195 * @return \param value as integer or defaultsto if conversion failed.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
196 */
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
197 private static int parseInteger(final String value, final int defaultsTo) {
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
198 if (value == null) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
199 return defaultsTo;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
200 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
201
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
202 try {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
203 return Integer.parseInt(value);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
204 }
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
205 catch (final NumberFormatException nfe) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
206 // do nothing
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
207 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
208
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
209 return defaultsTo;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
210 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
211
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
212
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
213 /**
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
214 * Attempt converting \param value to a double, in failing cases,
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
215 * return \param defaultsTo.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
216 * @param value String to be converted to double.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
217 * @param defaultsTo Default to return if conversion failed.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
218 * @return \param value as integer or defaultsto if conversion failed.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
219 */
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
220 private static double parseDouble(final String value, final double defaultsTo) {
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
221 if (value == null) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
222 return defaultsTo;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
223 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
224
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
225 try {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
226 return Double.parseDouble(value);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
227 }
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
228 catch (final NumberFormatException nfe) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
229 // do nothing
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
230 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
231
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
232 return defaultsTo;
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
233 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
234
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
235 public boolean parseShowLineLabel() {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
236 final String show = getValue(SHOW_LINE_LABEL);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
237 return parseBoolean(show, false);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
238 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
239
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
240 public boolean parseShowWidth() {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
241 final String show = getValue(SHOW_WIDTH);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
242 return parseBoolean(show, false);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
243 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
244
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
245 public boolean parseShowLevel() {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
246 final String show = getValue(SHOW_LEVEL);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
247 return parseBoolean(show, false);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
248 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
249
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
250 public String parseTextOrientation() {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
251 final String o = getValue(TEXT_ORIENTATION);
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
252
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
253 return o != null && "true".equals(o)
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
254 ? "horizontal"
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
255 : "vertical";
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
256 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
257
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
258 public boolean parseShowMiddleHeight() {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
259 final String show = getValue(SHOW_MIDDLE_HEIGHT);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
260 return parseBoolean(show, false);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
261 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
262
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
263 public boolean parseLabelShowBackground() {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
264 final String show = getValue(LABEL_SHOW_BACKGROUND);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
265 return parseBoolean(show, false);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
266 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
267
7582
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
268 public Font parseFont() {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
269 final String font = getValue(FONT);
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7820
diff changeset
270 log.debug(" font is " + font);
7582
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
271 if (font == null) {
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
272 return null;
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
273 }
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
274
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
275 final int size = parseFontSize();
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
276 final int style = parseFontStyle();
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
277 final Font f = new Font(font, style, size);
7582
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
278 return f;
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
279 }
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
280
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
281 public Font parseTextFont() {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
282 final String font = getValue(LABEL_FONT_FACE);
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
283 if (font == null) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
284 return null;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
285 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
286
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
287 final int size = parseTextSize();
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
288 final int style = parseTextStyle();
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
289 final Font f = new Font(font, style, size);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
290 return f;
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
291 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
292
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
293 public Color parseTextColor() {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
294 return parseRGB(getTextColorString());
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
295 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
296
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
297 private String getTextColorString() {
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
298 return getValue(LABEL_FONT_COLOR);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
299 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
300
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
301 public Color parseTextBackground() {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
302 final String color = getLabelBackgroundColorString();
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
303 return color != null
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
304 ? parseRGB(color)
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
305 : Color.WHITE;
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
306 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
307
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
308 private String getLabelBackgroundColorString() {
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
309 return getValue(LABEL_BGCOLOR);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
310 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
311
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
312 public int parseLineWidth() {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
313 final String size = getValue(LINE_SIZE);
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
314 if (size == null) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
315 return 0;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
316 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
317
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
318 try {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
319 return Integer.parseInt(size);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
320 }
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
321 catch (final NumberFormatException nfe) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7820
diff changeset
322 log.warn("Unable to set line size from string: '" + size + "'");
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
323 }
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
324 return 0;
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
325 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
326
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
327 public float [] parseLineStyle() {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
328 final String dash = getValue(LINE_STYLE);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
329
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
330 final float[] def = {10};
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
331 if (dash == null) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
332 return def;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
333 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
334
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
335 final String[] pattern = dash.split(",");
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
336 if(pattern.length == 1) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
337 return def;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
338 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
339
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
340 try {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
341 final float[] dashes = new float[pattern.length];
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
342 for (int i = 0; i < pattern.length; i++) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
343 dashes[i] = Float.parseFloat(pattern[i]);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
344 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
345 return dashes;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
346 }
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
347 catch (final NumberFormatException nfe) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7820
diff changeset
348 log.warn("Unable to set dash from string: '" + dash + "'");
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
349 return def;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
350 }
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
351 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
352
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
353 public int parsePointWidth() {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
354 final String width = getValue(POINT_SIZE);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
355 return parseInteger(width, 3);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
356 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
357
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
358 public Color parsePointColor() {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
359 final String color = getValue(POINT_COLOR);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
360 return parseColor(color);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
361 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
362
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
363 public boolean parseShowPoints() {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
364 final String show = getValue(SHOW_POINTS);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
365 return parseBoolean(show, false);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
366 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
367
9325
094ed9d1f2ad Fixed: change of point style of interpolated data did not change in WQ chart of fixanalysis
gernotbelger
parents: 8910
diff changeset
368 public boolean parseShowPointsOutline() {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
369 final String show = getValue(SHOW_POINTS_OUTLINE);
9325
094ed9d1f2ad Fixed: change of point style of interpolated data did not change in WQ chart of fixanalysis
gernotbelger
parents: 8910
diff changeset
370 return parseBoolean(show, false);
094ed9d1f2ad Fixed: change of point style of interpolated data did not change in WQ chart of fixanalysis
gernotbelger
parents: 8910
diff changeset
371 }
094ed9d1f2ad Fixed: change of point style of interpolated data did not change in WQ chart of fixanalysis
gernotbelger
parents: 8910
diff changeset
372
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
373 public boolean parseShowLine() {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
374 final String show = getValue(SHOW_LINE);
8635
c421c9530aba Do not show lines if showlines is not set.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8444
diff changeset
375 return parseBoolean(show, false);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
376 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
377
7582
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
378 public int parseFontStyle() {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
379 final String style = getValue(TEXT_STYLE);
7582
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
380 if (style == null) {
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
381 return Font.PLAIN;
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
382 }
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
383
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
384 if (style.equals("italic")) {
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
385 return Font.ITALIC;
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
386 }
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
387 if (style.equals("bold")) {
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
388 return Font.BOLD;
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
389 }
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
390 return Font.PLAIN;
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
391 }
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
392
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
393 public int parseTextStyle() {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
394 final String style = getValue(LABEL_FONT_STYLE);
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
395 if (style == null) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
396 return Font.PLAIN;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
397 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
398
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
399 if (style.equals("italic")) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
400 return Font.ITALIC;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
401 }
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
402 if (style.equals("bold")) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
403 return Font.BOLD;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
404 }
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
405 return Font.PLAIN;
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
406 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
407
7583
4b67eb1a3a68 issue1606: Handle annotation text as well.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7582
diff changeset
408 /** Handle info for label or annotation text. */
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
409 public TextStyle parseComplexTextStyle() {
7583
4b67eb1a3a68 issue1606: Handle annotation text as well.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7582
diff changeset
410 Font font = parseTextFont();
4b67eb1a3a68 issue1606: Handle annotation text as well.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7582
diff changeset
411 // Try the annotation text styles.
4b67eb1a3a68 issue1606: Handle annotation text as well.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7582
diff changeset
412 if (font == null) {
4b67eb1a3a68 issue1606: Handle annotation text as well.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7582
diff changeset
413 font = parseFont();
4b67eb1a3a68 issue1606: Handle annotation text as well.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7582
diff changeset
414 }
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
415 return new TextStyle(
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
416 parseTextColor(),
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
417 font,
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
418 parseTextBackground(),
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
419 parseLabelShowBackground(),
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
420 !parseTextOrientation().equals("horizontal"));
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
421 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
422
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
423 public LineStyle parseComplexLineStyle() {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
424 return new LineStyle(
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
425 parseLineColorField(),
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
426 Integer.valueOf(parseLineWidth()));
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
427 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
428
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
429 public boolean parseShowVerticalLine() {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
430 final String show = getValue(SHOW_VERTICAL_LINE);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
431 return parseBoolean(show, true);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
432 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
433
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
434 public boolean parseShowHorizontalLine() {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
435 final String show = getValue(SHOW_HORIZONTAL_LINE);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
436 return parseBoolean(show, true);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
437 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
438
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
439 public double parseBandWidth() {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
440 final String bandWidth = getValue(BANDWIDTH);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
441 return parseDouble(bandWidth, 0);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
442 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
443
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
444 private static Color parseColor(final String colorString) {
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
445 if (colorString == null) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
446 return null;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
447 }
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
448 if (colorString.indexOf("#") == 0) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
449 return parseHexColor(colorString);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
450 }
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
451 if (colorString.indexOf(",") >= 0) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
452 return parseRGB(colorString);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
453 }
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
454
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
455 return null;
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
456 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
457
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
458
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
459 /**
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
460 * Parse a string like "#00CC22" and return the corresponding color.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
461 *
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
462 * @param hex The hex color value.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
463 *
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
464 * @return a Color or null, if <i>hex</i> is empty.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
465 */
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
466 private static Color parseHexColor(final String hex) {
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
467 return hex != null
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
468 ? Color.decode(hex)
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
469 : null;
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
470 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
471
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
472
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
473 public boolean parseShowArea() {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
474 final String show = getValue(SHOW_AREA);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
475 return parseBoolean(show, false);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
476 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
477
7119
988dde49ae65 Fix area label rendering.
Andre Heinecke <aheinecke@intevation.de>
parents: 6962
diff changeset
478 public boolean parseShowAreaLabel() {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
479 final String show = getValue(SHOW_AREA_LABEL);
7119
988dde49ae65 Fix area label rendering.
Andre Heinecke <aheinecke@intevation.de>
parents: 6962
diff changeset
480 return parseBoolean(show, false);
988dde49ae65 Fix area label rendering.
Andre Heinecke <aheinecke@intevation.de>
parents: 6962
diff changeset
481 }
988dde49ae65 Fix area label rendering.
Andre Heinecke <aheinecke@intevation.de>
parents: 6962
diff changeset
482
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
483 public boolean parseShowPointLabel() {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
484 final String show = getValue(SHOW_POINT_LABEL);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
485 return parseBoolean(show, false);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
486 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
487
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
488 public boolean parseShowExtraMark() {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
489 final String show = getValue(SHOWEXTRAMARK);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
490 return parseBoolean(show, false);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
491 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
492
7582
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
493 public int parseFontSize() {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
494 final String size = getValue(TEXT_SIZE);
7582
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
495 if (size == null) {
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
496 return 10;
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
497 }
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
498
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
499 try {
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
500 return Integer.parseInt(size);
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
501 }
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
502 catch (final NumberFormatException nfe) {
7582
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
503 // Do nothing
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
504 }
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
505 return 10;
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
506 }
8ebca831486b issue1606: Added methods to parse omitted theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7545
diff changeset
507
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
508 public int parseTextSize() {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
509 final String size = getValue(LABEL_FONT_SIZE);
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
510 if (size == null) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
511 return 10;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
512 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
513
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
514 try {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
515 return Integer.parseInt(size);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
516 }
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
517 catch (final NumberFormatException nfe) {
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
518 // Do nothing
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
519 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
520 return 10;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
521 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
522
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
523 /**
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
524 * Parse a string like "103, 100, 0" and return a corresping color.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
525 * @param rgbtext Color as string representation, e.g. "255,0,20".
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
526 * @return Color, null in case of issues.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
527 */
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
528 public static Color parseRGB(final String rgbtext) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
529 if (rgbtext == null) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
530 return null;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
531 }
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
532 final String rgb[] = rgbtext.split(",");
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
533 try {
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
534 return new Color(
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
535 Integer.parseInt(rgb[0].trim()),
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
536 Integer.parseInt(rgb[1].trim()),
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
537 Integer.parseInt(rgb[2].trim()));
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
538 }
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
539 catch (final NumberFormatException nfe) {
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
540 // Do nothing
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
541 }
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
542 return null;
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
543 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
544
6912
058b8dc4e8b6 Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6909
diff changeset
545 private String getLineColorString() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
546 return getValue(LINE_COLOR);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
547 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
548
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
549
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
550 /** Get show border as string. */
6912
058b8dc4e8b6 Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6909
diff changeset
551 private String getShowBorderString() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
552 return getValue(SHOW_BORDER);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
553 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
554
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
555
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
556 /** Get fill color as string. */
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
557 private String getFillColorString() {
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
558 return getValue(FILL_COLOR);
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
559 }
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
560
6912
058b8dc4e8b6 Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6909
diff changeset
561 private String getSymbol() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
562 return getValue(SYMBOL);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
563 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
564
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
565 private String getTransparencyString() {
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
566 return getValue(TRANSPARENCY);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
567 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
568
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
569
6912
058b8dc4e8b6 Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6909
diff changeset
570 private String getAreaTransparencyString() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
571 return getValue(AREA_TRANSPARENCY);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
572 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
573
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
574
6912
058b8dc4e8b6 Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6909
diff changeset
575 private String getShowMinimum() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
576 return getValue(SHOW_MINIMUM);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
577 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
578
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
579
6912
058b8dc4e8b6 Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6909
diff changeset
580 private String getShowMaximum() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
581 return getValue(SHOW_MAXIMUM);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
582 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
583
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
584 /**
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
585 * Gets color from color field.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
586 * @param theme the theme document.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
587 * @return color.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
588 */
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
589 public Color parseFillColorField() {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
590 return parseRGB(getFillColorString());
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
591 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
592
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
593 public boolean parseShowBorder() {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
594 return parseBoolean(getShowBorderString(), false);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
595 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
596
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
597 public int parseTransparency() {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
598 return parseInteger(getTransparencyString(), 50);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
599 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
600
9602
6b2496d71936 Reimplemented baseline for tkh. Extended area-dataset to be able to draw baseline.
gernotbelger
parents: 9555
diff changeset
601 public Color parseBaseLineColor() {
6b2496d71936 Reimplemented baseline for tkh. Extended area-dataset to be able to draw baseline.
gernotbelger
parents: 9555
diff changeset
602 final String colorStr = getValue(BASE_LINE_COLOR);
6b2496d71936 Reimplemented baseline for tkh. Extended area-dataset to be able to draw baseline.
gernotbelger
parents: 9555
diff changeset
603 return parseColor(colorStr);
6b2496d71936 Reimplemented baseline for tkh. Extended area-dataset to be able to draw baseline.
gernotbelger
parents: 9555
diff changeset
604 }
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
605
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
606 /**
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
607 * Gets color from color field.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
608 * @return color.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
609 */
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
610 public Color parseLineColorField() {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
611 final String lineColorStr = getLineColorString();
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7820
diff changeset
612 if (log.isDebugEnabled()) {
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7820
diff changeset
613 log.debug("parseLineColorField: lineColorStr = " +
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
614 (lineColorStr == null
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
615 ? "null"
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
616 : lineColorStr));
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
617 }
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
618 return parseColor(lineColorStr);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
619 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
620
8885
e5f688820951 Some minor changes on chart: allow area-themes to consider range; allow for axis-margins
gernotbelger
parents: 8856
diff changeset
621 // FIXME: check, this is defined in default.xml, but never used. Instead the StyledAreaSeriesCollection used lineColor etc
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
622 public Color parseAreaLineColorField() {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
623 final String lineColorStr = getAreaLineColorString();
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7820
diff changeset
624 if (log.isDebugEnabled()) {
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7820
diff changeset
625 log.debug("parseLineColorField: lineColorStr = " +
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
626 (lineColorStr == null
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
627 ? "null"
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
628 : lineColorStr));
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
629 }
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
630 return parseColor(lineColorStr);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
631 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
632
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
633
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
634 private String getAreaLineColorString() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
635 return getValue(AREA_LINE_COLOR);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
636 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
637
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
638
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
639 public boolean parseShowMinimum() {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
640 return parseBoolean(getShowMinimum(), false);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
641 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
642
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
643
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
644 public boolean parseShowMaximum() {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
645 return parseBoolean(getShowMaximum(), false);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
646 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
647
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
648
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
649 /**
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
650 * Creates a MapserverStyle from the given XML theme.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
651 * This method uses a start- and endcolor to interpolate a
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
652 * given number of color classes for the MapserverStyle.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
653 * @param theme
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
654 * @return String representation of the MapserverStyle
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
655 */
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
656 public String createDynamicMapserverStyle(
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
657 final float from,
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
658 float to,
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
659 float step,
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
660 final CallMeta meta
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
661 ) {
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
662 final MapserverStyle ms = new MapserverStyle();
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
663
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
664 final String strStartColor = getValue(WSPLGEN_STARTCOLOR);
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
665 final Color startColor = strStartColor != null
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
666 ? parseColor(strStartColor)
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
667 : new Color(178, 201, 215);
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
668 final String strEndColor = getValue(WSPLGEN_ENDCOLOR);
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
669 final Color endColor = strEndColor != null
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
670 ? parseColor(strEndColor)
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
671 : new Color(2, 27, 42);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
672
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
673 to = to >= 0 ? to : 9999;
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
674 step = to != from ? step : 1;
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
675
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
676 final int numClasses = (int)((to - from) / step + 1);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
677
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
678 final float rd = (endColor.getRed() - startColor.getRed())
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
679 / (float)numClasses;
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
680 final float gd = (endColor.getGreen() - startColor.getGreen())
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
681 / (float)numClasses;
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
682 final float bd = (endColor.getBlue() - startColor.getBlue())
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
683 / (float)numClasses;
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
684
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
685 for (int n = 0; n < numClasses; n++) {
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
686 final StringBuilder newColor = new StringBuilder();
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
687 newColor.append(startColor.getRed() + Math.round(n * rd));
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
688 newColor.append(' ');
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
689 newColor.append(startColor.getGreen() + Math.round(n * gd));
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
690 newColor.append(' ');
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
691 newColor.append(startColor.getBlue() + Math.round(n * bd));
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
692
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
693 final String expr = createWSPLGENClassExpression(
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
694 from + n * step, step, n + 1, numClasses);
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
695 final String name = createWSPLGENClassName(
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
696 from + n * step, step, n + 1, numClasses, meta);
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
697
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
698 final Clazz c = new Clazz(name);
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
699 final Style s = new Style();
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
700 s.setColor(newColor.toString());
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
701 s.setSize(5);
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
702
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
703 c.addItem(new Expression("(" + expr + ")"));
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
704 c.addItem(s);
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
705
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
706 ms.addClazz(c);
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
707 }
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
708
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
709 return ms.toString();
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
710 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
711
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
712
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8635
diff changeset
713 protected static String createWSPLGENClassExpression(
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
714 final float val,
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
715 final float step,
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
716 final int idx,
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
717 final int maxIdx
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
718 ) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
719 if (idx < maxIdx) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
720 return "[DIFF] >= " + val + " AND [DIFF] < " + (val + step);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
721 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
722 else {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
723 return "[DIFF] >= " + val;
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
724 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
725 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
726
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
727 /**
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
728 * Creates a class name for the mapfile style that visualizes a floodmap.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
729 * The class names are used in the map's legend.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
730 *
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
731 * @param val Current isobath value.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
732 * @param step Difference between to class values.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
733 * @param idx Current class index that is being processed.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
734 * @param maxIdx Highest class index.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
735 * @param meta Caller meta object used to determine locale.
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
736 * @return
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
737 */
6912
058b8dc4e8b6 Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6909
diff changeset
738 protected static String createWSPLGENClassName(
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
739 final float val,
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
740 final float step,
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
741 final int idx,
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
742 final int maxIdx,
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
743 final CallMeta meta
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
744 ) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
745 assert meta != null : "CallMeta instance is null";
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
746
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
747 if (idx < maxIdx) {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
748 return Resources.getMsg(meta, MSG_ISOBATH_CLASS,
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
749 new Object[] {val, val + step});
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
750 }
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
751 return Resources.getMsg(meta, MSG_ISOBATH_LASTCLASS,
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
752 new Object[] {val});
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
753 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
754
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
755
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
756 public String createMapserverStyle() {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
757 final String symbol = getSymbol();
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
758 final String backcolor = getLabelBackgroundColorString();
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
759 String linecolor = getLineColorString();
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
760 if (linecolor == null) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7820
diff changeset
761 log.warn("createMapserverStyle: linecolor String is empty");
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
762 linecolor = "0,128,255";
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
763 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
764
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
765 final int linewidth = parseLineWidth();
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
766
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
767 final MapserverStyle ms = new MapserverStyle();
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
768
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
769 final Clazz c = new Clazz(" ");
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
770
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
771 final Style s = new Style();
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
772 s.setOutlineColor(linecolor.replace(",", " "));
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
773
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
774 if (backcolor != null) {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
775 s.setColor(backcolor.replace(",", " "));
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
776 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
777
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
778 s.setSize(linewidth);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
779 s.setSymbol(symbol);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
780 c.addItem(s);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
781
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
782 final String textcolor = getTextColorString();
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
783 final int textsize = parseTextSize();
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
784
6909
835e07ee769d Artifacts: ThemeDocument. Removed some zero length checks because we do not store zero length strings in the backing map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6908
diff changeset
785 if (textcolor != null && textsize > 0) {
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
786 final Label l = new Label();
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
787 l.setColor(textcolor.replace(",", " "));
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
788 l.setSize(textsize);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
789 c.addItem(l);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
790 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
791
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
792 ms.addClazz(c);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
793
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
794 return ms.toString();
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
795 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
796
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
797
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
798 private String getAreaBackgroundColorString() {
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
799 return getValue(AREA_BACKGROUND_COLOR);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
800 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
801
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
802
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
803 public Color parseAreaBackgroundColor() {
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
804 return parseColor(getAreaBackgroundColorString());
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
805 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
806
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
807
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
808 public int parseAreaTransparency() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
809 return parseAreaTransparency(50);
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
810 }
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
811
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
812 public int parseAreaTransparency(final int alpha) {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
813 return parseInteger(getAreaTransparencyString(), alpha);
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
814 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
815
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
816
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
817 public boolean parseAreaShowBorder() {
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
818 return parseBoolean(getAreaShowBorderString(), false);
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
819 }
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
820
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
821
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
822 private String getAreaShowBorderString() {
6908
819481cc9195 Artifacts: ThemeDocument. The bloody part: Removal of the XPaths. Now the theme XML document is scanned once(!) at construction time for field values and the resulting key/value pairs are store in a map.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6906
diff changeset
823 return getValue(AREA_SHOW_BORDER);
6906
7a9cbb3a3d5a Artifacts: Moved logic of ThemeUtils into ThemeDocument. TODO: Remove ThemeUtils
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
824 }
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
825
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
826
8885
e5f688820951 Some minor changes on chart: allow area-themes to consider range; allow for axis-margins
gernotbelger
parents: 8856
diff changeset
827 public boolean parseCalculateRange() {
e5f688820951 Some minor changes on chart: allow area-themes to consider range; allow for axis-margins
gernotbelger
parents: 8856
diff changeset
828 return parseBoolean(getCalculateRangeString(), false);
e5f688820951 Some minor changes on chart: allow area-themes to consider range; allow for axis-margins
gernotbelger
parents: 8856
diff changeset
829 }
e5f688820951 Some minor changes on chart: allow area-themes to consider range; allow for axis-margins
gernotbelger
parents: 8856
diff changeset
830
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
831
8885
e5f688820951 Some minor changes on chart: allow area-themes to consider range; allow for axis-margins
gernotbelger
parents: 8856
diff changeset
832 private String getCalculateRangeString() {
e5f688820951 Some minor changes on chart: allow area-themes to consider range; allow for axis-margins
gernotbelger
parents: 8856
diff changeset
833 return getValue(CALCULATE_RANGE);
e5f688820951 Some minor changes on chart: allow area-themes to consider range; allow for axis-margins
gernotbelger
parents: 8856
diff changeset
834 }
8910
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8885
diff changeset
835
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8885
diff changeset
836 public AreaFillPattern parseAreaBackgroundPattern() {
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8885
diff changeset
837 final String patternName = getValue(AREA_BACKGROUND_PATTERN);
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8885
diff changeset
838 if( StringUtils.isBlank(patternName) )
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8885
diff changeset
839 return null;
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
840
8910
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8885
diff changeset
841 try {
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8885
diff changeset
842 return AreaFillPattern.valueOf(patternName);
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8885
diff changeset
843 }
9555
ef5754ba5573 Implemented legend aggregation based on type of themes.
gernotbelger
parents: 9325
diff changeset
844 catch (final Exception e) {
8910
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8885
diff changeset
845 log.error(String.format("%s: invalid pattern name: %s", AREA_BACKGROUND_PATTERN, patternName), e);
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8885
diff changeset
846 return null;
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8885
diff changeset
847 }
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8885
diff changeset
848 }
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
849 }
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
850 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org