Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/FlowVelocityGenerator.java @ 4468:2e8638567c49
FlowVelocityGenerator: Handle new discharge curves at new third axis.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 09 Nov 2012 12:09:23 +0100 |
parents | b66285ece774 |
children | 5b551e3a58d5 |
comparison
equal
deleted
inserted
replaced
4467:10e7bd292c47 | 4468:2e8638567c49 |
---|---|
30 extends XYChartGenerator | 30 extends XYChartGenerator |
31 implements FacetTypes | 31 implements FacetTypes |
32 { | 32 { |
33 public enum YAXIS { | 33 public enum YAXIS { |
34 V(0), | 34 V(0), |
35 T(1); | 35 T(1), |
36 Q(2); | |
36 /* TODO Q and Density will come as 4th and 3rd axis. */ | 37 /* TODO Q and Density will come as 4th and 3rd axis. */ |
37 protected int idx; | 38 protected int idx; |
38 private YAXIS(int c) { | 39 private YAXIS(int c) { |
39 idx = c; | 40 idx = c; |
40 } | 41 } |
75 "chart.flow_velocity.section.yaxis.label"; | 76 "chart.flow_velocity.section.yaxis.label"; |
76 | 77 |
77 public static final String I18N_2YAXIS_LABEL = | 78 public static final String I18N_2YAXIS_LABEL = |
78 "chart.flow_velocity.section.yaxis.second.label"; | 79 "chart.flow_velocity.section.yaxis.second.label"; |
79 | 80 |
81 public static final String I18N_3YAXIS_LABEL = | |
82 "chart.flow_velocity.section.yaxis.third.label"; | |
83 | |
80 public static final String I18N_CHART_TITLE_DEFAULT = "Geschwindigkeit- und Schubspannung"; | 84 public static final String I18N_CHART_TITLE_DEFAULT = "Geschwindigkeit- und Schubspannung"; |
81 public static final String I18N_XAXIS_LABEL_DEFAULT = "km"; | 85 public static final String I18N_XAXIS_LABEL_DEFAULT = "km"; |
82 public static final String I18N_YAXIS_LABEL_DEFAULT = "Geschwindigkeit v [m/s]"; | 86 public static final String I18N_YAXIS_LABEL_DEFAULT = "Geschwindigkeit v [m/s]"; |
83 public static final String I18N_2YAXIS_LABEL_DEFAULT = "Schubspannung Tau [N]"; | 87 public static final String I18N_2YAXIS_LABEL_DEFAULT = "Schubspannung Tau [N]"; |
88 public static final String I18N_3YAXIS_LABEL_DEFAULT = "Q [m³/s]"; | |
84 | 89 |
85 | 90 |
86 @Override | 91 @Override |
87 protected YAxisWalker getYAxisWalker() { | 92 protected YAxisWalker getYAxisWalker() { |
88 return new YAxisWalker() { | 93 return new YAxisWalker() { |
137 label = getVAxisLabel(); | 142 label = getVAxisLabel(); |
138 } | 143 } |
139 else if (index == YAXIS.T.idx) { | 144 else if (index == YAXIS.T.idx) { |
140 label = getTAxisLabel(); | 145 label = getTAxisLabel(); |
141 } | 146 } |
147 else if (index == YAXIS.Q.idx) { | |
148 label = getQAxisLabel(); | |
149 } | |
142 | 150 |
143 return label; | 151 return label; |
144 } | 152 } |
145 | 153 |
146 | 154 |
149 */ | 157 */ |
150 protected String getVAxisLabel() { | 158 protected String getVAxisLabel() { |
151 return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT); | 159 return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT); |
152 } | 160 } |
153 | 161 |
162 | |
163 /** | |
164 * Get internationalized label for the y axis. | |
165 */ | |
166 protected String getQAxisLabel() { | |
167 return msg(I18N_3YAXIS_LABEL, I18N_3YAXIS_LABEL_DEFAULT); | |
168 } | |
154 | 169 |
155 /** | 170 /** |
156 * Get internationalized label for the y axis. | 171 * Get internationalized label for the y axis. |
157 */ | 172 */ |
158 protected String getTAxisLabel() { | 173 protected String getTAxisLabel() { |
193 attr, | 208 attr, |
194 visible); | 209 visible); |
195 } | 210 } |
196 else if (name.equals(FLOW_VELOCITY_TOTALCHANNEL)) { | 211 else if (name.equals(FLOW_VELOCITY_TOTALCHANNEL)) { |
197 doTotalChannelOut( | 212 doTotalChannelOut( |
213 (FlowVelocityData) artifactAndFacet.getData(context), | |
214 artifactAndFacet, | |
215 attr, | |
216 visible); | |
217 } | |
218 else if (name.equals(FLOW_VELOCITY_DISCHARGE)) { | |
219 doQOut( | |
198 (FlowVelocityData) artifactAndFacet.getData(context), | 220 (FlowVelocityData) artifactAndFacet.getData(context), |
199 artifactAndFacet, | 221 artifactAndFacet, |
200 attr, | 222 attr, |
201 visible); | 223 visible); |
202 } | 224 } |
328 * FLYSArtifact.getNativeFacet() instead to retrieve a Facet which supports | 350 * FLYSArtifact.getNativeFacet() instead to retrieve a Facet which supports |
329 * data. | 351 * data. |
330 * @param theme The theme that contains styling information. | 352 * @param theme The theme that contains styling information. |
331 * @param visible The visibility of the curve. | 353 * @param visible The visibility of the curve. |
332 */ | 354 */ |
355 protected void doQOut( | |
356 FlowVelocityData data, | |
357 ArtifactAndFacet aandf, | |
358 Document theme, | |
359 boolean visible | |
360 ) { | |
361 logger.debug("FlowVelocityGenerator.doTauOut"); | |
362 | |
363 XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); | |
364 | |
365 StyledSeriesBuilder.addPoints(series, data.getQPoints(), true); | |
366 | |
367 addAxisSeries(series, YAXIS.Q.idx, visible); | |
368 } | |
369 | |
370 /** | |
371 * @param data A FlowVelocityData object | |
372 * @param aandf The facet. This facet does NOT support any data objects. Use | |
373 * FLYSArtifact.getNativeFacet() instead to retrieve a Facet which supports | |
374 * data. | |
375 * @param theme The theme that contains styling information. | |
376 * @param visible The visibility of the curve. | |
377 */ | |
333 protected void doTauOut( | 378 protected void doTauOut( |
334 FlowVelocityData data, | 379 FlowVelocityData data, |
335 ArtifactAndFacet aandf, | 380 ArtifactAndFacet aandf, |
336 Document theme, | 381 Document theme, |
337 boolean visible | 382 boolean visible |