Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java @ 3017:296b067e17e6
i18n and format for line labels.
flys-artifacts/trunk@4582 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 05 Jun 2012 12:35:49 +0000 |
parents | 834b81134b12 |
children | 5642a83420f2 |
comparison
equal
deleted
inserted
replaced
3016:75e83b02bb9d | 3017:296b067e17e6 |
---|---|
1 package de.intevation.flys.exports; | 1 package de.intevation.flys.exports; |
2 | 2 |
3 import java.util.List; | 3 import java.util.List; |
4 import java.text.NumberFormat; | |
4 | 5 |
5 import org.apache.log4j.Logger; | 6 import org.apache.log4j.Logger; |
6 | 7 |
7 import org.jfree.chart.JFreeChart; | 8 import org.jfree.chart.JFreeChart; |
8 import org.jfree.chart.title.TextTitle; | 9 import org.jfree.chart.title.TextTitle; |
24 import de.intevation.flys.artifacts.model.HYKFactory; | 25 import de.intevation.flys.artifacts.model.HYKFactory; |
25 | 26 |
26 import de.intevation.flys.geom.Lines; | 27 import de.intevation.flys.geom.Lines; |
27 | 28 |
28 import de.intevation.flys.utils.ThemeUtil; | 29 import de.intevation.flys.utils.ThemeUtil; |
30 import de.intevation.flys.utils.Formatter; | |
29 | 31 |
30 | 32 |
31 /** | 33 /** |
32 * An OutGenerator that generates cross section graphs. | 34 * An OutGenerator that generates cross section graphs. |
33 */ | 35 */ |
222 | 224 |
223 Lines.LineData lines = (Lines.LineData) o; | 225 Lines.LineData lines = (Lines.LineData) o; |
224 // DO NOT SORT DATA! This destroys the gaps indicated by NaNs. | 226 // DO NOT SORT DATA! This destroys the gaps indicated by NaNs. |
225 StyledXYSeries series = new StyledXYSeries(seriesName, false, theme); | 227 StyledXYSeries series = new StyledXYSeries(seriesName, false, theme); |
226 | 228 |
227 // TODO i18n for all the label text and number format. | |
228 if (ThemeUtil.parseShowWidth(theme)) { | 229 if (ThemeUtil.parseShowWidth(theme)) { |
229 series.setLabel(series.getLabel() + ", b=" + lines.width + "m"); | 230 NumberFormat nf = nf = Formatter.getMeterFormat(this.context); |
231 series.setLabel(series.getLabel() + ", b=" + | |
232 nf.format(lines.width) + "m"); | |
230 } | 233 } |
231 if (ThemeUtil.parseShowLevel(theme) && lines.points.length >0 | 234 if (ThemeUtil.parseShowLevel(theme) && lines.points.length >0 |
232 && lines.points[1].length > 0) { | 235 && lines.points[1].length > 0) { |
233 series.setLabel(series.getLabel() + ", W=" + lines.points[1][0] + "NN+m"); | 236 NumberFormat nf = nf = Formatter.getMeterFormat(this.context); |
237 series.setLabel(series.getLabel() + ", W=" + | |
238 nf.format(lines.points[1][0]) + "NN+m"); | |
234 } | 239 } |
235 if (ThemeUtil.parseShowMiddleHeight(theme) && lines.width != 0) { | 240 if (ThemeUtil.parseShowMiddleHeight(theme) && lines.width != 0) { |
236 series.setLabel(series.getLabel() + ",H=" + lines.area / lines.width + "m : " + lines.area + "/" + lines.width); | 241 NumberFormat nf = nf = Formatter.getMeterFormat(this.context); |
242 series.setLabel(series.getLabel() + ",H=" + | |
243 nf.format(lines.area / lines.width) + "m"); | |
244 // : " + lines.area + "/" + lines.width); | |
237 } | 245 } |
238 | 246 |
239 StyledSeriesBuilder.addPoints(series, lines.points, false); | 247 StyledSeriesBuilder.addPoints(series, lines.points, false); |
240 | 248 |
241 addAxisSeries(series, 0, visible); | 249 addAxisSeries(series, 0, visible); |