annotate flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java @ 1690:0053a4529f2f

Bugfix: #220 Made y-axes of longitudinal and crosssection charts look equal. flys-artifacts/trunk@2912 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 10 Oct 2011 07:31:23 +0000
parents bdb05dc9b763
children 2a6baa9e1576
rev   line source
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.exports;
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
2
1690
0053a4529f2f Bugfix: #220 Made y-axes of longitudinal and crosssection charts look equal.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
3 import java.awt.Font;
0053a4529f2f Bugfix: #220 Made y-axes of longitudinal and crosssection charts look equal.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
4
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
5 import org.apache.log4j.Logger;
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
6
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
7 import org.jfree.chart.JFreeChart;
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
8 import org.jfree.chart.axis.NumberAxis;
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
9 import org.jfree.chart.plot.XYPlot;
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
10 import org.jfree.chart.title.TextTitle;
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1113
diff changeset
11 import org.jfree.data.xy.XYSeries;
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
12
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
13 import org.w3c.dom.Document;
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
14
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
15 import de.intevation.artifacts.Artifact;
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
16
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
17 import de.intevation.artifactdatabase.state.Facet;
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
18
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
19 import de.intevation.flys.artifacts.FLYSArtifact;
1141
bcba246d9c03 Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1125
diff changeset
20 import de.intevation.flys.artifacts.WINFOArtifact;
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
21
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
22 import de.intevation.flys.artifacts.model.FacetTypes;
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
23
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
24
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
25 /**
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
26 * An OutGenerator that generates cross section graphs.
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
27 */
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
28 public class CrossSectionGenerator
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
29 extends XYChartGenerator
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
30 implements FacetTypes
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
31 {
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
32 /** The logger that is used in this generator. */
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
33 private static Logger logger =
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
34 Logger.getLogger(CrossSectionGenerator.class);
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
35
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
36 public static final String I18N_CHART_TITLE =
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
37 "chart.cross_section.title";
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
38
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
39 public static final String I18N_CHART_SUBTITLE =
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
40 "chart.cross_section.subtitle";
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
41
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
42 public static final String I18N_XAXIS_LABEL =
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
43 "chart.cross_section.xaxis.label";
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
44
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
45 public static final String I18N_YAXIS_LABEL =
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
46 "chart.cross_section.yaxis.label";
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
47
1125
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
48 public static final String I18N_CHART_TITLE_DEFAULT = "Querprofildiagramm";
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
49 public static final String I18N_XAXIS_LABEL_DEFAULT = "Abstand [m]";
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
50 public static final String I18N_YAXIS_LABEL_DEFAULT = "W [NN + m]";
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
51
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
52
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
53 /** Trivial Constructor. */
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
54 public CrossSectionGenerator() {
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
55 super();
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
56 }
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
57
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
58
1125
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
59 /**
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
60 * Get localized chart title.
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
61 */
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
62 protected String getChartTitle() {
1125
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
63 // TODO get river etc for localized heading
1141
bcba246d9c03 Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1125
diff changeset
64 Object[] i18n_msg_args = new Object[] {
bcba246d9c03 Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1125
diff changeset
65 getRiverName()
bcba246d9c03 Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1125
diff changeset
66 };
bcba246d9c03 Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1125
diff changeset
67 return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT, i18n_msg_args);
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
68 }
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
69
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
70
1125
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
71 /**
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
72 * Add localized subtitle to chart.
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
73 */
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
74 @Override
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
75 protected void addSubtitles(JFreeChart chart) {
1125
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
76 double[] dist = getRange();
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
77
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
78 Object[] args = new Object[] {
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
79 getRiverName(),
1141
bcba246d9c03 Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1125
diff changeset
80 getKm()
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
81 };
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
82
1125
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
83 String subtitle = msg(I18N_CHART_SUBTITLE, "", args);
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
84 chart.addSubtitle(new TextTitle(subtitle));
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
85 }
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
86
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
87
1125
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
88 /**
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
89 * Get localized X Axis label.
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
90 */
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
91 protected String getXAxisLabel() {
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
92 return msg(I18N_XAXIS_LABEL, I18N_XAXIS_LABEL_DEFAULT);
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
93 }
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
94
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
95
1125
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
96 /**
1141
bcba246d9c03 Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1125
diff changeset
97 * Get cross_section.km data from artifact.
bcba246d9c03 Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1125
diff changeset
98 */
bcba246d9c03 Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1125
diff changeset
99 protected Double getKm() {
bcba246d9c03 Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1125
diff changeset
100 try {
bcba246d9c03 Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1125
diff changeset
101 WINFOArtifact winfo = (WINFOArtifact) master;
1142
01d42a2454f6 Display real km of shown data in crosssection-diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1141
diff changeset
102 return winfo.getCrossSectionSnapKm();
1141
bcba246d9c03 Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1125
diff changeset
103 }
bcba246d9c03 Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1125
diff changeset
104 catch (Exception e) {
bcba246d9c03 Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1125
diff changeset
105 logger.error("Cannot convert cross_section.km to double");
bcba246d9c03 Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1125
diff changeset
106 return 0.0d;
bcba246d9c03 Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1125
diff changeset
107 }
bcba246d9c03 Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1125
diff changeset
108 }
bcba246d9c03 Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1125
diff changeset
109
bcba246d9c03 Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1125
diff changeset
110
bcba246d9c03 Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1125
diff changeset
111 /**
1125
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
112 * Get localized Y Axis label.
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
113 */
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
114 protected String getYAxisLabel() {
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
115 return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT);
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
116 }
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
117
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
118
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
119 protected void adjustAxes(XYPlot plot) {
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
120 super.adjustAxes(plot);
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
121
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
122 NumberAxis qAxis = new NumberAxis(
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
123 msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT));
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
124
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
125 plot.setRangeAxis(1, qAxis);
1690
0053a4529f2f Bugfix: #220 Made y-axes of longitudinal and crosssection charts look equal.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
126
0053a4529f2f Bugfix: #220 Made y-axes of longitudinal and crosssection charts look equal.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
127 Font font = plot.getRangeAxis(0).getLabelFont();
0053a4529f2f Bugfix: #220 Made y-axes of longitudinal and crosssection charts look equal.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
128 qAxis.setLabelFont(font);
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
129 }
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
130
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
131
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
132 /**
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1113
diff changeset
133 * Let one facet do its job.
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1113
diff changeset
134 */
1684
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1158
diff changeset
135 public void doOut(
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1158
diff changeset
136 Artifact artifact,
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1158
diff changeset
137 Facet facet,
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1158
diff changeset
138 Document attr,
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1158
diff changeset
139 boolean visible
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1158
diff changeset
140 ) {
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
141 String name = facet.getName();
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
142
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
143 logger.debug("CrossSectionGenerator.doOut: " + name);
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
144
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
145 if (name == null) {
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
146 logger.error("No facet name for doOut(). No output generated!");
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
147 return;
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
148 }
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
149
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
150 FLYSArtifact flys = (FLYSArtifact) artifact;
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
151 Facet f = flys.getNativeFacet(facet);
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
152
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
153 if (f == null) {
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
154 return;
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
155 }
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
156
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
157 if (name.equals(CROSS_SECTION)) {
1684
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1158
diff changeset
158 doCrossSectionOut(
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1158
diff changeset
159 f.getData(artifact, context),
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1158
diff changeset
160 f.getDescription(),
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1158
diff changeset
161 attr,
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1158
diff changeset
162 visible);
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
163 }
1122
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
164 else if (name.equals(CROSS_SECTION_WATER_LINE)) {
1684
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1158
diff changeset
165 doCrossSectionWaterLineOut(
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1158
diff changeset
166 f.getData(artifact, context),
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1158
diff changeset
167 f.getDescription(),
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1158
diff changeset
168 attr,
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1158
diff changeset
169 visible);
1122
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
170 }
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
171 else {
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
172 logger.warn("CrossSection.doOut: Unknown facet name: " + name);
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
173 return;
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
174 }
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
175 }
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
176
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
177
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
178 /**
1122
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
179 * Do cross sections waterline out.
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
180 *
1141
bcba246d9c03 Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1125
diff changeset
181 * @param seriesName name of the data (line) to display in legend.
1122
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
182 * @param theme Theme for the data series.
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
183 */
1684
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1158
diff changeset
184 protected void doCrossSectionWaterLineOut(
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1158
diff changeset
185 Object o,
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1158
diff changeset
186 String seriesName,
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1158
diff changeset
187 Document theme,
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1158
diff changeset
188 boolean visible
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1158
diff changeset
189 ) {
1122
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
190 logger.debug("CrossSectionGenerator.doCrossSectionWaterLineOut");
1141
bcba246d9c03 Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1125
diff changeset
191
bcba246d9c03 Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1125
diff changeset
192 XYSeries series = new StyledXYSeries(seriesName, theme);
1122
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
193
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
194 double[][] a = (double [][]) o;
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
195 double [] pxs = a[0];
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
196 for (int i = 0; i < pxs.length; i++) {
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
197 series.add (a[0][i], a[1][i]);
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
198 }
1684
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1158
diff changeset
199 addFirstAxisSeries(series, visible);
1122
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
200 }
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
201
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
202
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
203 /**
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1113
diff changeset
204 * Do cross sections out.
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
205 *
1141
bcba246d9c03 Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1125
diff changeset
206 * @param seriesName name of the data (line) to display in legend.
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1113
diff changeset
207 * @param theme Theme for the data series.
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
208 */
1684
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1158
diff changeset
209 protected void doCrossSectionOut(
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1158
diff changeset
210 Object o,
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1158
diff changeset
211 String seriesName,
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1158
diff changeset
212 Document theme,
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1158
diff changeset
213 boolean visible
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1158
diff changeset
214 ) {
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1113
diff changeset
215 logger.debug("CrossSectionGenerator.doCrossSectionOut");
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
216
1141
bcba246d9c03 Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1125
diff changeset
217 XYSeries series = new StyledXYSeries(seriesName, theme);
1122
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
218
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
219 double[][] a = (double [][]) o;
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
220 double [] pxs = a[0];
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
221 for (int i = 0; i < pxs.length; i++) {
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
222 series.add (a[0][i], a[1][i]);
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
223 }
1684
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1158
diff changeset
224 addFirstAxisSeries(series, visible);
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
225 }
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
226 }
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
227 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org