comparison artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDensityProcessor.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 1508ee33f85f
children 98ca61cb58fb
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 import org.jfree.data.xy.XYSeries; 14 import org.jfree.data.xy.XYSeries;
13 15
14 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; 16 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
29 public static final String I18N_AXIS_LABEL_DEFAULT = 31 public static final String I18N_AXIS_LABEL_DEFAULT =
30 "Dichte [t/m^3]"; 32 "Dichte [t/m^3]";
31 public static final String I18N_AXIS_LABEL = 33 public static final String I18N_AXIS_LABEL =
32 "chart.bedquality.yaxis.label.density"; 34 "chart.bedquality.yaxis.label.density";
33 35
36 protected String yAxisLabel;
34 @Override 37 @Override
35 public void doOut( 38 public void doOut(
36 DiagramGenerator generator, 39 DiagramGenerator generator,
37 ArtifactAndFacet bundle, 40 ArtifactAndFacet bundle,
38 ThemeDocument theme, 41 ThemeDocument theme,
39 boolean visible) { 42 boolean visible) {
40 CallContext context = generator.getCallContext(); 43 CallContext context = generator.getCallContext();
41 XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), 44 StyledXYSeries series = new StyledXYSeries(bundle.getFacetDescription(),
42 theme); 45 theme);
43 Object data = bundle.getData(context); 46 Object data = bundle.getData(context);
47 Map<String, String> metaData = bundle.getFacet().getMetaData();
48 series.putMetaData(metaData, bundle.getArtifact(), context);
49 yAxisLabel = metaData.get("Y");
44 String facetName = bundle.getFacetName(); 50 String facetName = bundle.getFacetName();
45 double [][] points; 51 double [][] points;
46 52
47 if (facetName.equals(FacetTypes.BED_QUALITY_SEDIMENT_DENSITY_TOPLAYER)) { 53 if (facetName.equals(FacetTypes.BED_QUALITY_SEDIMENT_DENSITY_TOPLAYER)) {
48 points = ((BedParametersResult) data).getDensityCapData(); 54 points = ((BedParametersResult) data).getDensityCapData();
63 facettype.equals(FacetTypes.BED_QUALITY_SEDIMENT_DENSITY_TOPLAYER); 69 facettype.equals(FacetTypes.BED_QUALITY_SEDIMENT_DENSITY_TOPLAYER);
64 } 70 }
65 71
66 @Override 72 @Override
67 public String getAxisLabel(DiagramGenerator generator) { 73 public String getAxisLabel(DiagramGenerator generator) {
74 if (yAxisLabel != null && !yAxisLabel.isEmpty()) {
75 return generator.msg(yAxisLabel, I18N_AXIS_LABEL_DEFAULT);
76 }
68 return generator.msg( 77 return generator.msg(
69 I18N_AXIS_LABEL, 78 I18N_AXIS_LABEL,
70 I18N_AXIS_LABEL_DEFAULT); 79 I18N_AXIS_LABEL_DEFAULT);
71 } 80 }
72 } 81 }

http://dive4elements.wald.intevation.org