annotate artifacts/src/main/java/org/dive4elements/river/exports/process/FixDeltaWAProcessor.java @ 9726:0a5239a1e46e 3.2.x

Upgrade to Log4j 2
author Tom Gottfried <tom@intevation.de>
date Wed, 02 Mar 2022 10:26:50 +0100
parents 5e38e2924c07
children
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
9726
0a5239a1e46e Upgrade to Log4j 2
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
11 import org.apache.logging.log4j.Logger;
0a5239a1e46e Upgrade to Log4j 2
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
12 import org.apache.logging.log4j.LogManager;
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
13 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
14
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.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
16 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
17 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
18 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
19 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
20 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
21 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
22 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
23 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
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
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 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
27 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
28
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7523
diff changeset
29 private final static Logger log =
9726
0a5239a1e46e Upgrade to Log4j 2
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
30 LogManager.getLogger(FixDeltaWAProcessor.class);
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
31
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 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
33 "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
34 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
35 "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
36
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 @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
38 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
39 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
40 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
41 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
42 boolean 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
43 CallContext context = generator.getCallContext();
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 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
45
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
46 XYSeries series = new StyledXYSeries(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
47 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
48
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 // 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
50 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
51
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 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
53 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
54
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 // 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
56 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
57 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
58 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
59 "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
60 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
61 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
62 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
63 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
64
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
65 StyledAreaSeriesCollection area =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
66 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
67 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
68 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
69 area.setMode(StyledAreaSeriesCollection.FILL_MODE.BETWEEN);
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 generator.addAreaSeries(area, 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
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
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 @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
75 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
76 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
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
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 @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
80 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
81 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
82 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
83 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
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 }
ce90d2f4ee46 issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
86 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org