comparison artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightGenerator.java @ 6926:bf191baa37e7

issue1455: Prepare MiddleBedHeightDiagram to show Q values.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 27 Aug 2013 11:35:37 +0200
parents 1b35b2ddfc28
children 0288db5e90d5
comparison
equal deleted inserted replaced
6925:972ec1f6cf58 6926:bf191baa37e7
8 8
9 package org.dive4elements.river.exports; 9 package org.dive4elements.river.exports;
10 10
11 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; 11 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
12 import org.dive4elements.artifactdatabase.state.Facet; 12 import org.dive4elements.artifactdatabase.state.Facet;
13
13 import org.dive4elements.river.artifacts.D4EArtifact; 14 import org.dive4elements.river.artifacts.D4EArtifact;
14 import org.dive4elements.river.artifacts.model.FacetTypes; 15 import org.dive4elements.river.artifacts.model.FacetTypes;
15 import org.dive4elements.river.artifacts.model.MiddleBedHeightData; 16 import org.dive4elements.river.artifacts.model.MiddleBedHeightData;
17 import org.dive4elements.river.artifacts.model.WQKms;
18
16 import org.dive4elements.river.exports.process.BedheightProcessor; 19 import org.dive4elements.river.exports.process.BedheightProcessor;
17 import org.dive4elements.river.exports.process.Processor; 20 import org.dive4elements.river.exports.process.Processor;
18 import org.dive4elements.river.exports.process.WOutProcessor; 21 import org.dive4elements.river.exports.process.WOutProcessor;
19 import org.dive4elements.river.jfree.RiverAnnotation; 22 import org.dive4elements.river.jfree.RiverAnnotation;
20 import org.dive4elements.river.jfree.StyledXYSeries; 23 import org.dive4elements.river.jfree.StyledXYSeries;
33 public class MiddleBedHeightGenerator 36 public class MiddleBedHeightGenerator
34 extends XYChartGenerator 37 extends XYChartGenerator
35 implements FacetTypes 38 implements FacetTypes
36 { 39 {
37 public enum YAXIS { 40 public enum YAXIS {
38 H(0), W(1), P(2); 41 H(0), W(1), P(2), Q(3);
39 protected int idx; 42 protected int idx;
40 private YAXIS(int c) { 43 private YAXIS(int c) {
41 idx = c; 44 idx = c;
42 } 45 }
43 } 46 }
71 "chart.longitudinal.section.yaxis.label"; 74 "chart.longitudinal.section.yaxis.label";
72 public static final String I18N_W_YAXIS_LABEL_DEFAULT = "W [NN + m]"; 75 public static final String I18N_W_YAXIS_LABEL_DEFAULT = "W [NN + m]";
73 public static final String I18N_P_YAXIS_LABEL_DEFAULT = "Gepeilte Breite [m]"; 76 public static final String I18N_P_YAXIS_LABEL_DEFAULT = "Gepeilte Breite [m]";
74 public static final String I18N_P_YAXIS_LABEL = 77 public static final String I18N_P_YAXIS_LABEL =
75 "chart.bedheight_middle.sounding.yaxis.label"; 78 "chart.bedheight_middle.sounding.yaxis.label";
79 public static final String I18N_Q_YAXIS_LABEL_DEFAULT = "Q [m\u00b3/s]";
80 public static final String I18N_Q_YAXIS_LABEL =
81 "chart.longitudinal.section.yaxis.second.label";
76 82
77 @Override 83 @Override
78 protected YAxisWalker getYAxisWalker() { 84 protected YAxisWalker getYAxisWalker() {
79 return new YAxisWalker() { 85 return new YAxisWalker() {
80 @Override 86 @Override
136 I18N_W_YAXIS_LABEL_DEFAULT, 142 I18N_W_YAXIS_LABEL_DEFAULT,
137 new Object[] { unit }); 143 new Object[] { unit });
138 } 144 }
139 else if (index == YAXIS.P.idx) { 145 else if (index == YAXIS.P.idx) {
140 label = msg(I18N_P_YAXIS_LABEL, I18N_P_YAXIS_LABEL_DEFAULT); 146 label = msg(I18N_P_YAXIS_LABEL, I18N_P_YAXIS_LABEL_DEFAULT);
147 }
148 else if (index = YAXIS.Q.idx) {
149 label = msg(I18N_Q_YAXIS_LABEL, I18N_Q_YAXIS_LABEL_DEFAULT);
141 } 150 }
142 151
143 return label; 152 return label;
144 } 153 }
145 154
223 doAnnotations( 232 doAnnotations(
224 (RiverAnnotation) artifactAndFacet.getData(context), 233 (RiverAnnotation) artifactAndFacet.getData(context),
225 artifactAndFacet, 234 artifactAndFacet,
226 attr, 235 attr,
227 visible); 236 visible);
237 }
238 else if (name.equals(STATIC_WQKMS_Q)) {
239 doQOut(
240 (WQKms) artifactAndFacet.getData(context),
241 artifactAndFacet,
242 attr,
243 visible);
228 } 244 }
229 else if (bedp.canHandle(name)) { 245 else if (bedp.canHandle(name)) {
230 bedp.doOut(this, artifactAndFacet, attr, visible, YAXIS.P.idx); 246 bedp.doOut(this, artifactAndFacet, attr, visible, YAXIS.P.idx);
231 } 247 }
232 else if (woutp.canHandle(name)) { 248 else if (woutp.canHandle(name)) {
289 boolean visible 305 boolean visible
290 ) { 306 ) {
291 logger.debug("FlowVelocityGenerator.doArea"); 307 logger.debug("FlowVelocityGenerator.doArea");
292 logger.warn("TODO: Implement FlowVelocityGenerator.doArea"); 308 logger.warn("TODO: Implement FlowVelocityGenerator.doArea");
293 } 309 }
310
311
312 // TODO method borrowed from LongitudinalSectionGenerator.
313 // Extract in an Processor
314 /**
315 * Process the output for Q facets in a longitudinal section curve.
316 *
317 * @param wqkms An array of WQKms values.
318 * @param aandf The facet and artifact. This facet does NOT support any data objects. Use
319 * D4EArtifact.getNativeFacet() instead to retrieve a Facet which supports
320 * data.
321 * @param theme The theme that contains styling information.
322 * @param visible The visibility of the curve.
323 */
324 protected void doQOut(
325 WQKms wqkms,
326 ArtifactAndFacet aandf,
327 ThemeDocument theme,
328 boolean visible
329 ) {
330 logger.debug("MiddleBedHeightGenerator.doQOut");
331
332 XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
333
334 StyledSeriesBuilder.addStepPointsKmQ(series, wqkms);
335
336 addAxisSeries(series, YAXIS.Q.idx, visible);
337
338 /*
339 if (needInvertAxis(wqkms)) {
340 setInverted(true);
341 }
342 */
343 }
294 } 344 }
295 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 345 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org