annotate flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java @ 734:56d70e546800

#174 Longitudinal section charts will now have an upper margin again. flys-artifacts/trunk@2229 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 24 Jun 2011 12:05:13 +0000
parents d60cc6453d45
children f959faaa7c4a
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
420
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
3 import java.awt.Color;
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
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;
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
9 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
10 import org.jfree.chart.plot.XYPlot;
420
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
11 import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
414
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
12 import org.jfree.chart.title.TextTitle;
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
13 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
14 import org.jfree.data.xy.XYSeries;
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
15 import org.jfree.data.xy.XYSeriesCollection;
364
8830eecad69e Added the name of the facet to the parameterlist of OutGenerator.doOut().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 359
diff changeset
16
359
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 import org.w3c.dom.Document;
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 import de.intevation.artifacts.Artifact;
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20
695
45cd58a2a2bb OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 666
diff changeset
21 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
22
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
23 import de.intevation.flys.model.River;
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
24
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
25 import de.intevation.flys.artifacts.FLYSArtifact;
706
ddd8b37d5cd3 Removed dead code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 696
diff changeset
26
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
27 import de.intevation.flys.artifacts.model.FacetTypes;
364
8830eecad69e Added the name of the facet to the parameterlist of OutGenerator.doOut().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 359
diff changeset
28 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
29
359
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 /**
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 {
359
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 /** The logger that is used in this generator.*/
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 private static Logger logger =
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 Logger.getLogger(LongitudinalSectionGenerator.class);
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43
408
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 397
diff changeset
44 public static final String I18N_CHART_TITLE =
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 397
diff changeset
45 "chart.longitudinal.section.title";
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 397
diff changeset
46
414
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
47 public static final String I18N_CHART_SUBTITLE =
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
48 "chart.longitudinal.section.subtitle";
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
49
408
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 397
diff changeset
50 public static final String I18N_XAXIS_LABEL =
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 397
diff changeset
51 "chart.longitudinal.section.xaxis.label";
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 397
diff changeset
52
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 397
diff changeset
53 public static final String I18N_YAXIS_LABEL =
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 397
diff changeset
54 "chart.longitudinal.section.yaxis.label";
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 397
diff changeset
55
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 397
diff changeset
56 public static final String I18N_2YAXIS_LABEL =
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 397
diff changeset
57 "chart.longitudinal.section.yaxis.second.label";
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 397
diff changeset
58
664
e006da5679d2 s@m³/s@m\u00b3/s@
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 448
diff changeset
59 public static final String I18N_CHART_TITLE_DEFAULT = "W-L\u00e4ngsschnitt";
408
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 397
diff changeset
60 public static final String I18N_XAXIS_LABEL_DEFAULT = "km";
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 397
diff changeset
61 public static final String I18N_YAXIS_LABEL_DEFAULT = "W [NN + m]";
664
e006da5679d2 s@m³/s@m\u00b3/s@
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 448
diff changeset
62 public static final String I18N_2YAXIS_LABEL_DEFAULT = "Q [m\u00b3/s]";
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
63
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
64 /** The storage for the W series to be drawn in this chart.*/
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
65 protected XYSeriesCollection w;
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
66
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
67 /** The storage for the Q series to be drawn in this chart.*/
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
68 protected XYSeriesCollection q;
364
8830eecad69e Added the name of the facet to the parameterlist of OutGenerator.doOut().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 359
diff changeset
69
8830eecad69e Added the name of the facet to the parameterlist of OutGenerator.doOut().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 359
diff changeset
70
359
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 public LongitudinalSectionGenerator() {
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 super();
364
8830eecad69e Added the name of the facet to the parameterlist of OutGenerator.doOut().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 359
diff changeset
73
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
74 this.w = new XYSeriesCollection();
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
75 this.q = new XYSeriesCollection();
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
76 }
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
77
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
78
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
79 protected String getChartTitle() {
408
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 397
diff changeset
80 return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT);
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
81 }
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
82
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
83
414
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
84 @Override
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
85 protected void addSubtitles(JFreeChart chart) {
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
86 double[] dist = getRange();
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
87
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
88 Object[] args = new Object[] {
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
89 getRiverName(),
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
90 dist[0],
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
91 dist[1]
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
92 };
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
93
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
94 String subtitle = msg(I18N_CHART_SUBTITLE, "", args);
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
95 chart.addSubtitle(new TextTitle(subtitle));
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
96 }
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
97
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
98
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
99 protected String getXAxisLabel() {
408
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 397
diff changeset
100 return msg(I18N_XAXIS_LABEL, I18N_XAXIS_LABEL_DEFAULT);
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
101 }
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
102
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
103
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
104 protected String getYAxisLabel() {
408
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 397
diff changeset
105 return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT);
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
106 }
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
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
719
035c0095b427 Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 706
diff changeset
109 @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
110 protected void addDatasets(JFreeChart chart) {
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
111 XYPlot plot = (XYPlot) chart.getPlot();
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
112
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
113 plot.setDataset(0, w);
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
114 plot.setDataset(1, q);
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
115 }
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
116
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
117
420
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
118 protected void adjustPlot(XYPlot plot) {
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
119 super.adjustPlot(plot);
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
120
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
121 // TODO REMOVE THIS CODE, IF WE HAVE INTRODUCED THEMES!
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
122 XYLineAndShapeRenderer rw = (XYLineAndShapeRenderer)
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
123 plot.getRendererForDataset(w);
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
124
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
125 XYLineAndShapeRenderer rq = null;
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
126 try {
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
127 rq = (XYLineAndShapeRenderer) rw.clone();
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
128 }
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
129 catch (Exception e) {
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
130 logger.error(e, e);
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
131 }
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
132
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
133 int wNum = w.getSeriesCount();
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
134 int qNum = q.getSeriesCount();
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
135
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
136 for (int i = 0; i < wNum; i++) {
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
137 rw.setSeriesPaint(i, Color.BLUE);
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
138 }
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
139
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
140 for (int i = 0; i < qNum; i++) {
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
141 rq.setSeriesPaint(i, Color.GREEN);
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
142 }
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
143
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
144 plot.setRenderer(0, rw);
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
145 plot.setRenderer(1, rq);
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
146 }
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
147
a0afdda4d4b9 ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
148
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
149 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
150 super.adjustAxes(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
151
408
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 397
diff changeset
152 NumberAxis qAxis = new NumberAxis(
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 397
diff changeset
153 msg(I18N_2YAXIS_LABEL, I18N_2YAXIS_LABEL_DEFAULT));
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
154
666
eb45e05e5c5b Set the second y axis to axis position 1 (starts at 0).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 664
diff changeset
155 plot.setRangeAxis(1, qAxis);
eb45e05e5c5b Set the second y axis to axis position 1 (starts at 0).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 664
diff changeset
156 plot.mapDatasetToRangeAxis(1, 1);
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
157
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
158 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
159 }
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
160
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
161
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
162 /**
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
163 * This method overrides the XYChartGenerators zoomY method to include the 0
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
164 * value on the Q axis.
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
165 */
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
166 @Override
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
167 protected boolean zoomY(XYPlot plot, ValueAxis axis, Range range, Range x) {
734
56d70e546800 #174 Longitudinal section charts will now have an upper margin again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 720
diff changeset
168 if (plot.getRangeAxisIndex(axis) == 1) {
56d70e546800 #174 Longitudinal section charts will now have an upper margin again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 720
diff changeset
169 // we want the Q axis to start at 0 if no zooming has been done
56d70e546800 #174 Longitudinal section charts will now have an upper margin again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 720
diff changeset
170 range = new Range(0d, range.getUpperBound());
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
171 }
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
172
734
56d70e546800 #174 Longitudinal section charts will now have an upper margin again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 720
diff changeset
173 return super.zoomY(plot, axis, range, x);
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
174 }
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
175
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
176
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
177 /**
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
178 * 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
179 * 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
180 * 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
181 *
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
182 * @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
183 */
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
184 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
185 FLYSArtifact artifact = (FLYSArtifact) master;
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
186 River river = artifact.getRiver();
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
187
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
188 boolean up = river.getKmUp();
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
189
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
190 if (up) {
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
191 logger.info("Invert X-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
192 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
193 }
359
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
194 }
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
195
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
196
695
45cd58a2a2bb OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 666
diff changeset
197 public void doOut(Artifact artifact, Facet facet, Document attr) {
45cd58a2a2bb OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 666
diff changeset
198 String name = facet.getName();
359
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
199
695
45cd58a2a2bb OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 666
diff changeset
200 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
201
45cd58a2a2bb OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 666
diff changeset
202 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
203 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
204 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
205 }
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
206
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
207 FLYSArtifact flys = (FLYSArtifact) artifact;
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
208 Facet f = flys.getNativeFacet(facet);
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
209
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
210 if (f == null) {
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
211 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
212 }
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
213
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
214 if (name.equals(LONGITUDINAL_W)) {
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
215 doWOut((WQKms) f.getData(artifact, context));
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
216 }
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
217 else if (name.equals(LONGITUDINAL_Q)) {
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
218 doQOut((WQKms) f.getData(artifact, context));
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
219 }
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
220 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
221 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
222 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
223 }
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
224 }
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
225
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
226
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
227 /**
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
228 * 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
229 *
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
230 * @param wqkms An array of WQKms values.
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
231 */
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
232 protected void doWOut(WQKms wqkms) {
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
233 logger.debug("LongitudinalSectionGenerator.doWOut");
359
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
234
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
235 XYSeries series = new XYSeries(getSeriesName(wqkms, "W"));
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
236
719
035c0095b427 Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 706
diff changeset
237 int size = wqkms.size();
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
238
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
239 if (logger.isDebugEnabled()) {
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
240 if (wqkms.size() > 0) {
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
241 logger.debug("Generate series: " + series.getKey());
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
242 logger.debug("Start km: " + wqkms.getKms(0));
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
243 logger.debug("End km: " + wqkms.getKms(size-1));
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
244 logger.debug("Values : " + size);
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
245 }
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
246 }
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
247
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
248 for (int i = 0; i < size; i++) {
719
035c0095b427 Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 706
diff changeset
249 series.add(wqkms.getKms(i), wqkms.getW(i));
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
250 }
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
251
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
252 w.addSeries(series);
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
253 }
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
254
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
255
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
256 /**
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
257 * 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
258 *
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
259 * @param wqkms An array of WQKms values.
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
260 */
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
261 protected void doQOut(WQKms wqkms) {
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
262 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
263
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
264 XYSeries series = new XYSeries(getSeriesName(wqkms, "Q"));
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
265
719
035c0095b427 Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 706
diff changeset
266 int size = wqkms.size();
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
267
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
268 if (logger.isDebugEnabled()) {
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
269 if (wqkms.size() > 0) {
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
270 logger.debug("Generate series: " + series.getKey());
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
271 logger.debug("Start km: " + wqkms.getKms(0));
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
272 logger.debug("End km: " + wqkms.getKms(size-1));
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
273 logger.debug("Values : " + size);
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
274 }
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
275 }
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 for (int i = 0; i < size; i++) {
719
035c0095b427 Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 706
diff changeset
278 series.add(wqkms.getKms(i), wqkms.getQ(i));
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
279 }
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 q.addSeries(series);
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
282 }
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
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
284
448
88d9e1d75d64 W and Q curves in longitudinal section curves will now have names.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 422
diff changeset
285 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
286 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
287 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
288
88d9e1d75d64 W and Q curves in longitudinal section curves will now have names.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 422
diff changeset
289 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
290 ? 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
291 : name;
359
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
292 }
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
293 }
e5ea6a01526c Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
294 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org