Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java @ 1089:e298c4d28927
Improved mainvalues rendering.
flys-artifacts/trunk@2592 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 26 Aug 2011 11:15:24 +0000 |
parents | 07878836ee0d |
children | 0eb585cd3882 |
rev | line source |
---|---|
392
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.exports; |
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 import org.apache.log4j.Logger; |
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 |
1083
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
4 import java.util.ArrayList; |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
5 import java.util.List; |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
6 |
392
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 import org.w3c.dom.Document; |
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 |
414
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
9 import org.jfree.chart.JFreeChart; |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
10 import org.jfree.chart.title.TextTitle; |
923
7ca4a287cd0e
#135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
732
diff
changeset
|
11 import org.jfree.data.xy.XYSeries; |
1083
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
12 import org.jfree.chart.axis.ValueAxis; |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
13 import org.jfree.chart.plot.XYPlot; |
1089
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
14 import org.jfree.chart.annotations.XYAnnotation; |
414
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
15 |
392
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 import de.intevation.artifacts.Artifact; |
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
695
45cd58a2a2bb
OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
456
diff
changeset
|
18 import de.intevation.artifactdatabase.state.Facet; |
45cd58a2a2bb
OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
456
diff
changeset
|
19 |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
20 import de.intevation.flys.artifacts.FLYSArtifact; |
1089
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
21 import de.intevation.flys.artifacts.model.NamedDouble; |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
22 import de.intevation.flys.artifacts.model.FacetTypes; |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
392
diff
changeset
|
23 import de.intevation.flys.artifacts.model.WQKms; |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
24 |
1083
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
25 import de.intevation.flys.jfree.StickyAxisAnnotation; |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
392
diff
changeset
|
26 |
392
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 |
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 /** |
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 * An OutGenerator that generates discharge curves. |
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 * |
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 */ |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
33 public class ComputedDischargeCurveGenerator |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
34 extends DischargeCurveGenerator |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
35 implements FacetTypes |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
36 { |
1081
d10efbe2e5c0
Minor cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
924
diff
changeset
|
37 /** The logger used in this generator. */ |
392
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 private static Logger logger = |
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 Logger.getLogger(ComputedDischargeCurveGenerator.class); |
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 |
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 |
408
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
400
diff
changeset
|
42 public static final String I18N_CHART_TITLE = |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
400
diff
changeset
|
43 "chart.computed.discharge.curve.title"; |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
400
diff
changeset
|
44 |
414
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
45 public static final String I18N_CHART_SUBTITLE = |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
46 "chart.computed.discharge.curve.subtitle"; |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
47 |
408
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
400
diff
changeset
|
48 public static final String I18N_YAXIS_LABEL = |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
400
diff
changeset
|
49 "chart.computed.discharge.curve.yaxis.label"; |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
400
diff
changeset
|
50 |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
400
diff
changeset
|
51 public static final String I18N_CHART_TITLE_DEFAULT = "Abflusskurve"; |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
400
diff
changeset
|
52 public static final String I18N_YAXIS_LABEL_DEFAULT = "W [NN + m]"; |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
400
diff
changeset
|
53 |
1089
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
54 /** List of Annotations (specifically, Main Values). */ |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
55 protected List<XYAnnotation> annotations; |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
56 |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
57 // TODO Add pseudodataseries for having mainvalue-text in legend. |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
58 // TODO Let theme pass through to annotations-facets. |
1083
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
59 |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
60 |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
61 /** Trivial Constructor. */ |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
62 public ComputedDischargeCurveGenerator () { |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
63 super(); |
1089
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
64 annotations= new ArrayList<XYAnnotation>(); |
1083
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
65 } |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
66 |
408
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
400
diff
changeset
|
67 |
392
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 @Override |
400
7e5c2e93e449
Changed the y-axis title of the computed discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
69 protected String getChartTitle() { |
408
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
400
diff
changeset
|
70 return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT); |
400
7e5c2e93e449
Changed the y-axis title of the computed discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
71 } |
7e5c2e93e449
Changed the y-axis title of the computed discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
72 |
7e5c2e93e449
Changed the y-axis title of the computed discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
73 |
7e5c2e93e449
Changed the y-axis title of the computed discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
74 @Override |
414
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
75 protected void addSubtitles(JFreeChart chart) { |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
76 double[] dist = getRange(); |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
77 |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
78 Object[] args = new Object[] { |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
79 getRiverName(), |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
80 dist[0] |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
81 }; |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
82 |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
83 String subtitle = msg(I18N_CHART_SUBTITLE, "", args); |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
84 chart.addSubtitle(new TextTitle(subtitle)); |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
85 } |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
86 |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
87 |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
88 @Override |
400
7e5c2e93e449
Changed the y-axis title of the computed discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
89 protected String getYAxisLabel() { |
408
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
400
diff
changeset
|
90 return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT); |
400
7e5c2e93e449
Changed the y-axis title of the computed discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
91 } |
7e5c2e93e449
Changed the y-axis title of the computed discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
92 |
7e5c2e93e449
Changed the y-axis title of the computed discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
93 |
7e5c2e93e449
Changed the y-axis title of the computed discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
94 @Override |
695
45cd58a2a2bb
OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
456
diff
changeset
|
95 public void doOut(Artifact artifact, Facet facet, Document attr) { |
1081
d10efbe2e5c0
Minor cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
924
diff
changeset
|
96 String name = (facet != null) ? facet.getName() : null; |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
392
diff
changeset
|
97 |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
98 logger.debug("ComputedDischargeCurveGenerator.doOut: " + name); |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
392
diff
changeset
|
99 |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
100 if (name == null) { |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
101 logger.warn("Broken facet in computed discharge out generation."); |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
102 return; |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
103 } |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
104 |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
105 FLYSArtifact flys = (FLYSArtifact) artifact; |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
106 Facet f = flys.getNativeFacet(facet); |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
107 |
1083
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
108 if (name.equals(COMPUTED_DISCHARGE_Q)) { |
924
f7761914f745
An initial implementation to render chart series based on the XML configuration in themes.xml.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
923
diff
changeset
|
109 doQOut((WQKms) f.getData(artifact, context), attr); |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
110 } |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
111 else if (name.equals(COMPUTED_DISCHARGE_MAINVALUES_Q)) { |
1089
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
112 doMainValueQAnnotations(f.getData(artifact, context), attr); |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
113 } |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
114 else if (name.equals(COMPUTED_DISCHARGE_MAINVALUES_W)) { |
1089
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
115 doMainValueWAnnotations(f.getData(artifact, context), attr); |
1083
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
116 } |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
117 else { |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
118 logger.warn("Unknown facet type for computed discharge: " + name); |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
119 return; |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
120 } |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
121 } |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
122 |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
123 |
1083
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
124 /** |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
125 * Store W MainValues as annotations for later plotting. |
1083
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
126 */ |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
127 protected void doMainValueWAnnotations(Object o, Document theme) { |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
128 logger.debug("ComputedDischargeCurveGenerator set W MainValues."); |
1089
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
129 List<NamedDouble> mainValuesW = (List<NamedDouble>) o; |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
130 for (NamedDouble mv: mainValuesW) { |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
131 float pos = (float) mv.getValue(); |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
132 String text = mv.getName(); |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
133 StickyAxisAnnotation ta = new StickyAxisAnnotation(text, pos, |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
134 StickyAxisAnnotation.SimpleAxis.Y_AXIS); |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
135 logger.debug("Adding W: " + text + " : " + pos); |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
136 this.annotations.add(ta); |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
137 } |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
138 } |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
139 |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
140 |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
141 /** |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
142 * Store Q MainValues as annotations for later plotting. |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
143 */ |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
144 protected void doMainValueQAnnotations(Object o, Document theme) { |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
145 logger.debug("ComputedDischargeCurveGenerator set Q MainValues."); |
1089
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
146 List<NamedDouble> mainValuesQ = (List<NamedDouble>) o; |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
147 for (NamedDouble mv: mainValuesQ) { |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
148 float pos = (float) mv.getValue(); |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
149 String text = mv.getName(); |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
150 StickyAxisAnnotation ta = new StickyAxisAnnotation(text, pos); |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
151 this.annotations.add(ta); |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
152 } |
1083
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
153 } |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
154 |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
155 |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
156 /** Generate Chart with annotations. */ |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
157 @Override |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
158 public JFreeChart generateChart() { |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
159 JFreeChart c = super.generateChart(); |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
160 XYPlot p = (XYPlot) c.getPlot(); |
1089
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
161 redoAnnotations(p); |
1083
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
162 return c; |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
163 } |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
164 |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
165 |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
166 /** |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
167 * Recalculate some annotation positions and add them to plot. |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
168 * Annotations represent MainValues. |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
169 * @param plot Plot to add annotations to. |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
170 */ |
1089
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
171 protected void redoAnnotations(XYPlot plot) { |
1083
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
172 plot.clearAnnotations(); |
1089
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
173 |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
174 for (XYAnnotation a: annotations) { |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
175 plot.addAnnotation(a, false); |
1083
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
176 } |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
177 } |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
178 |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
179 |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
180 /** |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
181 * Add Q-Series to plot. |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
182 * @param wqkms actual data |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
183 * @param theme theme to use. |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
184 */ |
924
f7761914f745
An initial implementation to render chart series based on the XML configuration in themes.xml.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
923
diff
changeset
|
185 protected void doQOut(WQKms wqkms, Document theme) { |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
392
diff
changeset
|
186 int size = wqkms.size(); |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
392
diff
changeset
|
187 |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
392
diff
changeset
|
188 double[] res = new double[3]; |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
392
diff
changeset
|
189 |
924
f7761914f745
An initial implementation to render chart series based on the XML configuration in themes.xml.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
923
diff
changeset
|
190 XYSeries series = new StyledXYSeries(getSeriesName(wqkms), theme); |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
392
diff
changeset
|
191 for (int i = 0; i < size; i++) { |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
392
diff
changeset
|
192 res = wqkms.get(i, res); |
923
7ca4a287cd0e
#135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
732
diff
changeset
|
193 series.add(res[1], res[0]); |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
392
diff
changeset
|
194 } |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
392
diff
changeset
|
195 |
923
7ca4a287cd0e
#135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
732
diff
changeset
|
196 addFirstAxisSeries(series); |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
392
diff
changeset
|
197 } |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
392
diff
changeset
|
198 |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
392
diff
changeset
|
199 |
456
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
200 protected String getSeriesName(WQKms wqkms) { |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
201 Object[] args = new Object[] { |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
202 getRiverName(), |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
203 wqkms.getName() |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
204 }; |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
205 |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
206 return msg( |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
207 "chart.computed.discharge.curve.curve.label", |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
208 "", |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
209 args); |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
210 } |
392
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
211 } |
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
212 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |