Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/process/BedHeightProcessor.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 | b2a8a94a92f9 |
children | cf674b03901a |
comparison
equal
deleted
inserted
replaced
7891:4fe290eddb43 | 7892:e844be34a606 |
---|---|
7 */ | 7 */ |
8 | 8 |
9 package org.dive4elements.river.exports.process; | 9 package org.dive4elements.river.exports.process; |
10 | 10 |
11 import java.util.List; | 11 import java.util.List; |
12 import java.util.Map; | |
12 | 13 |
13 import org.apache.log4j.Logger; | 14 import org.apache.log4j.Logger; |
14 import org.jfree.data.xy.XYSeries; | 15 import org.jfree.data.xy.XYSeries; |
15 | 16 |
16 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; | 17 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; |
37 public static final String I18N_AXIS_LABEL = | 38 public static final String I18N_AXIS_LABEL = |
38 "chart.bedheight.height.yaxis.label"; | 39 "chart.bedheight.height.yaxis.label"; |
39 | 40 |
40 protected static final double GAP_TOLERANCE = 0.101d; | 41 protected static final double GAP_TOLERANCE = 0.101d; |
41 | 42 |
43 protected String yAxisLabel; | |
44 | |
42 @Override | 45 @Override |
43 public void doOut( | 46 public void doOut( |
44 DiagramGenerator generator, | 47 DiagramGenerator generator, |
45 ArtifactAndFacet bundle, | 48 ArtifactAndFacet bundle, |
46 ThemeDocument theme, | 49 ThemeDocument theme, |
63 | 66 |
64 /** Prepare an series, independent of axis. */ | 67 /** Prepare an series, independent of axis. */ |
65 private XYSeries prepareSeries(ArtifactAndFacet bundle, | 68 private XYSeries prepareSeries(ArtifactAndFacet bundle, |
66 ThemeDocument theme, CallContext context) { | 69 ThemeDocument theme, CallContext context) { |
67 Object data = bundle.getData(context); | 70 Object data = bundle.getData(context); |
68 XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), | 71 Map<String, String> metaData = bundle.getFacet().getMetaData( |
72 bundle.getArtifact(), context); | |
73 StyledXYSeries series = new StyledXYSeries(bundle.getFacetDescription(), | |
69 theme); | 74 theme); |
75 series.putMetaData(metaData, bundle.getArtifact(), context); | |
76 yAxisLabel = metaData.get("Y"); | |
70 if (data instanceof BedDiffYearResult) { | 77 if (data instanceof BedDiffYearResult) { |
71 BedDiffYearResult bData = (BedDiffYearResult) data; | 78 BedDiffYearResult bData = (BedDiffYearResult) data; |
72 | 79 |
73 double[][] points; | 80 double[][] points; |
74 String facetType = bundle.getFacetName(); | 81 String facetType = bundle.getFacetName(); |
133 public String getAxisLabel(DiagramGenerator generator) { | 140 public String getAxisLabel(DiagramGenerator generator) { |
134 D4EArtifact flys = (D4EArtifact) generator.getMaster(); | 141 D4EArtifact flys = (D4EArtifact) generator.getMaster(); |
135 | 142 |
136 String unit = RiverUtils.getRiver(flys).getWstUnit().getName(); | 143 String unit = RiverUtils.getRiver(flys).getWstUnit().getName(); |
137 | 144 |
145 if (yAxisLabel != null && !yAxisLabel.isEmpty()) { | |
146 return generator.msg( | |
147 yAxisLabel, | |
148 I18N_AXIS_LABEL_DEFAULT, | |
149 new Object[] {unit}); | |
150 } | |
138 return generator.msg( | 151 return generator.msg( |
139 I18N_AXIS_LABEL, | 152 I18N_AXIS_LABEL, |
140 I18N_AXIS_LABEL_DEFAULT, | 153 I18N_AXIS_LABEL_DEFAULT, |
141 new Object[] { unit }); | 154 new Object[] { unit }); |
142 } | 155 } |