Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/jfree/XYStyle.java @ 4798:39885bdfc6fc
Added calculation of the "Umhuellende" to calculation of "W fuer ungleichwertige Abfluesse".
This is done by figuring out the WST columns that imfold the data and then do
simple "gleichwertige" calculations from the start of the interval. This
is too much because only the Qs are needed for the "Umhuellende".
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Sun, 13 Jan 2013 16:18:28 +0100 |
parents | 0b9b2a0c4e64 |
children |
rev | line source |
---|---|
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.jfree; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
3464
0b9b2a0c4e64
Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents:
3405
diff
changeset
|
3 import de.intevation.flys.utils.ThemeUtil; |
0b9b2a0c4e64
Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents:
3405
diff
changeset
|
4 |
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import java.awt.BasicStroke; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import java.awt.Color; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 import java.awt.geom.Ellipse2D; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 |
3155
74c974b10c75
Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents:
3134
diff
changeset
|
9 import org.apache.log4j.Logger; |
3464
0b9b2a0c4e64
Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents:
3405
diff
changeset
|
10 import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; |
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import org.w3c.dom.Document; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 /** |
2648
8aaa7f4ce06a
Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2321
diff
changeset
|
15 * Utility to apply theme-settings to a renderer. |
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 */ |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 public class XYStyle implements Style { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 |
3155
74c974b10c75
Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents:
3134
diff
changeset
|
20 private static Logger logger = Logger.getLogger(XYStyle.class); |
74c974b10c75
Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents:
3134
diff
changeset
|
21 |
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 protected Document theme; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 |
3134
5a0aef74c316
Use different stylings for real and interpolated data points.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3090
diff
changeset
|
24 protected XYLineAndShapeRenderer renderer; |
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 |
3155
74c974b10c75
Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents:
3134
diff
changeset
|
26 |
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 public XYStyle(Document theme) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 this.theme = theme; |
3134
5a0aef74c316
Use different stylings for real and interpolated data points.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3090
diff
changeset
|
29 this.renderer = null; |
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 /** |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 * Applies line color, size and type attributes to renderer, also |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 * whether to draw lines and/or points. |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 */ |
3464
0b9b2a0c4e64
Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents:
3405
diff
changeset
|
37 @Override |
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 public XYLineAndShapeRenderer applyTheme(XYLineAndShapeRenderer r, int idx){ |
3134
5a0aef74c316
Use different stylings for real and interpolated data points.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3090
diff
changeset
|
39 this.renderer = r; |
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 applyLineColor(r, idx); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 applyLineSize(r, idx); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 applyLineType(r, idx); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 applyShowLine(r, idx); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 applyShowPoints(r, idx); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 applyPointSize(r, idx); |
3090
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2662
diff
changeset
|
46 applyPointColor(r, idx); |
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 applyShowMinimum(r, idx); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 applyShowMaximum(r, idx); |
3464
0b9b2a0c4e64
Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents:
3405
diff
changeset
|
49 |
0b9b2a0c4e64
Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents:
3405
diff
changeset
|
50 // Line label styles |
2648
8aaa7f4ce06a
Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2321
diff
changeset
|
51 applyShowLineLabel(r, idx); |
3464
0b9b2a0c4e64
Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents:
3405
diff
changeset
|
52 applyShowLineLabelBG(r, idx); |
2656
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
53 applyLineLabelFont(r, idx); |
2660
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
54 applyLineLabelColor(r, idx); |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
55 applyLineLabelBGColor(r, idx); |
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 |
3464
0b9b2a0c4e64
Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents:
3405
diff
changeset
|
57 // Point label styles |
0b9b2a0c4e64
Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents:
3405
diff
changeset
|
58 // TODO: Currently point label are annotations and are not drawn this way |
0b9b2a0c4e64
Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents:
3405
diff
changeset
|
59 /* |
0b9b2a0c4e64
Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents:
3405
diff
changeset
|
60 applyShowPointLabelBG(r, idx); |
0b9b2a0c4e64
Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents:
3405
diff
changeset
|
61 applyLinePointFont(r, idx); |
0b9b2a0c4e64
Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents:
3405
diff
changeset
|
62 applyLinePointColor(r, idx); |
0b9b2a0c4e64
Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents:
3405
diff
changeset
|
63 applyLinePointBGColor(r, idx);*/ |
0b9b2a0c4e64
Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents:
3405
diff
changeset
|
64 |
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 return r; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 /** Set line color to renderer. */ |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 protected void applyLineColor(XYLineAndShapeRenderer r, int idx) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 Color c = ThemeUtil.parseLineColorField(theme); |
3155
74c974b10c75
Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents:
3134
diff
changeset
|
72 if(c != null) { |
74c974b10c75
Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents:
3134
diff
changeset
|
73 logger.debug("applyLineColor " + c.toString()); |
74c974b10c75
Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents:
3134
diff
changeset
|
74 r.setSeriesPaint(idx, c); |
74c974b10c75
Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents:
3134
diff
changeset
|
75 } |
74c974b10c75
Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents:
3134
diff
changeset
|
76 else { |
74c974b10c75
Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents:
3134
diff
changeset
|
77 logger.warn("applyLineColor: color is null - malformed linecolor field?"); |
74c974b10c75
Output code to trackdown the linecolor problem
Christian Lins <christian.lins@intevation.de>
parents:
3134
diff
changeset
|
78 } |
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 |
2648
8aaa7f4ce06a
Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2321
diff
changeset
|
82 /** Tells the renderer whether or not to add a label to a line. */ |
8aaa7f4ce06a
Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2321
diff
changeset
|
83 protected void applyShowLineLabel(XYLineAndShapeRenderer r, int idx) { |
8aaa7f4ce06a
Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2321
diff
changeset
|
84 if (!(r instanceof EnhancedLineAndShapeRenderer)) { |
8aaa7f4ce06a
Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2321
diff
changeset
|
85 return; |
8aaa7f4ce06a
Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2321
diff
changeset
|
86 } |
8aaa7f4ce06a
Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2321
diff
changeset
|
87 boolean showLabelLine = ThemeUtil.parseShowLineLabel(theme); |
3228
698d09930329
Fix issue695 (labels of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3155
diff
changeset
|
88 boolean anyLabel = showLabelLine || ThemeUtil.parseShowWidth(theme) || |
698d09930329
Fix issue695 (labels of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3155
diff
changeset
|
89 ThemeUtil.parseShowLevel(theme) || |
698d09930329
Fix issue695 (labels of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3155
diff
changeset
|
90 ThemeUtil.parseShowMiddleHeight(theme); |
698d09930329
Fix issue695 (labels of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3155
diff
changeset
|
91 ((EnhancedLineAndShapeRenderer)r).setShowLineLabel(anyLabel, idx); |
2648
8aaa7f4ce06a
Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2321
diff
changeset
|
92 } |
8aaa7f4ce06a
Let theme define whether or not to display a (yet static) label for line).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2321
diff
changeset
|
93 |
2656
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
94 |
2662
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
95 /** Tells the renderer whether or not to fill the bg of a lines label. */ |
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
96 protected void applyShowLineLabelBG(XYLineAndShapeRenderer r, int idx) { |
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
97 if (!(r instanceof EnhancedLineAndShapeRenderer)) { |
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
98 return; |
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
99 } |
3464
0b9b2a0c4e64
Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents:
3405
diff
changeset
|
100 boolean showLabelLine = ThemeUtil.parseLabelShowBackground(theme); |
2662
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
101 ((EnhancedLineAndShapeRenderer)r).setShowLineLabelBG(idx, showLabelLine); |
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
102 } |
bdc86e61428c
Respect show line label bg setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2660
diff
changeset
|
103 |
2656
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
104 /** Tell the renderer which font (and -size and -style) to use for |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
105 * linelabels. */ |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
106 protected void applyLineLabelFont(XYLineAndShapeRenderer r, int idx) { |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
107 if (!(r instanceof EnhancedLineAndShapeRenderer)) { |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
108 return; |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
109 } |
3464
0b9b2a0c4e64
Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents:
3405
diff
changeset
|
110 ((EnhancedLineAndShapeRenderer)r).setLineLabelFont( |
0b9b2a0c4e64
Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents:
3405
diff
changeset
|
111 ThemeUtil.parseTextFont(theme), idx); |
2656
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
112 } |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
113 |
2660
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
114 /** Tell the renderer which color to use for |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
115 * linelabels. */ |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
116 protected void applyLineLabelColor(XYLineAndShapeRenderer r, int idx) { |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
117 if (!(r instanceof EnhancedLineAndShapeRenderer)) { |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
118 return; |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
119 } |
3464
0b9b2a0c4e64
Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents:
3405
diff
changeset
|
120 ((EnhancedLineAndShapeRenderer)r).setLineLabelTextColor( |
0b9b2a0c4e64
Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents:
3405
diff
changeset
|
121 idx, ThemeUtil.parseTextColor(theme)); |
2660
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
122 } |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
123 |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
124 /** Tell the renderer which color to use for bg of |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
125 * linelabels. */ |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
126 protected void applyLineLabelBGColor(XYLineAndShapeRenderer r, int idx) { |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
127 if (!(r instanceof EnhancedLineAndShapeRenderer)) { |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
128 return; |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
129 } |
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
130 ((EnhancedLineAndShapeRenderer)r).setLineLabelBGColor(idx, |
3464
0b9b2a0c4e64
Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents:
3405
diff
changeset
|
131 ThemeUtil.parseTextBackground(theme)); |
2660
1a044c51abe4
Respect colors of theme for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2656
diff
changeset
|
132 } |
2656
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
133 |
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
134 /** Set stroke of series. */ |
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
135 protected void applyLineSize(XYLineAndShapeRenderer r, int idx) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
136 int size = ThemeUtil.parseLineWidth(theme); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
137 r.setSeriesStroke( |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
138 idx, |
3405
b0ba96bbf01d
Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3228
diff
changeset
|
139 new BasicStroke(size)); |
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
140 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
141 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
142 |
2656
f1dcd5f94ffa
Parse more theme properties for linelabels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2648
diff
changeset
|
143 /** Set stroke strength of series. */ |
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
144 protected void applyLineType(XYLineAndShapeRenderer r, int idx) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
145 int size = ThemeUtil.parseLineWidth(theme); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
146 float[] dashes = ThemeUtil.parseLineStyle(theme); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
147 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
148 // Do not apply the dashed style. |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
149 if (dashes.length <= 1) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
150 return; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
151 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
152 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
153 r.setSeriesStroke( |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
154 idx, |
3405
b0ba96bbf01d
Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3228
diff
changeset
|
155 new BasicStroke(size, |
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
156 BasicStroke.CAP_BUTT, |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
157 BasicStroke.JOIN_ROUND, |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
158 1.0f, |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
159 dashes, |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
160 0.0f)); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
161 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
162 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
163 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
164 protected void applyPointSize(XYLineAndShapeRenderer r, int idx) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
165 int size = ThemeUtil.parsePointWidth(theme); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
166 int dim = 2 * size; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
167 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
168 r.setSeriesShape(idx, new Ellipse2D.Double(-size, -size, dim, dim)); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
169 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
170 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
171 |
3090
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2662
diff
changeset
|
172 protected void applyPointColor(XYLineAndShapeRenderer r, int idx) { |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2662
diff
changeset
|
173 Color c = ThemeUtil.parsePointColor(theme); |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2662
diff
changeset
|
174 |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2662
diff
changeset
|
175 if (c != null) { |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2662
diff
changeset
|
176 r.setSeriesFillPaint(idx, c); |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2662
diff
changeset
|
177 r.setUseFillPaint(true); |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2662
diff
changeset
|
178 r.setDrawOutlines(false); |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2662
diff
changeset
|
179 } |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2662
diff
changeset
|
180 } |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2662
diff
changeset
|
181 |
22def36d37b7
Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2662
diff
changeset
|
182 |
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
183 /** |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
184 * Sets form and visibility of points. |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
185 */ |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
186 protected void applyShowPoints(XYLineAndShapeRenderer r, int idx) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
187 boolean show = ThemeUtil.parseShowPoints(theme); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
188 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
189 r.setSeriesShapesVisible(idx, show); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
190 r.setDrawOutlines(true); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
191 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
192 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
193 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
194 protected void applyShowLine(XYLineAndShapeRenderer r, int idx) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
195 boolean show = ThemeUtil.parseShowLine(theme); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
196 r.setSeriesLinesVisible(idx, show); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
197 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
198 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
199 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
200 protected void applyShowMinimum(XYLineAndShapeRenderer r, int idx) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
201 if (!(r instanceof EnhancedLineAndShapeRenderer)) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
202 return; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
203 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
204 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
205 boolean visible = ThemeUtil.parseShowMinimum(theme); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
206 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
207 EnhancedLineAndShapeRenderer er = (EnhancedLineAndShapeRenderer) r; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
208 er.setIsMinimumShapeVisisble(idx, visible); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
209 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
210 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
211 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
212 protected void applyShowMaximum(XYLineAndShapeRenderer r, int idx) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
213 if (!(r instanceof EnhancedLineAndShapeRenderer)) { |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
214 return; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
215 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
216 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
217 boolean visible = ThemeUtil.parseShowMaximum(theme); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
218 |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
219 EnhancedLineAndShapeRenderer er = (EnhancedLineAndShapeRenderer) r; |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
220 er.setIsMaximumShapeVisible(idx, visible); |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
221 } |
3134
5a0aef74c316
Use different stylings for real and interpolated data points.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3090
diff
changeset
|
222 |
5a0aef74c316
Use different stylings for real and interpolated data points.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3090
diff
changeset
|
223 |
3464
0b9b2a0c4e64
Point labels can have a background color now.
Christian Lins <christian.lins@intevation.de>
parents:
3405
diff
changeset
|
224 @Override |
3134
5a0aef74c316
Use different stylings for real and interpolated data points.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3090
diff
changeset
|
225 public XYLineAndShapeRenderer getRenderer() { |
5a0aef74c316
Use different stylings for real and interpolated data points.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3090
diff
changeset
|
226 return this.renderer; |
5a0aef74c316
Use different stylings for real and interpolated data points.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3090
diff
changeset
|
227 } |
2321
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
228 } |
991e4a5df323
Enabled styling in timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
229 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |