annotate flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java @ 1944:21a4d2c677a1

Changed doOut signature, side effect from blackboard feature (to come). flys-artifacts/trunk@3334 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 30 Nov 2011 10:10:42 +0000
parents 0fa53fa65401
children 65f9d707caff
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;
720
d60cc6453d45 #161 Include the 0 on the second y axis (the Q axis) in longitudinal section charts intially.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 719
diff changeset
12 import org.jfree.data.Range;
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
13 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
14
359
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import org.w3c.dom.Document;
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 import de.intevation.artifacts.Artifact;
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18
695
45cd58a2a2bb OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 666
diff changeset
19 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
20
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
21 import de.intevation.flys.artifacts.FLYSArtifact;
706
ddd8b37d5cd3 Removed dead code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 696
diff changeset
22
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
23 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
24 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
25 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
26
1677
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1673
diff changeset
27 import de.intevation.flys.jfree.FLYSAnnotation;
1688
7eb9015489b0 Worked on flys/issue150
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1684
diff changeset
28
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1941
diff changeset
29 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1941
diff changeset
30
1667
f1af0c07a6ee Bugfix: #346 Modified x and y axis titles of longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1653
diff changeset
31 import de.intevation.flys.utils.FLYSUtils;
1688
7eb9015489b0 Worked on flys/issue150
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1684
diff changeset
32 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
33
1035
9f69a5f0af98 Started implementation of CustomAnnotation to plot collision-free annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1034
diff changeset
34
9f69a5f0af98 Started implementation of CustomAnnotation to plot collision-free annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1034
diff changeset
35 /**
359
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 * An OutGenerator that generates discharge curves.
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 *
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 * @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
39 */
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
40 public class LongitudinalSectionGenerator
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
41 extends XYChartGenerator
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
42 implements FacetTypes
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
43 {
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
44 public static enum YAXIS {
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 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
46 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
47 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
48 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
49 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
50 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
51 }
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
52 }
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
53
1037
75cf1b11c97e Improved CustomAnnotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1036
diff changeset
54 /** 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
55 private static Logger logger =
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 Logger.getLogger(LongitudinalSectionGenerator.class);
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57
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
58 /** 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
59 public static final String I18N_ANNOTATIONS_LABEL =
c3902ff2d3bd Added legend for annotations to LongitudinalSectionDiagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1040
diff changeset
60 "chart.longitudinal.annotations.label";
c3902ff2d3bd Added legend for annotations to LongitudinalSectionDiagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1040
diff changeset
61
1701
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
62 /**
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
63 * 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
64 * titles.
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 public static final String I18N_CHART_TITLE =
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
67 "chart.longitudinal.section.title";
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 /**
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
70 * 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
71 * subtitles.
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
72 */
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
73 public static final String I18N_CHART_SUBTITLE =
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
74 "chart.longitudinal.section.subtitle";
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
75
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
76 public static final String I18N_XAXIS_LABEL =
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
77 "chart.longitudinal.section.xaxis.label";
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
78
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
79 public static final String I18N_YAXIS_LABEL =
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
80 "chart.longitudinal.section.yaxis.label";
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
81
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
82 public static final String I18N_2YAXIS_LABEL =
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
83 "chart.longitudinal.section.yaxis.second.label";
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
84
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
85 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
86 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
87 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
88 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
89
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
90 /** 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
91 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
92
1041
c3902ff2d3bd Added legend for annotations to LongitudinalSectionDiagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1040
diff changeset
93
359
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94 public LongitudinalSectionGenerator() {
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 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
96 }
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
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
99 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
100 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
101 }
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
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
103
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
104 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
105 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
106 }
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
107
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
108
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 * 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
111 */
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 public String getChartTitle() {
1701
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
113 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
114 }
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 * 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
119 * @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
120 */
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 protected String getChartSubtitleKey() {
1701
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
122 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
123 }
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 * 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
128 * @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
129 */
414
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
130 @Override
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
131 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
132 double[] dist = getRange();
1719
62983d0ced51 Fix missing annotations ('Streckenfavoriten') style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1712
diff changeset
133
414
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
134 Object[] args = new Object[] {
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
135 getRiverName(),
1719
62983d0ced51 Fix missing annotations ('Streckenfavoriten') style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1712
diff changeset
136
414
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
137 dist[0],
1719
62983d0ced51 Fix missing annotations ('Streckenfavoriten') style.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1712
diff changeset
138
414
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
139 dist[1]
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
140 };
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
141
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
142 String subtitle = msg(getChartSubtitleKey(), "", args);
414
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
143 chart.addSubtitle(new TextTitle(subtitle));
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
144 }
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
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
147 /**
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 * 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
149 */
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
150 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
151 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
152
f1af0c07a6ee Bugfix: #346 Modified x and y axis titles of longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1653
diff changeset
153 return msg(
1701
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
154 I18N_XAXIS_LABEL,
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
155 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
156 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
157 }
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
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
160 /**
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
161 * 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
162 */
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
163 protected String getYAxisLabel() {
1667
f1af0c07a6ee Bugfix: #346 Modified x and y axis titles of longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1653
diff changeset
164 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
165
1673
68260e38029a Modified code to determine the elevation model of Wsts in the LongitudinalSectionGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1667
diff changeset
166 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
167
f1af0c07a6ee Bugfix: #346 Modified x and y axis titles of longitudinal section charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1653
diff changeset
168 return msg(
1701
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
169 I18N_YAXIS_LABEL,
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
170 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
171 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
172 }
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
173
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
174
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
175 /**
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
176 * 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
177 * @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
178 */
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
179 @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
180 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
181 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
182 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
183 if (index == YAXIS.W.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
184 label = getYAxisLabel();
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 }
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 else if (index == YAXIS.Q.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
187 label = msg(get2YAxisLabelKey(), get2YAxisDefaultLabel());
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 }
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 else if (index == YAXIS.D.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
190 // TODO: diff 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
191 label = "TODO: diff";
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 }
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
193 NumberAxis axis = new NumberAxis(label);
1941
0fa53fa65401 Fix LongitudinalSections multi-axes plotting behavior.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1936
diff changeset
194 // "Q" Axis shall include 0.
0fa53fa65401 Fix LongitudinalSections multi-axes plotting behavior.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1936
diff changeset
195 if (index == YAXIS.Q.idx) {
0fa53fa65401 Fix LongitudinalSections multi-axes plotting behavior.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1936
diff changeset
196 axis.setAutoRangeIncludesZero(true);
0fa53fa65401 Fix LongitudinalSections multi-axes plotting behavior.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1936
diff changeset
197 }
0fa53fa65401 Fix LongitudinalSections multi-axes plotting behavior.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1936
diff changeset
198 else {
0fa53fa65401 Fix LongitudinalSections multi-axes plotting behavior.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1936
diff changeset
199 axis.setAutoRangeIncludesZero(false);
0fa53fa65401 Fix LongitudinalSections multi-axes plotting behavior.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1936
diff changeset
200 }
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
201 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
202 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
203 }
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
204
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
205 /**
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
206 * 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
207 * 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
208 */
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
209 protected String get2YAxisDefaultLabel() {
1701
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
210 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
211 }
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
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
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
214 /**
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
215 * 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
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 protected String get2YAxisLabelKey() {
1701
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
218 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
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
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
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1697
diff changeset
222 /**
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
223 * 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
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 @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
226 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
227 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
228 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
229 }
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
230
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
231
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
232 /**
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 * 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
234 * 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
235 * 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
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 * @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
238 */
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 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
240
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
241 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
242 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
243 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
244 }
359
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
245 }
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
246
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
247
1769
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
248 /**
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
249 * 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
250 * @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
251 * @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
252 */
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
253 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
254 ArtifactAndFacet artifactAndFacet,
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1941
diff changeset
255 Document attr,
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1941
diff changeset
256 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
257 ) {
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1941
diff changeset
258 String name = artifactAndFacet.getFacetName();
359
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
259
695
45cd58a2a2bb OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 666
diff changeset
260 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
261
45cd58a2a2bb OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 666
diff changeset
262 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
263 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
264 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
265 }
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
266
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1941
diff changeset
267 Facet facet = artifactAndFacet.getFacet();
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
268
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1941
diff changeset
269 if (facet == null) {
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
270 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
271 }
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
272
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
273 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
274 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
275 }
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
276 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
277 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
278 }
1028
10bafb4f46cc Made (kind of dummy-) Annotations in LongitudinalSection diagrams visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 925
diff changeset
279 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
280 doAnnotations((FLYSAnnotation) artifactAndFacet.getData(context),
1861
11c4b1429117 Cosmetics, resolve code duplicate.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1815
diff changeset
281 facet, attr, visible);
1028
10bafb4f46cc Made (kind of dummy-) Annotations in LongitudinalSection diagrams visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 925
diff changeset
282 }
1861
11c4b1429117 Cosmetics, resolve code duplicate.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1815
diff changeset
283 else if (name.equals(STATIC_WKMS)
11c4b1429117 Cosmetics, resolve code duplicate.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1815
diff changeset
284 || name.equals(HEIGHTMARKS_POINTS)
11c4b1429117 Cosmetics, resolve code duplicate.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1815
diff changeset
285 || 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
286 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
287 }
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
288 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
289 doWDifferencesOut(
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1941
diff changeset
290 (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
291 facet,
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
292 attr,
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
293 visible);
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
294 }
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
295 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
296 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
297 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
298 }
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
299 }
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
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
301
1037
75cf1b11c97e Improved CustomAnnotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1036
diff changeset
302 /**
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
303 * 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
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 * @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
306 * @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
307 * 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
308 * 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
309 * @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
310 * @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
311 */
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
312 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
313 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
314 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
315 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
316 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
317 ) {
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
318 logger.debug("LongitudinalSectionGenerator.doWOut");
359
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
319
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
320 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
321
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
322 StyledSeriesBuilder.addPoints(series, wkms);
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
323
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
324 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
325
1769
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
326 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
327 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
328 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
329 }
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
330 }
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
331 }
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
332
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
333
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 * 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
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 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
338 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
339 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
340 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
341 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
342 ) {
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
343 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
344 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
345 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
346 return;
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
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
349 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
350
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
351 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
352 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
353 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
354 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
355 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
356 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
357 }
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
358 }
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
359
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 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
361
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
362 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
363 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
364 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
365 }
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
366 }
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
367
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
368
1769
bbe12d77710d Prepare rendering of added other (static) WKms and Differences in LongitudinalSection Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1719
diff changeset
369
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
370 /**
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 * 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
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 * @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
374 * @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
375 * 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
376 * 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
377 * @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
378 * @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
379 */
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
380 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
381 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
382 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
383 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
384 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
385 ) {
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
386 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
387
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
388 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
389
1936
0ad05cb691fc Fix bug when adding Q Facet data to LongitudinalSection plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
390 StyledSeriesBuilder.addPointsKmQ(series, wqkms);
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
391
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
392 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
393
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
394 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
395 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
396 }
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
397 }
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
398
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
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 /**
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 * 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
402 * 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
403 * 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
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 * @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
406 * 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
407 */
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 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
409 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
410 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
411 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
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 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
414
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 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
416 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
417 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
418 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
419 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
420 }
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("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
422 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
423 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
424 }
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 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
427 }
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
428
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
429
1041
c3902ff2d3bd Added legend for annotations to LongitudinalSectionDiagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1040
diff changeset
430 /**
c3902ff2d3bd Added legend for annotations to LongitudinalSectionDiagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1040
diff changeset
431 * Get name of series (displayed in legend).
c3902ff2d3bd Added legend for annotations to LongitudinalSectionDiagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1040
diff changeset
432 * @return name of the series.
c3902ff2d3bd Added legend for annotations to LongitudinalSectionDiagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1040
diff changeset
433 */
448
88d9e1d75d64 W and Q curves in longitudinal section curves will now have names.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 422
diff changeset
434 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
435 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
436 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
437
88d9e1d75d64 W and Q curves in longitudinal section curves will now have names.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 422
diff changeset
438 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
439 ? 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
440 : name;
359
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
441 }
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
442 }
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
443 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org