comparison artifacts/src/main/java/org/dive4elements/river/exports/process/FlowVelocityProcessor.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 440c55b9634e
children 45cced06490c
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;
30 public static final String I18N_AXIS_LABEL = 32 public static final String I18N_AXIS_LABEL =
31 "chart.flow_velocity.section.yaxis.label"; 33 "chart.flow_velocity.section.yaxis.label";
32 public static final String I18N_AXIS_LABEL_DEFAULT = 34 public static final String I18N_AXIS_LABEL_DEFAULT =
33 "Geschwindigkeit v [m/s]"; 35 "Geschwindigkeit v [m/s]";
34 36
37
38 protected String yAxisLabel;
39
35 @Override 40 @Override
36 public void doOut( 41 public void doOut(
37 DiagramGenerator generator, 42 DiagramGenerator generator,
38 ArtifactAndFacet bundle, 43 ArtifactAndFacet bundle,
39 ThemeDocument theme, 44 ThemeDocument theme,
40 boolean visible) { 45 boolean visible) {
41 CallContext context = generator.getCallContext(); 46 CallContext context = generator.getCallContext();
42 XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), 47 Map<String, String> metaData = bundle.getFacet().getMetaData();
48 StyledXYSeries series = new StyledXYSeries(bundle.getFacetDescription(),
43 theme); 49 theme);
50 series.putMetaData(metaData, bundle.getArtifact(), context);
51 yAxisLabel = metaData.get("Y");
44 String facetName = bundle.getFacetName(); 52 String facetName = bundle.getFacetName();
45 Object data = bundle.getData(context); 53 Object data = bundle.getData(context);
46 if (data == null) { 54 if (data == null) {
47 // Check has been here before so we keep it for security reasons 55 // Check has been here before so we keep it for security reasons
48 // this should never happen though. 56 // this should never happen though.
81 facettype.equals(FacetTypes.FLOW_VELOCITY_MEASUREMENT); 89 facettype.equals(FacetTypes.FLOW_VELOCITY_MEASUREMENT);
82 } 90 }
83 91
84 @Override 92 @Override
85 public String getAxisLabel(DiagramGenerator generator) { 93 public String getAxisLabel(DiagramGenerator generator) {
94 if (yAxisLabel != null && !yAxisLabel.isEmpty()) {
95 return generator.msg(yAxisLabel, I18N_AXIS_LABEL_DEFAULT);
96 }
86 return generator.msg( 97 return generator.msg(
87 I18N_AXIS_LABEL, 98 I18N_AXIS_LABEL,
88 I18N_AXIS_LABEL_DEFAULT); 99 I18N_AXIS_LABEL_DEFAULT);
89 } 100 }
90 } 101 }

http://dive4elements.wald.intevation.org