Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/exports/process/FixDeltaWAProcessor.java @ 9496:d8e753d0fdb9
stripedArea introduced for Assessment Scheme/Bewertungsschema
author | gernotbelger |
---|---|
date | Wed, 26 Sep 2018 15:48:05 +0200 |
parents | 1cc7653ca84f |
children | 9b8e8fc1f408 |
rev | line source |
---|---|
7523
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
3 * |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
7 */ |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
9 package org.dive4elements.river.exports.process; |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
11 import org.apache.log4j.Logger; |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
12 import org.jfree.data.xy.XYSeries; |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 import org.dive4elements.artifacts.CallContext; |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 import org.dive4elements.river.artifacts.model.FacetTypes; |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
17 import org.dive4elements.river.artifacts.model.WKms; |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
18 import org.dive4elements.river.exports.StyledSeriesBuilder; |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 import org.dive4elements.river.exports.DiagramGenerator; |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
20 import org.dive4elements.river.jfree.StyledAreaSeriesCollection; |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
21 import org.dive4elements.river.jfree.StyledXYSeries; |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
22 import org.dive4elements.river.themes.ThemeDocument; |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
23 |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
24 |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
25 public class FixDeltaWAProcessor |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
26 extends DefaultProcessor implements FacetTypes { |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
27 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7523
diff
changeset
|
28 private final static Logger log = |
7523
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
29 Logger.getLogger(FixDeltaWAProcessor.class); |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
30 |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
31 public static final String I18N_AXIS_LABEL = |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
32 "chart.beddifference.height.yaxis.label"; |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
33 public static final String I18N_AXIS_LABEL_DEFAULT = |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
34 "delta S [cm / Jahr]"; |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
35 |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
36 @Override |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
37 public void doOut( |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
38 DiagramGenerator generator, |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
39 ArtifactAndFacet bundle, |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
40 ThemeDocument theme, |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
41 boolean visible) { |
9123
1cc7653ca84f
Cleanup of ChartGenerator and ChartGenerator2 code. Put some of the copy/pasted code into a common abstraction.
gernotbelger
parents:
8856
diff
changeset
|
42 CallContext context = generator.getContext(); |
7523
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
43 Object data = bundle.getData(context); |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
44 |
8856 | 45 XYSeries series = new StyledXYSeries( |
46 bundle.getFacetDescription(), theme); | |
7523
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
47 |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 // Handle WKms data. |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
49 WKms wkms = (WKms) data; |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
50 |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
51 StyledSeriesBuilder.addPoints(series, wkms); |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
52 generator.addAxisSeries(series, axisName, visible); |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
53 |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
54 // If a "band around the curve shall be drawn, add according area. |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
55 double bandWidth = theme.parseBandWidth(); |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
56 if (bandWidth > 0 ) { |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
57 XYSeries seriesDown = new StyledXYSeries( |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
58 "band " + bundle.getFacetDescription(), false, theme); |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
59 XYSeries seriesUp = new StyledXYSeries( |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
60 bundle.getFacetDescription()+"+/-"+bandWidth, false, theme); |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
61 StyledSeriesBuilder.addUpperBand(seriesUp, wkms, bandWidth); |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
62 StyledSeriesBuilder.addLowerBand(seriesDown, wkms, bandWidth); |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
63 |
8856 | 64 StyledAreaSeriesCollection area = |
65 new StyledAreaSeriesCollection(theme); | |
7523
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
66 area.addSeries(seriesUp); |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
67 area.addSeries(seriesDown); |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
68 area.setMode(StyledAreaSeriesCollection.FILL_MODE.BETWEEN); |
9496
d8e753d0fdb9
stripedArea introduced for Assessment Scheme/Bewertungsschema
gernotbelger
parents:
9123
diff
changeset
|
69 generator.addAxisDataset(area, axisName, visible); |
7523
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
70 } |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
71 } |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
72 |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
73 @Override |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
74 public boolean canHandle(String facetType) { |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
75 return STATIC_DELTA_W_CMA.equals(facetType); |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
76 } |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
77 |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
78 @Override |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
79 public String getAxisLabel(DiagramGenerator generator) { |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
80 return generator.msg( |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
81 I18N_AXIS_LABEL, |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
82 I18N_AXIS_LABEL_DEFAULT); |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
83 } |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
84 } |
ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
85 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |