annotate flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java @ 1125:65d8b3340397

Cleanups of CrossSection*. flys-artifacts/trunk@2635 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 01 Sep 2011 13:00:36 +0000
parents 111794adf285
children bcba246d9c03
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
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
3 import org.apache.log4j.Logger;
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
4
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
5 import org.jfree.chart.JFreeChart;
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
6 import org.jfree.chart.axis.NumberAxis;
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
7 import org.jfree.chart.axis.ValueAxis;
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
8 import org.jfree.chart.plot.XYPlot;
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
9 import org.jfree.chart.title.TextTitle;
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
10 import org.jfree.data.Range;
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;
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
20
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
21 import de.intevation.flys.artifacts.model.FacetTypes;
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
22 import de.intevation.flys.artifacts.model.WQKms;
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
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
64 return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT);
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
65 }
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
66
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
67
1125
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
68 /**
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
69 * Add localized subtitle to chart.
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
70 */
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
71 @Override
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
72 protected void addSubtitles(JFreeChart chart) {
1125
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
73 double[] dist = getRange();
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
74
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
75 Object[] args = new Object[] {
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
76 getRiverName(),
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
77 dist[0],
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
78 dist[1]
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
79 };
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
80
1125
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
81 String subtitle = msg(I18N_CHART_SUBTITLE, "", args);
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
82 chart.addSubtitle(new TextTitle(subtitle));
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
83 }
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
84
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
85
1125
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
86 /**
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
87 * Get localized X Axis label.
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
88 */
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
89 protected String getXAxisLabel() {
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
90 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
91 }
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
92
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
93
1125
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
94 /**
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
95 * Get localized Y Axis label.
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
96 */
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
97 protected String getYAxisLabel() {
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
98 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
99 }
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
100
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
101
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
102 protected void adjustAxes(XYPlot plot) {
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
103 super.adjustAxes(plot);
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
104
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
105 NumberAxis qAxis = new NumberAxis(
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
106 msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT));
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
107
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
108 plot.setRangeAxis(1, qAxis);
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
109 }
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
110
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
112 /**
1125
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
113 * Overrides XYChartGenerators.zoomY() to include the 0 value on the Q axis.
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
114 */
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
115 @Override
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
116 protected boolean zoomY(XYPlot plot, ValueAxis axis, Range range, Range x) {
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
117 if (plot.getRangeAxisIndex(axis) == 1) {
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
118 // we want the Q axis to start at 0 if no zooming has been done
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
119 range = new Range(0d, range.getUpperBound());
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
120 }
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 return super.zoomY(plot, axis, range, x);
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
123 }
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
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
126 /**
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1113
diff changeset
127 * 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
128 */
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
129 public void doOut(Artifact artifact, Facet facet, Document attr) {
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
130 String name = facet.getName();
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 logger.debug("CrossSectionGenerator.doOut: " + name);
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
133
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
134 if (name == null) {
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
135 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
136 return;
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
137 }
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
138
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
139 FLYSArtifact flys = (FLYSArtifact) artifact;
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
140 Facet f = flys.getNativeFacet(facet);
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
141
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
142 if (f == null) {
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
143 return;
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
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
146 if (name.equals(CROSS_SECTION)) {
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
147 doCrossSectionOut(f.getData(artifact, context), attr);
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
148 }
1122
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
149 else if (name.equals(CROSS_SECTION_WATER_LINE)) {
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
150 doCrossSectionWaterLineOut(f.getData(artifact, context), attr);
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
151 }
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
152 else {
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
153 logger.warn("CrossSection.doOut: Unknown facet name: " + name);
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
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
158
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
159 /**
1122
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
160 * 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
161 *
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
162 * @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
163 */
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
164 protected void doCrossSectionWaterLineOut(Object o, Document theme) {
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
165 logger.debug("CrossSectionGenerator.doCrossSectionWaterLineOut");
1125
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
166 // TODO Series should get name like "Q=22.0"
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
167 XYSeries series = new StyledXYSeries("Q= ... ", theme);
1122
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
168
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
169 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
170 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
171 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
172 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
173 }
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
174 addFirstAxisSeries(series);
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
175 }
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
176
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
177
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
178 /**
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1113
diff changeset
179 * Do cross sections out.
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
180 *
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1113
diff changeset
181 * @param theme Theme for the data series.
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
182 */
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
183 protected void doCrossSectionOut(Object o, Document theme) {
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1113
diff changeset
184 logger.debug("CrossSectionGenerator.doCrossSectionOut");
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
185
1125
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
186 // TODO Series should get name of selected cross-section (e.g.
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
187 // "0-93.1(1990-2002).PRF") (exposed as getCrossSectionName in
65d8b3340397 Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
188 // WINFOArtifact)
1122
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
189 XYSeries series = new StyledXYSeries("aliquide", theme);
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
190
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1116
diff changeset
191 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
192 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
193 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
194 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
195 }
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1113
diff changeset
196 addFirstAxisSeries(series);
1111
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
197 }
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
198 }
b96ce07ba56c Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
199 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org