Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDifferenceYearGenerator.java @ 5681:aa06e25528ae
Added processor for new factes in bed difference chart generators.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Fri, 12 Apr 2013 14:50:18 +0200 |
parents | b195fede1c3b |
children | a6dc4c232da2 |
comparison
equal
deleted
inserted
replaced
5680:8cb8b03a423d | 5681:aa06e25528ae |
---|---|
5 import org.w3c.dom.Document; | 5 import org.w3c.dom.Document; |
6 | 6 |
7 import de.intevation.artifactdatabase.state.ArtifactAndFacet; | 7 import de.intevation.artifactdatabase.state.ArtifactAndFacet; |
8 import de.intevation.artifactdatabase.state.Facet; | 8 import de.intevation.artifactdatabase.state.Facet; |
9 import de.intevation.flys.artifacts.model.FacetTypes; | 9 import de.intevation.flys.artifacts.model.FacetTypes; |
10 import de.intevation.flys.artifacts.model.WKms; | |
10 import de.intevation.flys.artifacts.model.minfo.BedDiffYearResult; | 11 import de.intevation.flys.artifacts.model.minfo.BedDiffYearResult; |
11 import de.intevation.flys.artifacts.model.minfo.BedDifferencesResult; | 12 import de.intevation.flys.artifacts.model.minfo.BedDifferencesResult; |
12 import de.intevation.flys.exports.StyledSeriesBuilder; | 13 import de.intevation.flys.exports.StyledSeriesBuilder; |
13 import de.intevation.flys.exports.fixings.FixChartGenerator; | 14 import de.intevation.flys.exports.fixings.FixChartGenerator; |
14 import de.intevation.flys.exports.process.KMIndexProcessor; | 15 import de.intevation.flys.exports.process.KMIndexProcessor; |
15 import de.intevation.flys.exports.process.Processor; | 16 import de.intevation.flys.exports.process.Processor; |
17 import de.intevation.flys.exports.process.WOutProcessor; | |
16 import de.intevation.flys.jfree.Bounds; | 18 import de.intevation.flys.jfree.Bounds; |
17 import de.intevation.flys.jfree.DoubleBounds; | 19 import de.intevation.flys.jfree.DoubleBounds; |
18 import de.intevation.flys.jfree.FLYSAnnotation; | 20 import de.intevation.flys.jfree.FLYSAnnotation; |
19 import de.intevation.flys.jfree.StyledXYSeries; | 21 import de.intevation.flys.jfree.StyledXYSeries; |
22 import de.intevation.flys.utils.DataUtil; | |
20 | 23 |
21 | 24 |
22 public class BedDifferenceYearGenerator | 25 public class BedDifferenceYearGenerator |
23 extends FixChartGenerator | 26 extends FixChartGenerator |
24 implements FacetTypes | 27 implements FacetTypes |
25 { | 28 { |
26 public enum YAXIS { | 29 public enum YAXIS { |
27 D(0), M(1), H(2), dW(3); | 30 D(0), M(1), H(2), dW(3), W(4); |
28 | 31 |
29 protected int idx; | 32 protected int idx; |
30 | 33 |
31 private YAXIS(int c) { | 34 private YAXIS(int c) { |
32 idx = c; | 35 idx = c; |
49 public static final String I18N_THIRD_YAXIS_LABEL_DEFAULT = "Höhe [m]"; | 52 public static final String I18N_THIRD_YAXIS_LABEL_DEFAULT = "Höhe [m]"; |
50 public static final String I18N_DW_YAXIS_LABEL_DEFAULT = | 53 public static final String I18N_DW_YAXIS_LABEL_DEFAULT = |
51 "delta W [cm]"; | 54 "delta W [cm]"; |
52 public static final String I18N_DW_YAXIS_LABEL = | 55 public static final String I18N_DW_YAXIS_LABEL = |
53 "chart.fixings.longitudinalsection.yaxis.label"; | 56 "chart.fixings.longitudinalsection.yaxis.label"; |
57 private static final String I18N_W_YAXIS_LABEL = | |
58 "chart.longitudinal.section.yaxis.label"; | |
59 private static final String I18N_W_YAXIS_LABEL_DEFAULT = "W [NN + m]"; | |
54 | 60 |
55 @Override | 61 @Override |
56 protected YAxisWalker getYAxisWalker() { | 62 protected YAxisWalker getYAxisWalker() { |
57 return new YAxisWalker() { | 63 return new YAxisWalker() { |
58 | 64 |
108 calculateZoom(b, getDomainAxisRange()); | 114 calculateZoom(b, getDomainAxisRange()); |
109 context.putContextValue("startkm", bounds.getLower()); | 115 context.putContextValue("startkm", bounds.getLower()); |
110 context.putContextValue("endkm", bounds.getUpper()); | 116 context.putContextValue("endkm", bounds.getUpper()); |
111 } | 117 } |
112 Processor processor = new KMIndexProcessor(); | 118 Processor processor = new KMIndexProcessor(); |
119 Processor woutp = new WOutProcessor(); | |
113 if (name.equals(BED_DIFFERENCE_YEAR)) { | 120 if (name.equals(BED_DIFFERENCE_YEAR)) { |
114 doBedDifferenceYearOut( | 121 doBedDifferenceYearOut( |
115 (BedDiffYearResult) bundle.getData(context), | 122 (BedDiffYearResult) bundle.getData(context), |
116 bundle, attr, visible); | 123 bundle, attr, visible); |
117 } | 124 } |
153 (FLYSAnnotation) bundle.getData(context), | 160 (FLYSAnnotation) bundle.getData(context), |
154 bundle, | 161 bundle, |
155 attr, | 162 attr, |
156 visible); | 163 visible); |
157 } | 164 } |
158 else if (processor.canHandle(name)) { | 165 else if (woutp.canHandle(name)) { |
159 processor.doOut(this, bundle, attr, visible, YAXIS.dW.idx); | 166 woutp.doOut(this, bundle, attr, visible, YAXIS.W.idx); |
167 } | |
168 else if (name.equals(W_DIFFERENCES)) { | |
169 doWDifferencesOut( | |
170 (WKms) bundle.getData(context), | |
171 bundle, | |
172 attr, | |
173 visible); | |
160 } | 174 } |
161 else { | 175 else { |
162 logger.warn("Unknown facet name " + name); | 176 logger.warn("Unknown facet name " + name); |
163 } | 177 } |
164 } | 178 } |
205 label = msg(I18N_THIRD_YAXIS_LABEL, I18N_THIRD_YAXIS_LABEL_DEFAULT); | 219 label = msg(I18N_THIRD_YAXIS_LABEL, I18N_THIRD_YAXIS_LABEL_DEFAULT); |
206 } | 220 } |
207 else if (pos == YAXIS.dW.idx) { | 221 else if (pos == YAXIS.dW.idx) { |
208 label = msg(I18N_DW_YAXIS_LABEL, I18N_DW_YAXIS_LABEL_DEFAULT); | 222 label = msg(I18N_DW_YAXIS_LABEL, I18N_DW_YAXIS_LABEL_DEFAULT); |
209 } | 223 } |
224 else if (pos == YAXIS.W.idx) { | |
225 return msg(I18N_W_YAXIS_LABEL, I18N_W_YAXIS_LABEL_DEFAULT); | |
226 } | |
227 | |
210 return label; | 228 return label; |
211 } | 229 } |
212 | 230 |
213 protected void doBedDifferenceYearOut(BedDiffYearResult data, | 231 protected void doBedDifferenceYearOut(BedDiffYearResult data, |
214 ArtifactAndFacet aandf, Document theme, boolean visible) { | 232 ArtifactAndFacet aandf, Document theme, boolean visible) { |
227 XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); | 245 XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); |
228 StyledSeriesBuilder.addPoints(series, data.getMorphWidthData(), true); | 246 StyledSeriesBuilder.addPoints(series, data.getMorphWidthData(), true); |
229 | 247 |
230 addAxisSeries(series, YAXIS.M.idx, visible); | 248 addAxisSeries(series, YAXIS.M.idx, visible); |
231 } | 249 } |
250 | |
251 protected void doWDifferencesOut( | |
252 WKms wkms, | |
253 ArtifactAndFacet aandf, | |
254 Document theme, | |
255 boolean visible | |
256 ) { | |
257 if (wkms == null) { | |
258 logger.warn("No data to add to WDifferencesChart."); | |
259 return; | |
260 } | |
261 | |
262 XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); | |
263 StyledSeriesBuilder.addPoints(series, wkms); | |
264 | |
265 addAxisSeries(series, YAXIS.D.idx, visible); | |
266 if (DataUtil.guessWaterIncreasing(wkms.allWs())) { | |
267 setInverted(true); | |
268 } | |
269 } | |
232 } | 270 } |