Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java @ 1040:5411a33014e0
Moved StickyAxisAnnotation into new package de.intevation.flys.jfree .
flys-artifacts/trunk@2501 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 17 Aug 2011 13:05:15 +0000 |
parents | 4dcc635d6ca6 |
children | c3902ff2d3bd |
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 |
1028
10bafb4f46cc
Made (kind of dummy-) Annotations in LongitudinalSection diagrams visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
3 import java.util.ArrayList; |
10bafb4f46cc
Made (kind of dummy-) Annotations in LongitudinalSection diagrams visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
4 import java.util.List; |
10bafb4f46cc
Made (kind of dummy-) Annotations in LongitudinalSection diagrams visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
5 |
359
e5ea6a01526c
Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import org.apache.log4j.Logger; |
e5ea6a01526c
Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 |
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
|
8 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
|
9 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
|
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; |
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; |
1034
bf3b3a8d089b
Slightly improved rendering of annotations in LongitudinalSection-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1028
diff
changeset
|
15 import org.jfree.ui.TextAnchor; |
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.artifacts.FLYSArtifact; |
706
ddd8b37d5cd3
Removed dead code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
24 |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
25 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
|
26 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
|
27 |
1028
10bafb4f46cc
Made (kind of dummy-) Annotations in LongitudinalSection diagrams visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
28 import de.intevation.flys.model.Annotation; |
1040
5411a33014e0
Moved StickyAxisAnnotation into new package de.intevation.flys.jfree .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1038
diff
changeset
|
29 import de.intevation.flys.jfree.StickyAxisAnnotation; |
359
e5ea6a01526c
Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 |
1035
9f69a5f0af98
Started implementation of CustomAnnotation to plot collision-free annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1034
diff
changeset
|
31 |
9f69a5f0af98
Started implementation of CustomAnnotation to plot collision-free annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1034
diff
changeset
|
32 /** |
359
e5ea6a01526c
Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 * An OutGenerator that generates discharge curves. |
e5ea6a01526c
Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 * |
e5ea6a01526c
Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 * @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
|
36 */ |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
37 public class LongitudinalSectionGenerator |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
38 extends XYChartGenerator |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
39 implements FacetTypes |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
40 { |
1037
75cf1b11c97e
Improved CustomAnnotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1036
diff
changeset
|
41 /** 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
|
42 private static Logger logger = |
e5ea6a01526c
Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 Logger.getLogger(LongitudinalSectionGenerator.class); |
e5ea6a01526c
Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 |
408
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
397
diff
changeset
|
45 public static final String I18N_CHART_TITLE = |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
397
diff
changeset
|
46 "chart.longitudinal.section.title"; |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
397
diff
changeset
|
47 |
414
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
48 public static final String I18N_CHART_SUBTITLE = |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
49 "chart.longitudinal.section.subtitle"; |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
50 |
408
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
397
diff
changeset
|
51 public static final String I18N_XAXIS_LABEL = |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
397
diff
changeset
|
52 "chart.longitudinal.section.xaxis.label"; |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
397
diff
changeset
|
53 |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
397
diff
changeset
|
54 public static final String I18N_YAXIS_LABEL = |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
397
diff
changeset
|
55 "chart.longitudinal.section.yaxis.label"; |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
397
diff
changeset
|
56 |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
397
diff
changeset
|
57 public static final String I18N_2YAXIS_LABEL = |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
397
diff
changeset
|
58 "chart.longitudinal.section.yaxis.second.label"; |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
397
diff
changeset
|
59 |
664
e006da5679d2
s@m³/s@m\u00b3/s@
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
448
diff
changeset
|
60 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
|
61 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
|
62 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
|
63 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
|
64 |
364
8830eecad69e
Added the name of the facet to the parameterlist of OutGenerator.doOut().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
359
diff
changeset
|
65 |
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
|
66 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
|
67 |
1028
10bafb4f46cc
Made (kind of dummy-) Annotations in LongitudinalSection diagrams visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
68 protected List<Annotation> annotations; |
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 |
359
e5ea6a01526c
Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 public LongitudinalSectionGenerator() { |
e5ea6a01526c
Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 super(); |
1028
10bafb4f46cc
Made (kind of dummy-) Annotations in LongitudinalSection diagrams visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
72 annotations = new ArrayList<Annotation>(); |
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
|
73 } |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
74 |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
75 |
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 protected String getChartTitle() { |
408
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
397
diff
changeset
|
77 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
|
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 |
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
|
80 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
|
81 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
|
82 } |
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
|
83 |
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
|
84 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
|
85 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
|
86 } |
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
|
87 |
414
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
88 @Override |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
89 protected void addSubtitles(JFreeChart chart) { |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
90 double[] dist = getRange(); |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
91 |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
92 Object[] args = new Object[] { |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
93 getRiverName(), |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
94 dist[0], |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
95 dist[1] |
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 String subtitle = msg(I18N_CHART_SUBTITLE, "", args); |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
99 chart.addSubtitle(new TextTitle(subtitle)); |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
100 } |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
101 |
1028
10bafb4f46cc
Made (kind of dummy-) Annotations in LongitudinalSection diagrams visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
102 @Override |
10bafb4f46cc
Made (kind of dummy-) Annotations in LongitudinalSection diagrams visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
103 public JFreeChart generateChart() { |
10bafb4f46cc
Made (kind of dummy-) Annotations in LongitudinalSection diagrams visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
104 JFreeChart c = super.generateChart(); |
10bafb4f46cc
Made (kind of dummy-) Annotations in LongitudinalSection diagrams visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
105 XYPlot p = (XYPlot) c.getPlot(); |
10bafb4f46cc
Made (kind of dummy-) Annotations in LongitudinalSection diagrams visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
106 |
1034
bf3b3a8d089b
Slightly improved rendering of annotations in LongitudinalSection-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1028
diff
changeset
|
107 redoAnnotations(p, p.getDomainAxis()); |
bf3b3a8d089b
Slightly improved rendering of annotations in LongitudinalSection-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1028
diff
changeset
|
108 |
1028
10bafb4f46cc
Made (kind of dummy-) Annotations in LongitudinalSection diagrams visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
109 return c; |
10bafb4f46cc
Made (kind of dummy-) Annotations in LongitudinalSection diagrams visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
110 } |
10bafb4f46cc
Made (kind of dummy-) Annotations in LongitudinalSection diagrams visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
111 |
414
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
112 |
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
|
113 protected String getXAxisLabel() { |
408
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
397
diff
changeset
|
114 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
|
115 } |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
116 |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
117 |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
118 protected String getYAxisLabel() { |
408
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
397
diff
changeset
|
119 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
|
120 } |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
121 |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
122 |
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
|
123 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
|
124 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
|
125 |
408
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
397
diff
changeset
|
126 NumberAxis qAxis = new NumberAxis( |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
397
diff
changeset
|
127 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
|
128 |
666
eb45e05e5c5b
Set the second y axis to axis position 1 (starts at 0).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
664
diff
changeset
|
129 plot.setRangeAxis(1, qAxis); |
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
|
130 |
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
|
131 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
|
132 } |
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
|
133 |
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
|
134 |
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
|
135 /** |
1034
bf3b3a8d089b
Slightly improved rendering of annotations in LongitudinalSection-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1028
diff
changeset
|
136 * Remove all annotations from plot and re-insert them at an approximately |
bf3b3a8d089b
Slightly improved rendering of annotations in LongitudinalSection-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1028
diff
changeset
|
137 * okay position. The followed approach is naive but side-effect free. |
1037
75cf1b11c97e
Improved CustomAnnotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1036
diff
changeset
|
138 * |
75cf1b11c97e
Improved CustomAnnotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1036
diff
changeset
|
139 * @param plot the plot. |
75cf1b11c97e
Improved CustomAnnotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1036
diff
changeset
|
140 * @param axis the value axis. |
1034
bf3b3a8d089b
Slightly improved rendering of annotations in LongitudinalSection-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1028
diff
changeset
|
141 */ |
bf3b3a8d089b
Slightly improved rendering of annotations in LongitudinalSection-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1028
diff
changeset
|
142 protected void redoAnnotations(XYPlot plot, ValueAxis axis) { |
bf3b3a8d089b
Slightly improved rendering of annotations in LongitudinalSection-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1028
diff
changeset
|
143 plot.clearAnnotations(); |
1037
75cf1b11c97e
Improved CustomAnnotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1036
diff
changeset
|
144 // TODO Position calculation could/should be done in |
1038
4dcc635d6ca6
Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1037
diff
changeset
|
145 // the StickyAxisAnnotation-Implementation itself. |
1034
bf3b3a8d089b
Slightly improved rendering of annotations in LongitudinalSection-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1028
diff
changeset
|
146 ValueAxis yAxis = plot.getRangeAxis(); |
bf3b3a8d089b
Slightly improved rendering of annotations in LongitudinalSection-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1028
diff
changeset
|
147 float posY = 140.f; |
bf3b3a8d089b
Slightly improved rendering of annotations in LongitudinalSection-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1028
diff
changeset
|
148 if (yAxis != null) { |
bf3b3a8d089b
Slightly improved rendering of annotations in LongitudinalSection-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1028
diff
changeset
|
149 posY = (float) yAxis.getRange().getLowerBound(); |
1037
75cf1b11c97e
Improved CustomAnnotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1036
diff
changeset
|
150 // Add some (2%) space between Text and axis. |
75cf1b11c97e
Improved CustomAnnotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1036
diff
changeset
|
151 posY += 0.02f * (yAxis.getRange().getUpperBound() |
1034
bf3b3a8d089b
Slightly improved rendering of annotations in LongitudinalSection-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1028
diff
changeset
|
152 - yAxis.getRange().getLowerBound()); |
bf3b3a8d089b
Slightly improved rendering of annotations in LongitudinalSection-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1028
diff
changeset
|
153 } |
bf3b3a8d089b
Slightly improved rendering of annotations in LongitudinalSection-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1028
diff
changeset
|
154 |
1036
e6aff80b59ff
Added proof-of-concept collision detection for text annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1035
diff
changeset
|
155 // Add all annotations. |
1034
bf3b3a8d089b
Slightly improved rendering of annotations in LongitudinalSection-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1028
diff
changeset
|
156 for (Annotation a: annotations) { |
bf3b3a8d089b
Slightly improved rendering of annotations in LongitudinalSection-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1028
diff
changeset
|
157 float posX = (float) a.getRange().getA().doubleValue(); |
bf3b3a8d089b
Slightly improved rendering of annotations in LongitudinalSection-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1028
diff
changeset
|
158 String text = a.getPosition().getValue(); |
bf3b3a8d089b
Slightly improved rendering of annotations in LongitudinalSection-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1028
diff
changeset
|
159 |
1038
4dcc635d6ca6
Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1037
diff
changeset
|
160 StickyAxisAnnotation ta = new StickyAxisAnnotation(text, posX, posY); |
1034
bf3b3a8d089b
Slightly improved rendering of annotations in LongitudinalSection-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1028
diff
changeset
|
161 double rotation = 270.0f * (Math.PI / 180.0f); |
bf3b3a8d089b
Slightly improved rendering of annotations in LongitudinalSection-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1028
diff
changeset
|
162 ta.setRotationAngle(rotation); |
bf3b3a8d089b
Slightly improved rendering of annotations in LongitudinalSection-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1028
diff
changeset
|
163 ta.setRotationAnchor(TextAnchor.CENTER_LEFT); |
bf3b3a8d089b
Slightly improved rendering of annotations in LongitudinalSection-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1028
diff
changeset
|
164 ta.setTextAnchor(TextAnchor.CENTER_LEFT); |
bf3b3a8d089b
Slightly improved rendering of annotations in LongitudinalSection-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1028
diff
changeset
|
165 plot.getRenderer().addAnnotation(ta); |
bf3b3a8d089b
Slightly improved rendering of annotations in LongitudinalSection-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1028
diff
changeset
|
166 } |
bf3b3a8d089b
Slightly improved rendering of annotations in LongitudinalSection-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1028
diff
changeset
|
167 } |
bf3b3a8d089b
Slightly improved rendering of annotations in LongitudinalSection-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1028
diff
changeset
|
168 |
bf3b3a8d089b
Slightly improved rendering of annotations in LongitudinalSection-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1028
diff
changeset
|
169 |
bf3b3a8d089b
Slightly improved rendering of annotations in LongitudinalSection-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1028
diff
changeset
|
170 /** |
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 * 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
|
172 * 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
|
173 */ |
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 @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
|
175 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
|
176 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
|
177 // 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
|
178 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
|
179 } |
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
|
180 |
734
56d70e546800
#174 Longitudinal section charts will now have an upper margin again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
720
diff
changeset
|
181 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
|
182 } |
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
|
183 |
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
|
184 |
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
|
185 /** |
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
|
186 * 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
|
187 * 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
|
188 * 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
|
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 * @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
|
191 */ |
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 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
|
193 |
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
|
194 if (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
|
195 logger.debug("Invert X-Axis."); |
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
|
196 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
|
197 } |
359
e5ea6a01526c
Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
198 } |
e5ea6a01526c
Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
199 |
e5ea6a01526c
Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
200 |
695
45cd58a2a2bb
OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
666
diff
changeset
|
201 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
|
202 String name = facet.getName(); |
359
e5ea6a01526c
Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
203 |
695
45cd58a2a2bb
OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
666
diff
changeset
|
204 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
|
205 |
45cd58a2a2bb
OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
666
diff
changeset
|
206 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
|
207 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
|
208 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
|
209 } |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
210 |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
211 FLYSArtifact flys = (FLYSArtifact) artifact; |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
212 Facet f = flys.getNativeFacet(facet); |
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 (f == null) { |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
215 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
|
216 } |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
217 |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
218 if (name.equals(LONGITUDINAL_W)) { |
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
|
219 doWOut((WQKms) f.getData(artifact, context), attr); |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
220 } |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
221 else if (name.equals(LONGITUDINAL_Q)) { |
924
f7761914f745
An initial implementation to render chart series based on the XML configuration in themes.xml.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
923
diff
changeset
|
222 doQOut((WQKms) f.getData(artifact, context), attr); |
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
|
223 } |
1028
10bafb4f46cc
Made (kind of dummy-) Annotations in LongitudinalSection diagrams visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
224 else if (name.equals(LONGITUDINAL_ANNOTATION)) { |
10bafb4f46cc
Made (kind of dummy-) Annotations in LongitudinalSection diagrams visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
225 doAnnotationsOut(f.getData(artifact, context), attr); |
10bafb4f46cc
Made (kind of dummy-) Annotations in LongitudinalSection diagrams visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
226 } |
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
|
227 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
|
228 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
|
229 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
|
230 } |
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 } |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
232 |
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 |
1037
75cf1b11c97e
Improved CustomAnnotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1036
diff
changeset
|
234 /** |
75cf1b11c97e
Improved CustomAnnotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1036
diff
changeset
|
235 * Register annotations available for the diagram. |
75cf1b11c97e
Improved CustomAnnotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1036
diff
changeset
|
236 * |
75cf1b11c97e
Improved CustomAnnotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1036
diff
changeset
|
237 * @param o list of annotations (data of facet). |
75cf1b11c97e
Improved CustomAnnotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1036
diff
changeset
|
238 * @param theme ignored. |
75cf1b11c97e
Improved CustomAnnotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1036
diff
changeset
|
239 */ |
1028
10bafb4f46cc
Made (kind of dummy-) Annotations in LongitudinalSection diagrams visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
240 protected void doAnnotationsOut(Object o, Document theme) { |
10bafb4f46cc
Made (kind of dummy-) Annotations in LongitudinalSection diagrams visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
241 logger.debug("LongitudinalSectionGenerator.doAnnotationsOut"); |
10bafb4f46cc
Made (kind of dummy-) Annotations in LongitudinalSection diagrams visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
242 this.annotations = (List<Annotation>) o; |
10bafb4f46cc
Made (kind of dummy-) Annotations in LongitudinalSection diagrams visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
243 } |
10bafb4f46cc
Made (kind of dummy-) Annotations in LongitudinalSection diagrams visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
244 |
10bafb4f46cc
Made (kind of dummy-) Annotations in LongitudinalSection diagrams visible.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
245 |
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
|
246 /** |
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 * 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
|
248 * |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
249 * @param wqkms An array of WQKms values. |
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
|
250 * @param theme The theme that contains styling information. |
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
|
251 */ |
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
|
252 protected void doWOut(WQKms wqkms, Document 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
|
253 logger.debug("LongitudinalSectionGenerator.doWOut"); |
359
e5ea6a01526c
Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
254 |
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
|
255 XYSeries series = new StyledXYSeries(getSeriesName(wqkms, "W"), 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
|
256 |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
706
diff
changeset
|
257 int size = wqkms.size(); |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
258 |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
259 if (logger.isDebugEnabled()) { |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
260 if (wqkms.size() > 0) { |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
261 logger.debug("Generate series: " + series.getKey()); |
925
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
924
diff
changeset
|
262 logger.debug("Start km: " + wqkms.getKm(0)); |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
924
diff
changeset
|
263 logger.debug("End km: " + wqkms.getKm(size-1)); |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
264 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
|
265 } |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
266 } |
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 for (int i = 0; i < size; i++) { |
925
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
924
diff
changeset
|
269 series.add(wqkms.getKm(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
|
270 } |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
271 |
923
7ca4a287cd0e
#135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
745
diff
changeset
|
272 addFirstAxisSeries(series); |
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
|
273 |
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
|
274 if (wqkms.guessWaterIncreasing()) { |
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
|
275 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
|
276 } |
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
|
277 } |
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 |
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 |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
280 /** |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
281 * 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
|
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 * @param wqkms An array of WQKms values. |
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
|
284 * @param theme The theme that contains styling information. |
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
|
285 */ |
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
|
286 protected void doQOut(WQKms wqkms, Document 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
|
287 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
|
288 |
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
|
289 XYSeries series = new StyledXYSeries(getSeriesName(wqkms, "Q"), 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
|
290 |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
706
diff
changeset
|
291 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
|
292 |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
293 if (logger.isDebugEnabled()) { |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
294 if (wqkms.size() > 0) { |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
295 logger.debug("Generate series: " + series.getKey()); |
925
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
924
diff
changeset
|
296 logger.debug("Start km: " + wqkms.getKm(0)); |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
924
diff
changeset
|
297 logger.debug("End km: " + wqkms.getKm(size-1)); |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
298 logger.debug("Values : " + size); |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
299 } |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
300 } |
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
|
301 |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
302 for (int i = 0; i < size; i++) { |
925
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
924
diff
changeset
|
303 series.add(wqkms.getKm(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
|
304 } |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
305 |
923
7ca4a287cd0e
#135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
745
diff
changeset
|
306 addSecondAxisSeries(series); |
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
|
307 |
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
|
308 if (wqkms.guessWaterIncreasing()) { |
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
|
309 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
|
310 } |
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 } |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
312 |
2ce7b473620e
Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
313 |
448
88d9e1d75d64
W and Q curves in longitudinal section curves will now have names.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
422
diff
changeset
|
314 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
|
315 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
|
316 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
|
317 |
88d9e1d75d64
W and Q curves in longitudinal section curves will now have names.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
422
diff
changeset
|
318 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
|
319 ? 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
|
320 : name; |
359
e5ea6a01526c
Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
321 } |
e5ea6a01526c
Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
322 } |
e5ea6a01526c
Added an OutGenerator for creating longitudinal section curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
323 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |