annotate flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java @ 3809:cc83b8e42dbe

Picked rev3347-rev3351 from trunk. flys-artifacts/tags/pre2.6-2011-12-05@3352 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 05 Dec 2011 09:48:44 +0000
parents 65f9d707caff
children 156304542edf
rev   line source
359
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.exports;
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
1690
0053a4529f2f Bugfix: #220 Made y-axes of longitudinal and crosssection charts look equal.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1688
diff changeset
3 import java.awt.Font;
0053a4529f2f Bugfix: #220 Made y-axes of longitudinal and crosssection charts look equal.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1688
diff changeset
4
359
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5 import org.apache.log4j.Logger;
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6
375
60f63539d004 Ws and Qs of a longitudinal section chart are mapped to an own range axis now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 369
diff changeset
7 import org.jfree.chart.JFreeChart;
60f63539d004 Ws and Qs of a longitudinal section chart are mapped to an own range axis now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 369
diff changeset
8 import org.jfree.chart.axis.NumberAxis;
1719
62983d0ced51 Fix missing annotations ('Streckenfavoriten') style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1712
diff changeset
9 import org.jfree.chart.title.TextTitle;
422
3b83341e0cf4 ISSUE-52 The longitudinal section charts will now always have the head of the river at the left side.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 420
diff changeset
10 import org.jfree.chart.axis.ValueAxis;
375
60f63539d004 Ws and Qs of a longitudinal section chart are mapped to an own range axis now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 369
diff changeset
11 import org.jfree.chart.plot.XYPlot;
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
12 import org.jfree.data.xy.XYSeries;
364
8830eecad69e Added the name of the facet to the parameterlist of OutGenerator.doOut().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 359
diff changeset
13
359
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 import org.w3c.dom.Document;
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15
3809
cc83b8e42dbe Picked rev3347-rev3351 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
16 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
695
45cd58a2a2bb OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 666
diff changeset
17 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: 666
diff changeset
18
422
3b83341e0cf4 ISSUE-52 The longitudinal section charts will now always have the head of the river at the left side.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 420
diff changeset
19 import de.intevation.flys.artifacts.FLYSArtifact;
706
ddd8b37d5cd3 Removed dead code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 696
diff changeset
20
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
21 import de.intevation.flys.artifacts.model.FacetTypes;
1769
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
22 import de.intevation.flys.artifacts.model.WKms;
364
8830eecad69e Added the name of the facet to the parameterlist of OutGenerator.doOut().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 359
diff changeset
23 import de.intevation.flys.artifacts.model.WQKms;
8830eecad69e Added the name of the facet to the parameterlist of OutGenerator.doOut().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 359
diff changeset
24
1677
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1673
diff changeset
25 import de.intevation.flys.jfree.FLYSAnnotation;
1688
7eb9015489b0 Worked on flys/issue150
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1684
diff changeset
26
1667
f1af0c07a6ee Bugfix: #346 Modified x and y axis titles of longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1653
diff changeset
27 import de.intevation.flys.utils.FLYSUtils;
1688
7eb9015489b0 Worked on flys/issue150
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1684
diff changeset
28 import de.intevation.flys.utils.DataUtil;
359
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29
1035
9f69a5f0af98 Started implementation of CustomAnnotation to plot collision-free annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1034
diff changeset
30
9f69a5f0af98 Started implementation of CustomAnnotation to plot collision-free annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1034
diff changeset
31 /**
359
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 * An OutGenerator that generates discharge curves.
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 *
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 */
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
36 public class LongitudinalSectionGenerator
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
37 extends XYChartGenerator
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
38 implements FacetTypes
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
39 {
3809
cc83b8e42dbe Picked rev3347-rev3351 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
40 public enum YAXIS {
1931
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
41 W(0),
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
42 Q(1),
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
43 D(2);
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
44 protected int idx;
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
45 private YAXIS(int c) {
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
46 idx = c;
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
47 }
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
48 }
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
49
1037
75cf1b11c97e Improved CustomAnnotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1036
diff changeset
50 /** The logger that is used in this generator. */
359
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 private static Logger logger =
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 Logger.getLogger(LongitudinalSectionGenerator.class);
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53
1700
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
54 /** Key to look up internationalized String for annotations label. */
1041
c3902ff2d3bd Added legend for annotations to LongitudinalSectionDiagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1040
diff changeset
55 public static final String I18N_ANNOTATIONS_LABEL =
c3902ff2d3bd Added legend for annotations to LongitudinalSectionDiagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1040
diff changeset
56 "chart.longitudinal.annotations.label";
c3902ff2d3bd Added legend for annotations to LongitudinalSectionDiagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1040
diff changeset
57
1701
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
58 /**
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
59 * Key to look up internationalized String for LongitudinalSection diagrams
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
60 * titles.
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
61 */
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
62 public static final String I18N_CHART_TITLE =
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
63 "chart.longitudinal.section.title";
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
64
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
65 /**
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
66 * Key to look up internationalized String for LongitudinalSection diagrams
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
67 * subtitles.
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
68 */
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
69 public static final String I18N_CHART_SUBTITLE =
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
70 "chart.longitudinal.section.subtitle";
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
71
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
72 public static final String I18N_XAXIS_LABEL =
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
73 "chart.longitudinal.section.xaxis.label";
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
74
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
75 public static final String I18N_YAXIS_LABEL =
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
76 "chart.longitudinal.section.yaxis.label";
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
77
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
78 public static final String I18N_2YAXIS_LABEL =
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
79 "chart.longitudinal.section.yaxis.second.label";
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
80
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
81 public static final String I18N_CHART_TITLE_DEFAULT = "W-L\u00e4ngsschnitt";
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
82 public static final String I18N_XAXIS_LABEL_DEFAULT = "km";
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
83 public static final String I18N_YAXIS_LABEL_DEFAULT = "W [NN + m]";
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
84 public static final String I18N_2YAXIS_LABEL_DEFAULT = "Q [m\u00b3/s]";
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
85
3809
cc83b8e42dbe Picked rev3347-rev3351 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
86 public final static String I18N_WDIFF_YAXIS_LABEL =
cc83b8e42dbe Picked rev3347-rev3351 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
87 "chart.w_differences.yaxis.label";
cc83b8e42dbe Picked rev3347-rev3351 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
88
cc83b8e42dbe Picked rev3347-rev3351 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
89 public final static String I18N_WDIFF_YAXIS_LABEL_DEFAULT = "m";
cc83b8e42dbe Picked rev3347-rev3351 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
90
1700
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
91 /** Whether or not the plot is inverted (left-right). */
745
f959faaa7c4a Fix for flys/issue150: Invert the x axis if its guessed that water is increasing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 734
diff changeset
92 protected boolean inverted;
f959faaa7c4a Fix for flys/issue150: Invert the x axis if its guessed that water is increasing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 734
diff changeset
93
1041
c3902ff2d3bd Added legend for annotations to LongitudinalSectionDiagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1040
diff changeset
94
359
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 public LongitudinalSectionGenerator() {
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 super();
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
97 }
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
98
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
99
745
f959faaa7c4a Fix for flys/issue150: Invert the x axis if its guessed that water is increasing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 734
diff changeset
100 public boolean isInverted() {
f959faaa7c4a Fix for flys/issue150: Invert the x axis if its guessed that water is increasing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 734
diff changeset
101 return inverted;
f959faaa7c4a Fix for flys/issue150: Invert the x axis if its guessed that water is increasing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 734
diff changeset
102 }
f959faaa7c4a Fix for flys/issue150: Invert the x axis if its guessed that water is increasing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 734
diff changeset
103
1700
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
104
745
f959faaa7c4a Fix for flys/issue150: Invert the x axis if its guessed that water is increasing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 734
diff changeset
105 public void setInverted(boolean inverted) {
f959faaa7c4a Fix for flys/issue150: Invert the x axis if its guessed that water is increasing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 734
diff changeset
106 this.inverted = inverted;
f959faaa7c4a Fix for flys/issue150: Invert the x axis if its guessed that water is increasing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 734
diff changeset
107 }
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
108
1700
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
109
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
110 /**
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
111 * Get internationalized title for chart.
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
112 */
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
113 public String getChartTitle() {
1701
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
114 return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT);
1700
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
115 }
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
116
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
117
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
118 /**
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
119 * Gets key to look up internationalized String for the charts subtitle.
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
120 * @return key to look up translated subtitle.
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
121 */
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
122 protected String getChartSubtitleKey() {
1701
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
123 return I18N_CHART_SUBTITLE;
1700
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
124 }
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
125
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
126
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
127 /**
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
128 * Add (internationalized) subtitle to chart.
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
129 * @see getChartSubtitleKey
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
130 */
414
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
131 @Override
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
132 protected void addSubtitles(JFreeChart chart) {
1700
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
133 double[] dist = getRange();
1719
62983d0ced51 Fix missing annotations ('Streckenfavoriten') style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1712
diff changeset
134
414
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
135 Object[] args = new Object[] {
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
136 getRiverName(),
1719
62983d0ced51 Fix missing annotations ('Streckenfavoriten') style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1712
diff changeset
137
414
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
138 dist[0],
1719
62983d0ced51 Fix missing annotations ('Streckenfavoriten') style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1712
diff changeset
139
414
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
140 dist[1]
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
141 };
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
142
1700
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
143 String subtitle = msg(getChartSubtitleKey(), "", args);
414
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
144 chart.addSubtitle(new TextTitle(subtitle));
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
145 }
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
146
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
147
1700
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
148 /**
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
149 * Get internationalized label for the x axis.
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
150 */
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
151 protected String getXAxisLabel() {
1667
f1af0c07a6ee Bugfix: #346 Modified x and y axis titles of longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1653
diff changeset
152 FLYSArtifact flys = (FLYSArtifact) master;
f1af0c07a6ee Bugfix: #346 Modified x and y axis titles of longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1653
diff changeset
153
f1af0c07a6ee Bugfix: #346 Modified x and y axis titles of longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1653
diff changeset
154 return msg(
1701
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
155 I18N_XAXIS_LABEL,
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
156 I18N_XAXIS_LABEL_DEFAULT,
1667
f1af0c07a6ee Bugfix: #346 Modified x and y axis titles of longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1653
diff changeset
157 new Object[] { FLYSUtils.getRiver(flys).getName() });
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
158 }
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
159
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
160
3809
cc83b8e42dbe Picked rev3347-rev3351 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
161 @Override
cc83b8e42dbe Picked rev3347-rev3351 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
162 protected String getYAxisLabel() {
cc83b8e42dbe Picked rev3347-rev3351 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
163 return getWAxisLabel();
cc83b8e42dbe Picked rev3347-rev3351 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
164 }
cc83b8e42dbe Picked rev3347-rev3351 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
165
1700
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
166 /**
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
167 * Get internationalized label for the y axis.
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
168 */
3809
cc83b8e42dbe Picked rev3347-rev3351 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
169 protected String getWAxisLabel() {
1667
f1af0c07a6ee Bugfix: #346 Modified x and y axis titles of longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1653
diff changeset
170 FLYSArtifact flys = (FLYSArtifact) master;
f1af0c07a6ee Bugfix: #346 Modified x and y axis titles of longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1653
diff changeset
171
1673
68260e38029a Modified code to determine the elevation model of Wsts in the LongitudinalSectionGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1667
diff changeset
172 String unit = FLYSUtils.getRiver(flys).getWstUnit().getName();
1667
f1af0c07a6ee Bugfix: #346 Modified x and y axis titles of longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1653
diff changeset
173
f1af0c07a6ee Bugfix: #346 Modified x and y axis titles of longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1653
diff changeset
174 return msg(
1701
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
175 I18N_YAXIS_LABEL,
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
176 I18N_YAXIS_LABEL_DEFAULT,
1667
f1af0c07a6ee Bugfix: #346 Modified x and y axis titles of longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1653
diff changeset
177 new Object[] { unit });
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
178 }
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
179
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
180
1700
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
181 /**
1931
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
182 * Create Axis for given index.
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
183 * @return axis with according internationalized label.
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
184 */
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
185 @Override
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
186 protected NumberAxis createYAxis(int index) {
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
187 Font labelFont = new Font("Tahoma", Font.BOLD, 14);
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
188 String label = "default";
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
189 if (index == YAXIS.W.idx) {
3809
cc83b8e42dbe Picked rev3347-rev3351 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
190 label = getWAxisLabel();
1931
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
191 }
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
192 else if (index == YAXIS.Q.idx) {
3809
cc83b8e42dbe Picked rev3347-rev3351 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
193 label = msg(getQAxisLabelKey(), getQAxisDefaultLabel());
1931
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
194 }
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
195 else if (index == YAXIS.D.idx) {
3809
cc83b8e42dbe Picked rev3347-rev3351 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
196 label = msg(I18N_WDIFF_YAXIS_LABEL, I18N_WDIFF_YAXIS_LABEL_DEFAULT);
1931
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
197 }
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
198 NumberAxis axis = new NumberAxis(label);
1941
0fa53fa65401 Fix LongitudinalSections multi-axes plotting behavior.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1936
diff changeset
199 // "Q" Axis shall include 0.
0fa53fa65401 Fix LongitudinalSections multi-axes plotting behavior.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1936
diff changeset
200 if (index == YAXIS.Q.idx) {
0fa53fa65401 Fix LongitudinalSections multi-axes plotting behavior.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1936
diff changeset
201 axis.setAutoRangeIncludesZero(true);
0fa53fa65401 Fix LongitudinalSections multi-axes plotting behavior.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1936
diff changeset
202 }
0fa53fa65401 Fix LongitudinalSections multi-axes plotting behavior.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1936
diff changeset
203 else {
0fa53fa65401 Fix LongitudinalSections multi-axes plotting behavior.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1936
diff changeset
204 axis.setAutoRangeIncludesZero(false);
0fa53fa65401 Fix LongitudinalSections multi-axes plotting behavior.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1936
diff changeset
205 }
1931
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
206 axis.setLabelFont(labelFont);
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
207 return axis;
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
208 }
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
209
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
210 /**
1700
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
211 * Get default value for the second Y-Axis' label (if no translation was
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
212 * found).
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
213 */
3809
cc83b8e42dbe Picked rev3347-rev3351 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
214 protected String getQAxisDefaultLabel() {
1701
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
215 return I18N_2YAXIS_LABEL_DEFAULT;
1700
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
216 }
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
217
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
218
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
219 /**
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
220 * Get key for internationalization of the second Y-Axis' label.
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
221 */
3809
cc83b8e42dbe Picked rev3347-rev3351 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
222 protected String getQAxisLabelKey() {
1701
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
223 return I18N_2YAXIS_LABEL;
1700
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
224 }
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
225
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
226
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
227 /**
1931
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
228 * Trigger inversion.
1700
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
229 */
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
230 @Override
375
60f63539d004 Ws and Qs of a longitudinal section chart are mapped to an own range axis now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 369
diff changeset
231 protected void adjustAxes(XYPlot plot) {
60f63539d004 Ws and Qs of a longitudinal section chart are mapped to an own range axis now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 369
diff changeset
232 super.adjustAxes(plot);
422
3b83341e0cf4 ISSUE-52 The longitudinal section charts will now always have the head of the river at the left side.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 420
diff changeset
233 invertXAxis(plot.getDomainAxis());
3b83341e0cf4 ISSUE-52 The longitudinal section charts will now always have the head of the river at the left side.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 420
diff changeset
234 }
3b83341e0cf4 ISSUE-52 The longitudinal section charts will now always have the head of the river at the left side.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 420
diff changeset
235
3b83341e0cf4 ISSUE-52 The longitudinal section charts will now always have the head of the river at the left side.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 420
diff changeset
236
3b83341e0cf4 ISSUE-52 The longitudinal section charts will now always have the head of the river at the left side.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 420
diff changeset
237 /**
3b83341e0cf4 ISSUE-52 The longitudinal section charts will now always have the head of the river at the left side.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 420
diff changeset
238 * This method inverts the x-axis based on the kilometer information of the
3b83341e0cf4 ISSUE-52 The longitudinal section charts will now always have the head of the river at the left side.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 420
diff changeset
239 * selected river. If the head of the river is at kilometer 0, the axis is
3b83341e0cf4 ISSUE-52 The longitudinal section charts will now always have the head of the river at the left side.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 420
diff changeset
240 * not inverted, otherwise it is.
3b83341e0cf4 ISSUE-52 The longitudinal section charts will now always have the head of the river at the left side.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 420
diff changeset
241 *
3b83341e0cf4 ISSUE-52 The longitudinal section charts will now always have the head of the river at the left side.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 420
diff changeset
242 * @param xaxis The domain axis.
3b83341e0cf4 ISSUE-52 The longitudinal section charts will now always have the head of the river at the left side.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 420
diff changeset
243 */
3b83341e0cf4 ISSUE-52 The longitudinal section charts will now always have the head of the river at the left side.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 420
diff changeset
244 protected void invertXAxis(ValueAxis xaxis) {
3b83341e0cf4 ISSUE-52 The longitudinal section charts will now always have the head of the river at the left side.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 420
diff changeset
245
745
f959faaa7c4a Fix for flys/issue150: Invert the x axis if its guessed that water is increasing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 734
diff changeset
246 if (inverted) {
1692
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
247 logger.debug("X-Axis.setInverted(true)");
422
3b83341e0cf4 ISSUE-52 The longitudinal section charts will now always have the head of the river at the left side.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 420
diff changeset
248 xaxis.setInverted(true);
3b83341e0cf4 ISSUE-52 The longitudinal section charts will now always have the head of the river at the left side.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 420
diff changeset
249 }
359
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
250 }
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
251
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
252
1769
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
253 /**
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
254 * Produce output.
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
255 * @param facet current facet.
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
256 * @param attr theme for facet
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
257 */
1684
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1679
diff changeset
258 public void doOut(
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1941
diff changeset
259 ArtifactAndFacet artifactAndFacet,
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1941
diff changeset
260 Document attr,
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1941
diff changeset
261 boolean visible
1684
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1679
diff changeset
262 ) {
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1941
diff changeset
263 String name = artifactAndFacet.getFacetName();
359
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
264
695
45cd58a2a2bb OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 666
diff changeset
265 logger.debug("LongitudinalSectionGenerator.doOut: " + name);
45cd58a2a2bb OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 666
diff changeset
266
45cd58a2a2bb OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 666
diff changeset
267 if (name == null) {
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
268 logger.error("No facet name for doOut(). No output generated!");
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
269 return;
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
270 }
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
271
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1941
diff changeset
272 Facet facet = artifactAndFacet.getFacet();
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
273
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1941
diff changeset
274 if (facet == null) {
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
275 return;
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
276 }
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
277
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
278 if (name.equals(LONGITUDINAL_W)) {
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1941
diff changeset
279 doWOut((WQKms) artifactAndFacet.getData(context), facet, attr, visible);
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
280 }
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
281 else if (name.equals(LONGITUDINAL_Q)) {
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1941
diff changeset
282 doQOut((WQKms) artifactAndFacet.getData(context), facet, attr, visible);
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
283 }
1028
10bafb4f46cc Made (kind of dummy-) Annotations in LongitudinalSection diagrams visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 925
diff changeset
284 else if (name.equals(LONGITUDINAL_ANNOTATION)) {
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1941
diff changeset
285 doAnnotations((FLYSAnnotation) artifactAndFacet.getData(context),
1861
11c4b1429117 Cosmetics, resolve code duplicate.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1815
diff changeset
286 facet, attr, visible);
1028
10bafb4f46cc Made (kind of dummy-) Annotations in LongitudinalSection diagrams visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 925
diff changeset
287 }
1861
11c4b1429117 Cosmetics, resolve code duplicate.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1815
diff changeset
288 else if (name.equals(STATIC_WKMS)
11c4b1429117 Cosmetics, resolve code duplicate.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1815
diff changeset
289 || name.equals(HEIGHTMARKS_POINTS)
11c4b1429117 Cosmetics, resolve code duplicate.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1815
diff changeset
290 || name.equals(STATIC_WQKMS)) {
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1941
diff changeset
291 doWOut((WKms) artifactAndFacet.getData(context), facet, attr, visible);
1769
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
292 }
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
293 else if (name.equals(W_DIFFERENCES)) {
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
294 doWDifferencesOut(
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1941
diff changeset
295 (WKms) artifactAndFacet.getData(context),
1769
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
296 facet,
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
297 attr,
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
298 visible);
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
299 }
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
300 else {
695
45cd58a2a2bb OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 666
diff changeset
301 logger.warn("Unknown facet name: " + name);
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
302 return;
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
303 }
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
304 }
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
305
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
306
1037
75cf1b11c97e Improved CustomAnnotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1036
diff changeset
307 /**
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
308 * Process the output for W facets in a longitudinal section curve.
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
309 *
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
310 * @param wqkms An array of WQKms values.
1712
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1701
diff changeset
311 * @param facet The facet. This facet does NOT support any data objects. Use
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1701
diff changeset
312 * FLYSArtifact.getNativeFacet() instead to retrieve a Facet which supports
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1701
diff changeset
313 * data.
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
314 * @param theme The theme that contains styling information.
1712
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1701
diff changeset
315 * @param visible The visibility of the curve.
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
316 */
1712
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1701
diff changeset
317 protected void doWOut(
1769
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
318 WKms wkms,
1712
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1701
diff changeset
319 Facet facet,
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1701
diff changeset
320 Document theme,
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1701
diff changeset
321 boolean visible
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1701
diff changeset
322 ) {
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
323 logger.debug("LongitudinalSectionGenerator.doWOut");
359
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
324
1712
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1701
diff changeset
325 XYSeries series = new StyledXYSeries(facet.getDescription(), theme);
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
326
1791
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1789
diff changeset
327 StyledSeriesBuilder.addPoints(series, wkms);
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
328
1931
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
329 addAxisSeries(series, YAXIS.W.idx, visible);
745
f959faaa7c4a Fix for flys/issue150: Invert the x axis if its guessed that water is increasing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 734
diff changeset
330
1769
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
331 if (wkms instanceof WQKms) {
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
332 if (needInvertAxis((WQKms) wkms)) {
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
333 setInverted(true);
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
334 }
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
335 }
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
336 }
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
337
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
338
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
339 /**
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
340 * Add items to dataseries which describes the differences.
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
341 */
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
342 protected void doWDifferencesOut(
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
343 WKms wkms,
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
344 Facet facet,
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
345 Document theme,
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
346 boolean visible
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
347 ) {
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
348 logger.debug("WDifferencesCurveGenerator.doWDifferencesOut");
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
349 if (wkms == null) {
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
350 logger.warn("No data to add to WDifferencesChart.");
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
351 return;
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
352 }
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
353
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
354 XYSeries series = new StyledXYSeries(facet.getDescription(), theme);
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
355
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
356 if (logger.isDebugEnabled()) {
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
357 if (wkms.size() > 0) {
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
358 logger.debug("Generate series: " + series.getKey());
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
359 logger.debug("Start km: " + wkms.getKm(0));
1791
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1789
diff changeset
360 logger.debug("End km: " + wkms.getKm(wkms.size() - 1));
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1789
diff changeset
361 logger.debug("Values : " + wkms.size());
1769
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
362 }
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
363 }
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
364
1791
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1789
diff changeset
365 StyledSeriesBuilder.addPoints(series, wkms);
1769
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
366
1931
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
367 addAxisSeries(series, YAXIS.D.idx, visible);
1769
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
368 if (DataUtil.guessWaterIncreasing(wkms.allWs())) {
745
f959faaa7c4a Fix for flys/issue150: Invert the x axis if its guessed that water is increasing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 734
diff changeset
369 setInverted(true);
f959faaa7c4a Fix for flys/issue150: Invert the x axis if its guessed that water is increasing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 734
diff changeset
370 }
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
371 }
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
372
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
373
1769
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
374
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
375 /**
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
376 * Process the output for Q facets in a longitudinal section curve.
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
377 *
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
378 * @param wqkms An array of WQKms values.
1712
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1701
diff changeset
379 * @param facet The facet. This facet does NOT support any data objects. Use
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1701
diff changeset
380 * FLYSArtifact.getNativeFacet() instead to retrieve a Facet which supports
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1701
diff changeset
381 * data.
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
382 * @param theme The theme that contains styling information.
1712
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1701
diff changeset
383 * @param visible The visibility of the curve.
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
384 */
1712
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1701
diff changeset
385 protected void doQOut(
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1701
diff changeset
386 WQKms wqkms,
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1701
diff changeset
387 Facet facet,
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1701
diff changeset
388 Document theme,
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1701
diff changeset
389 boolean visible
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1701
diff changeset
390 ) {
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
391 logger.debug("LongitudinalSectionGenerator.doQOut");
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
392
1712
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1701
diff changeset
393 XYSeries series = new StyledXYSeries(facet.getDescription(), theme);
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
394
1936
0ad05cb691fc Fix bug when adding Q Facet data to LongitudinalSection plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
395 StyledSeriesBuilder.addPointsKmQ(series, wqkms);
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
396
1931
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1861
diff changeset
397 addAxisSeries(series, YAXIS.Q.idx, visible);
745
f959faaa7c4a Fix for flys/issue150: Invert the x axis if its guessed that water is increasing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 734
diff changeset
398
1692
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
399 if (needInvertAxis(wqkms)) {
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
400 setInverted(true);
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
401 }
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
402 }
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
403
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
404
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
405 /**
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
406 * This method determines - taking JFreeCharts auto x value ordering into
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
407 * account - if the x axis need to be inverted. Waterlines in these charts
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
408 * should decrease.
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
409 *
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
410 * @param wqkms The data object that stores the x and y values used for this
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
411 * chart.
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
412 */
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
413 public boolean needInvertAxis(WQKms wqkms) {
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
414 boolean wsUp = wqkms.guessWaterIncreasing();
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
415 boolean kmUp = DataUtil.guessWaterIncreasing(wqkms.allKms());
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
416 boolean inv = (wsUp && kmUp) || (!wsUp && !kmUp);
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
417
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
418 int size = wqkms.size();
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
419
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
420 if (logger.isDebugEnabled()) {
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
421 logger.debug("Values : " + size);
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
422 if (size > 0) {
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
423 logger.debug("Start km: " + wqkms.getKm(0));
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
424 logger.debug("End km: " + wqkms.getKm(size-1));
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
425 }
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
426 logger.debug("wsUp: " + wsUp);
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
427 logger.debug("kmUp: " + kmUp);
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
428 logger.debug("inv: " + inv);
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
429 }
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
430
5201173c3db5 Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1690
diff changeset
431 return inv;
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
432 }
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
433
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
434
1041
c3902ff2d3bd Added legend for annotations to LongitudinalSectionDiagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1040
diff changeset
435 /**
c3902ff2d3bd Added legend for annotations to LongitudinalSectionDiagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1040
diff changeset
436 * Get name of series (displayed in legend).
c3902ff2d3bd Added legend for annotations to LongitudinalSectionDiagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1040
diff changeset
437 * @return name of the series.
c3902ff2d3bd Added legend for annotations to LongitudinalSectionDiagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1040
diff changeset
438 */
448
88d9e1d75d64 W and Q curves in longitudinal section curves will now have names.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 422
diff changeset
439 protected String getSeriesName(WQKms wqkms, String mode) {
88d9e1d75d64 W and Q curves in longitudinal section curves will now have names.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 422
diff changeset
440 String name = wqkms.getName();
88d9e1d75d64 W and Q curves in longitudinal section curves will now have names.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 422
diff changeset
441 String prefix = name != null && name.indexOf(mode) >= 0 ? null : mode;
88d9e1d75d64 W and Q curves in longitudinal section curves will now have names.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 422
diff changeset
442
88d9e1d75d64 W and Q curves in longitudinal section curves will now have names.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 422
diff changeset
443 return prefix != null && prefix.length() > 0
88d9e1d75d64 W and Q curves in longitudinal section curves will now have names.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 422
diff changeset
444 ? prefix + "(" + name +")"
88d9e1d75d64 W and Q curves in longitudinal section curves will now have names.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 422
diff changeset
445 : name;
359
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
446 }
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
447 }
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
448 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org