annotate artifacts/src/main/java/org/dive4elements/river/exports/process/SedimentLoadM3AProcessor.java @ 7511:e97867879a45

Removed obsolete imports.
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 01 Nov 2013 18:36:39 +0100
parents e11bf92bca4a
children 270946b97539
rev   line source
7503
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesanstalt für Gewässerkunde
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
3 *
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
6 * documentation coming with Dive4Elements River for details.
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
7 */
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
8
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
9 package org.dive4elements.river.exports.process;
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
10
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
11 import java.util.Set;
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
12
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
13 import org.apache.log4j.Logger;
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
14 import org.jfree.data.xy.XYSeries;
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
15
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
16 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
17 import org.dive4elements.artifacts.CallContext;
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
18 import org.dive4elements.river.artifacts.model.FacetTypes;
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
19 import org.dive4elements.river.exports.DiagramGenerator;
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
20 import org.dive4elements.river.exports.StyledSeriesBuilder;
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
21 import org.dive4elements.river.jfree.StyledXYSeries;
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
22 import org.dive4elements.river.themes.ThemeDocument;
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
23
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
24 import org.dive4elements.river.artifacts.model.minfo.SedimentLoad;
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
25 import org.dive4elements.river.artifacts.model.minfo.SedimentLoadFraction;
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
26
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
27 public class SedimentLoadM3AProcessor extends DefaultProcessor {
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
28
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
29 private final static Logger logger =
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
30 Logger.getLogger(SedimentLoadM3AProcessor.class);
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
31
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
32 public static final String I18N_YAXIS_LABEL =
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
33 "chart.sedimentload.ls.yaxis.label.m3pera";
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
34 public static final String I18N_YAXIS_LABEL_DEFAULT = "[m\u00b3/a]";
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
35
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
36 @Override
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
37 public void doOut(
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
38 DiagramGenerator generator,
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
39 ArtifactAndFacet bundle,
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
40 ThemeDocument theme,
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
41 boolean visible) {
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
42 logger.debug("doOut " + bundle.getFacetName());
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
43 CallContext context = generator.getCallContext();
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
44 XYSeries series = new StyledXYSeries(bundle.getFacetDescription(),
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
45 theme);
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
46 Object data = bundle.getData(context);
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
47 String facetName = bundle.getFacetName();
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
48 double [][] points;
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
49
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
50 if (FacetTypes.IS.SEDIMENT_LOAD_M3A(facetName)) {
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
51 points = (double[][]) data;
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
52 } else if (FacetTypes.IS.SEDIMENT_LOAD_UNKNOWN(facetName)) {
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
53 SedimentLoad load = (SedimentLoad) data;
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
54 Set<Double> kms = load.getKms();
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
55 points = new double[2][kms.size()];
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
56 int counter = 0;
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
57 for (Double km: kms) {
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
58 SedimentLoadFraction fraction = load.getFraction(km);
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
59 points[0][counter] = km;
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
60 points[1][counter] = fraction.getUnknown();
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
61 counter++;
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
62 }
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
63 } else {
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
64 logger.error("Unknown facet name: " + facetName);
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
65 return;
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
66 }
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
67
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
68 StyledSeriesBuilder.addPoints(series, points, true);
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
69
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
70 generator.addAxisSeries(series, axisName, visible);
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
71 }
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
72
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
73 @Override
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
74 public boolean canHandle(String facettype) {
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
75 return FacetTypes.IS.SEDIMENT_LOAD_M3A(facettype) ||
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
76 FacetTypes.SEDIMENT_LOAD_M3A_UNKNOWN.equals(facettype);
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
77 }
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
78
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
79 @Override
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
80 public String getAxisLabel(DiagramGenerator generator) {
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
81 return generator.msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT);
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
82 }
e11bf92bca4a issue1658: New Processors for t/a and m^3/a -axis (stripped down from SedimentLoadProcessor).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
83 }

http://dive4elements.wald.intevation.org