Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java @ 1989:156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
flys-artifacts/trunk@3423 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 15 Dec 2011 12:05:06 +0000 |
parents | b30e1710df1d |
children | 5aecebcc4698 |
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.title.TextTitle; |
1116
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1113
diff
changeset
|
7 import org.jfree.data.xy.XYSeries; |
1111
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
9 import org.w3c.dom.Document; |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 |
1944
21a4d2c677a1
Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1931
diff
changeset
|
11 import de.intevation.artifactdatabase.state.ArtifactAndFacet; |
1111
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
12 |
1141
bcba246d9c03
Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1125
diff
changeset
|
13 import de.intevation.flys.artifacts.WINFOArtifact; |
1111
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.flys.artifacts.model.FacetTypes; |
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 |
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 * An OutGenerator that generates cross section graphs. |
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 public class CrossSectionGenerator |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
22 extends XYChartGenerator |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
23 implements FacetTypes |
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 /** The logger that is used in this generator. */ |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
26 private static Logger logger = |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
27 Logger.getLogger(CrossSectionGenerator.class); |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
28 |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
29 public static final String I18N_CHART_TITLE = |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
30 "chart.cross_section.title"; |
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 public static final String I18N_CHART_SUBTITLE = |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
33 "chart.cross_section.subtitle"; |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
34 |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
35 public static final String I18N_XAXIS_LABEL = |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
36 "chart.cross_section.xaxis.label"; |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
37 |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
38 public static final String I18N_YAXIS_LABEL = |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
39 "chart.cross_section.yaxis.label"; |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
40 |
1125
65d8b3340397
Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1122
diff
changeset
|
41 public static final String I18N_CHART_TITLE_DEFAULT = "Querprofildiagramm"; |
65d8b3340397
Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1122
diff
changeset
|
42 public static final String I18N_XAXIS_LABEL_DEFAULT = "Abstand [m]"; |
65d8b3340397
Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1122
diff
changeset
|
43 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
|
44 |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
45 |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 /** Trivial Constructor. */ |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
47 public CrossSectionGenerator() { |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 super(); |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
49 } |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
50 |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
51 |
1125
65d8b3340397
Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1122
diff
changeset
|
52 /** |
65d8b3340397
Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1122
diff
changeset
|
53 * Get localized chart title. |
65d8b3340397
Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1122
diff
changeset
|
54 */ |
1111
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
55 protected String getChartTitle() { |
1125
65d8b3340397
Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1122
diff
changeset
|
56 // 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
|
57 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
|
58 getRiverName() |
bcba246d9c03
Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1125
diff
changeset
|
59 }; |
bcba246d9c03
Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1125
diff
changeset
|
60 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
|
61 } |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
62 |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
63 |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
64 @Override |
1989
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1975
diff
changeset
|
65 protected String getChartSubtitle() { |
1125
65d8b3340397
Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1122
diff
changeset
|
66 double[] dist = getRange(); |
1111
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
67 |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
68 Object[] args = new Object[] { |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
69 getRiverName(), |
1141
bcba246d9c03
Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1125
diff
changeset
|
70 getKm() |
1111
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
71 }; |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
72 |
1989
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1975
diff
changeset
|
73 return msg(I18N_CHART_SUBTITLE, "", args); |
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1975
diff
changeset
|
74 } |
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1975
diff
changeset
|
75 |
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1975
diff
changeset
|
76 |
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1975
diff
changeset
|
77 /** |
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1975
diff
changeset
|
78 * Add localized subtitle to chart. |
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1975
diff
changeset
|
79 */ |
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1975
diff
changeset
|
80 @Override |
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1975
diff
changeset
|
81 protected void addSubtitles(JFreeChart chart) { |
156304542edf
Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1975
diff
changeset
|
82 String subtitle = getChartSubtitle(); |
1111
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
83 chart.addSubtitle(new TextTitle(subtitle)); |
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 |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
86 |
1125
65d8b3340397
Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1122
diff
changeset
|
87 /** |
65d8b3340397
Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1122
diff
changeset
|
88 * Get localized X Axis label. |
65d8b3340397
Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1122
diff
changeset
|
89 */ |
1111
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
90 protected String getXAxisLabel() { |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
91 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
|
92 } |
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 |
1125
65d8b3340397
Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1122
diff
changeset
|
95 /** |
1141
bcba246d9c03
Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1125
diff
changeset
|
96 * 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
|
97 */ |
bcba246d9c03
Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1125
diff
changeset
|
98 protected Double getKm() { |
bcba246d9c03
Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1125
diff
changeset
|
99 try { |
bcba246d9c03
Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1125
diff
changeset
|
100 WINFOArtifact winfo = (WINFOArtifact) master; |
1975
b30e1710df1d
Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1948
diff
changeset
|
101 // TODO get km of "master cross section." |
b30e1710df1d
Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1948
diff
changeset
|
102 //return winfo.getCrossSectionSnapKm(0); |
b30e1710df1d
Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1948
diff
changeset
|
103 return 0.0d; |
1141
bcba246d9c03
Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1125
diff
changeset
|
104 } |
bcba246d9c03
Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1125
diff
changeset
|
105 catch (Exception e) { |
bcba246d9c03
Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1125
diff
changeset
|
106 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
|
107 return 0.0d; |
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 |
bcba246d9c03
Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1125
diff
changeset
|
112 /** |
1125
65d8b3340397
Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1122
diff
changeset
|
113 * Get localized Y Axis label. |
65d8b3340397
Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1122
diff
changeset
|
114 */ |
1111
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
115 protected String getYAxisLabel() { |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
116 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
|
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 |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
120 /** |
1116
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1113
diff
changeset
|
121 * 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
|
122 */ |
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
|
123 public void doOut( |
1944
21a4d2c677a1
Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1931
diff
changeset
|
124 ArtifactAndFacet artifactFacet, |
21a4d2c677a1
Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1931
diff
changeset
|
125 Document attr, |
21a4d2c677a1
Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1931
diff
changeset
|
126 boolean visible |
1684
bdb05dc9b763
Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1158
diff
changeset
|
127 ) { |
1944
21a4d2c677a1
Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1931
diff
changeset
|
128 String name = artifactFacet.getFacetName(); |
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 logger.debug("CrossSectionGenerator.doOut: " + name); |
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 if (name == null) { |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
133 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
|
134 return; |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
135 } |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
136 |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
137 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
|
138 doCrossSectionOut( |
1944
21a4d2c677a1
Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1931
diff
changeset
|
139 artifactFacet.getData(context), |
21a4d2c677a1
Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1931
diff
changeset
|
140 artifactFacet.getFacetDescription(), |
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
|
141 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
|
142 visible); |
1111
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
143 } |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
144 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
|
145 doCrossSectionWaterLineOut( |
1944
21a4d2c677a1
Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1931
diff
changeset
|
146 artifactFacet.getData(context), |
21a4d2c677a1
Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1931
diff
changeset
|
147 artifactFacet.getFacetDescription(), |
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
|
148 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
|
149 visible); |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
150 } |
1111
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
151 else { |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
152 logger.warn("CrossSection.doOut: Unknown facet name: " + name); |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
153 return; |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
154 } |
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 /** |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
159 * 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
|
160 * |
1141
bcba246d9c03
Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1125
diff
changeset
|
161 * @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
|
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 */ |
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
|
164 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
|
165 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
|
166 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
|
167 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
|
168 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
|
169 ) { |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
170 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
|
171 |
1741
1bc926b5b435
Fix for flys/issue316
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1697
diff
changeset
|
172 // DO NOT SORT DATA! This destroys the gaps indicated by NaNs |
1bc926b5b435
Fix for flys/issue316
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1697
diff
changeset
|
173 XYSeries series = new StyledXYSeries(seriesName, false, theme); |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
174 |
1791
e0e5a5b51a40
Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1741
diff
changeset
|
175 StyledSeriesBuilder.addPoints(series, (double [][]) o); |
e0e5a5b51a40
Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1741
diff
changeset
|
176 |
1931
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1791
diff
changeset
|
177 addAxisSeries(series, 0, visible); |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
178 } |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
179 |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
180 |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
181 /** |
1116
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1113
diff
changeset
|
182 * Do cross sections out. |
1111
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
183 * |
1141
bcba246d9c03
Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1125
diff
changeset
|
184 * @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
|
185 * @param theme Theme for the data series. |
1111
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
186 */ |
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
|
187 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
|
188 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
|
189 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
|
190 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
|
191 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
|
192 ) { |
1116
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1113
diff
changeset
|
193 logger.debug("CrossSectionGenerator.doCrossSectionOut"); |
1111
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
194 |
1141
bcba246d9c03
Fix various issues like i18n in cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1125
diff
changeset
|
195 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
|
196 |
1791
e0e5a5b51a40
Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1741
diff
changeset
|
197 StyledSeriesBuilder.addPoints(series, (double [][]) o); |
e0e5a5b51a40
Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1741
diff
changeset
|
198 |
1931
7c52e9cb2a72
Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1791
diff
changeset
|
199 addAxisSeries(series, 0, visible); |
1111
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
200 } |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
201 } |
b96ce07ba56c
Added dummy sceleton for Cross Sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
202 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |