Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/process/MiddleBedHeightProcessor.java @ 7892:e844be34a606 facet-metadata
Add metadata to chart series and datasets.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Wed, 21 May 2014 11:40:14 +0200 |
parents | 9344aa0fb021 |
children | 62befca02480 |
comparison
equal
deleted
inserted
replaced
7891:4fe290eddb43 | 7892:e844be34a606 |
---|---|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the | 5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
6 * documentation coming with Dive4Elements River for details. | 6 * documentation coming with Dive4Elements River for details. |
7 */ | 7 */ |
8 | 8 |
9 package org.dive4elements.river.exports.process; | 9 package org.dive4elements.river.exports.process; |
10 | |
11 import java.util.Map; | |
10 | 12 |
11 import org.apache.log4j.Logger; | 13 import org.apache.log4j.Logger; |
12 | 14 |
13 import org.jfree.data.xy.XYSeries; | 15 import org.jfree.data.xy.XYSeries; |
14 | 16 |
34 "chart.bedheight_middle.section.yaxis.label"; | 36 "chart.bedheight_middle.section.yaxis.label"; |
35 | 37 |
36 public static final String I18N_AXIS_LABEL_DEFAULT = | 38 public static final String I18N_AXIS_LABEL_DEFAULT = |
37 "mittlere Sohlhöhen [müNN]"; | 39 "mittlere Sohlhöhen [müNN]"; |
38 | 40 |
41 protected String yAxisLabel; | |
42 | |
39 @Override | 43 @Override |
40 public void doOut( | 44 public void doOut( |
41 DiagramGenerator generator, | 45 DiagramGenerator generator, |
42 ArtifactAndFacet bundle, | 46 ArtifactAndFacet bundle, |
43 ThemeDocument theme, | 47 ThemeDocument theme, |
44 boolean visible) { | 48 boolean visible) { |
45 CallContext context = generator.getCallContext(); | 49 CallContext context = generator.getCallContext(); |
46 logger.debug("Processing: " + bundle.getFacetName()); | 50 logger.debug("Processing: " + bundle.getFacetName()); |
51 Map<String, String> metaData = bundle.getFacet().getMetaData(); | |
52 yAxisLabel = metaData.get("Y"); | |
47 MiddleBedHeightData data = | 53 MiddleBedHeightData data = |
48 (MiddleBedHeightData) bundle.getData(context); | 54 (MiddleBedHeightData) bundle.getData(context); |
49 | 55 |
50 XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), | 56 StyledXYSeries series = new StyledXYSeries(bundle.getFacetDescription(), |
51 theme); | 57 theme); |
58 series.putMetaData(metaData, bundle.getArtifact(), context); | |
52 | 59 |
53 StyledSeriesBuilder.addPoints(series, data.getMiddleHeightsPoints(), | 60 StyledSeriesBuilder.addPoints(series, data.getMiddleHeightsPoints(), |
54 false, 0.110d); | 61 false, 0.110d); |
55 | 62 |
56 generator.addAxisSeries(series, axisName, visible); | 63 generator.addAxisSeries(series, axisName, visible); |
60 public String getAxisLabel(DiagramGenerator generator) { | 67 public String getAxisLabel(DiagramGenerator generator) { |
61 D4EArtifact flys = (D4EArtifact) generator.getMaster(); | 68 D4EArtifact flys = (D4EArtifact) generator.getMaster(); |
62 | 69 |
63 String unit = RiverUtils.getRiver(flys).getWstUnit().getName(); | 70 String unit = RiverUtils.getRiver(flys).getWstUnit().getName(); |
64 | 71 |
72 if (yAxisLabel != null && !yAxisLabel.isEmpty()) { | |
73 return generator.msg( | |
74 yAxisLabel, | |
75 I18N_AXIS_LABEL_DEFAULT, | |
76 new Object[] { unit }); | |
77 } | |
65 return generator.msg( | 78 return generator.msg( |
66 I18N_AXIS_LABEL, | 79 I18N_AXIS_LABEL, |
67 I18N_AXIS_LABEL_DEFAULT, | 80 I18N_AXIS_LABEL_DEFAULT, |
68 new Object[] { unit }); | 81 new Object[] { unit }); |
69 } | 82 } |