Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDifferenceEpochGenerator.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 | 05eeedc5b156 |
children |
comparison
equal
deleted
inserted
replaced
5680:8cb8b03a423d | 5681:aa06e25528ae |
---|---|
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.FLYSArtifact; | 9 import de.intevation.flys.artifacts.FLYSArtifact; |
10 import de.intevation.flys.artifacts.access.FlowVelocityAccess; | 10 import de.intevation.flys.artifacts.access.FlowVelocityAccess; |
11 import de.intevation.flys.artifacts.model.FacetTypes; | 11 import de.intevation.flys.artifacts.model.FacetTypes; |
12 import de.intevation.flys.artifacts.model.WKms; | |
12 import de.intevation.flys.artifacts.model.minfo.BedDiffEpochResult; | 13 import de.intevation.flys.artifacts.model.minfo.BedDiffEpochResult; |
13 import de.intevation.flys.exports.StyledSeriesBuilder; | 14 import de.intevation.flys.exports.StyledSeriesBuilder; |
14 import de.intevation.flys.exports.fixings.FixChartGenerator; | 15 import de.intevation.flys.exports.fixings.FixChartGenerator; |
15 import de.intevation.flys.exports.process.KMIndexProcessor; | 16 import de.intevation.flys.exports.process.KMIndexProcessor; |
16 import de.intevation.flys.exports.process.Processor; | 17 import de.intevation.flys.exports.process.Processor; |
18 import de.intevation.flys.exports.process.WOutProcessor; | |
17 import de.intevation.flys.jfree.Bounds; | 19 import de.intevation.flys.jfree.Bounds; |
18 import de.intevation.flys.jfree.DoubleBounds; | 20 import de.intevation.flys.jfree.DoubleBounds; |
19 import de.intevation.flys.jfree.FLYSAnnotation; | 21 import de.intevation.flys.jfree.FLYSAnnotation; |
20 import de.intevation.flys.jfree.StyledXYSeries; | 22 import de.intevation.flys.jfree.StyledXYSeries; |
23 import de.intevation.flys.utils.DataUtil; | |
21 | 24 |
22 | 25 |
23 public class BedDifferenceEpochGenerator | 26 public class BedDifferenceEpochGenerator |
24 extends FixChartGenerator | 27 extends FixChartGenerator |
25 implements FacetTypes | 28 implements FacetTypes |
26 { | 29 { |
27 public enum YAXIS { | 30 public enum YAXIS { |
28 D(0), H(1), dW(2); | 31 D(0), H(1), dW(2), W(3); |
29 | 32 |
30 protected int idx; | 33 protected int idx; |
31 | 34 |
32 private YAXIS(int c) { | 35 private YAXIS(int c) { |
33 idx = c; | 36 idx = c; |
49 public static final String I18N_DW_YAXIS_LABEL_DEFAULT = | 52 public static final String I18N_DW_YAXIS_LABEL_DEFAULT = |
50 "delta W [cm]"; | 53 "delta W [cm]"; |
51 public static final String I18N_DW_YAXIS_LABEL = | 54 public static final String I18N_DW_YAXIS_LABEL = |
52 "chart.fixings.longitudinalsection.yaxis.label"; | 55 "chart.fixings.longitudinalsection.yaxis.label"; |
53 | 56 |
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]"; | |
60 | |
54 | 61 |
55 @Override | 62 @Override |
56 protected YAxisWalker getYAxisWalker() { | 63 protected YAxisWalker getYAxisWalker() { |
57 return new YAxisWalker() { | 64 return new YAxisWalker() { |
58 | 65 |
110 calculateZoom(b, getDomainAxisRange()); | 117 calculateZoom(b, getDomainAxisRange()); |
111 context.putContextValue("startkm", bounds.getLower()); | 118 context.putContextValue("startkm", bounds.getLower()); |
112 context.putContextValue("endkm", bounds.getUpper()); | 119 context.putContextValue("endkm", bounds.getUpper()); |
113 } | 120 } |
114 Processor processor = new KMIndexProcessor(); | 121 Processor processor = new KMIndexProcessor(); |
122 Processor woutp = new WOutProcessor(); | |
115 if (name.equals(BED_DIFFERENCE_EPOCH)) { | 123 if (name.equals(BED_DIFFERENCE_EPOCH)) { |
116 doBedDifferenceEpochOut( | 124 doBedDifferenceEpochOut( |
117 (BedDiffEpochResult) bundle.getData(context), | 125 (BedDiffEpochResult) bundle.getData(context), |
118 bundle, attr, visible); | 126 bundle, attr, visible); |
119 } | 127 } |
138 doBedDifferenceHeightsOut((BedDiffEpochResult)bundle.getData(context), | 146 doBedDifferenceHeightsOut((BedDiffEpochResult)bundle.getData(context), |
139 bundle, attr, visible, 1); | 147 bundle, attr, visible, 1); |
140 } | 148 } |
141 else if (processor.canHandle(name)) { | 149 else if (processor.canHandle(name)) { |
142 processor.doOut(this, bundle, attr, visible, YAXIS.dW.idx); | 150 processor.doOut(this, bundle, attr, visible, YAXIS.dW.idx); |
151 } | |
152 else if (woutp.canHandle(name)) { | |
153 woutp.doOut(this, bundle, attr, visible, YAXIS.W.idx); | |
154 } | |
155 else if (name.equals(W_DIFFERENCES)) { | |
156 doWDifferencesOut( | |
157 (WKms) bundle.getData(context), | |
158 bundle, | |
159 attr, | |
160 visible); | |
143 } | 161 } |
144 else if (name.equals(LONGITUDINAL_ANNOTATION)) { | 162 else if (name.equals(LONGITUDINAL_ANNOTATION)) { |
145 doAnnotations( | 163 doAnnotations( |
146 (FLYSAnnotation) bundle.getData(context), | 164 (FLYSAnnotation) bundle.getData(context), |
147 bundle, | 165 bundle, |
173 label = msg(I18N_SECOND_YAXIS_LABEL, I18N_SECOND_YAXIS_LABEL_DEFAULT); | 191 label = msg(I18N_SECOND_YAXIS_LABEL, I18N_SECOND_YAXIS_LABEL_DEFAULT); |
174 } | 192 } |
175 else if (pos == YAXIS.dW.idx) { | 193 else if (pos == YAXIS.dW.idx) { |
176 return msg(I18N_DW_YAXIS_LABEL, I18N_DW_YAXIS_LABEL_DEFAULT); | 194 return msg(I18N_DW_YAXIS_LABEL, I18N_DW_YAXIS_LABEL_DEFAULT); |
177 } | 195 } |
178 | 196 else if (pos == YAXIS.W.idx) { |
197 return msg(I18N_W_YAXIS_LABEL, I18N_W_YAXIS_LABEL_DEFAULT); | |
198 } | |
179 return label; | 199 return label; |
180 } | 200 } |
181 | 201 |
182 protected void doBedDifferenceEpochOut(BedDiffEpochResult data, | 202 protected void doBedDifferenceEpochOut(BedDiffEpochResult data, |
183 ArtifactAndFacet aandf, Document theme, boolean visible) { | 203 ArtifactAndFacet aandf, Document theme, boolean visible) { |
204 StyledSeriesBuilder.addPoints(series, data.getHeights2Data(), true); | 224 StyledSeriesBuilder.addPoints(series, data.getHeights2Data(), true); |
205 } | 225 } |
206 | 226 |
207 addAxisSeries(series, YAXIS.H.idx, visible); | 227 addAxisSeries(series, YAXIS.H.idx, visible); |
208 } | 228 } |
229 | |
230 protected void doWDifferencesOut( | |
231 WKms wkms, | |
232 ArtifactAndFacet aandf, | |
233 Document theme, | |
234 boolean visible | |
235 ) { | |
236 if (wkms == null) { | |
237 logger.warn("No data to add to WDifferencesChart."); | |
238 return; | |
239 } | |
240 | |
241 XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); | |
242 StyledSeriesBuilder.addPoints(series, wkms); | |
243 | |
244 addAxisSeries(series, YAXIS.D.idx, visible); | |
245 if (DataUtil.guessWaterIncreasing(wkms.allWs())) { | |
246 setInverted(true); | |
247 } | |
248 } | |
209 } | 249 } |