Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/exports/process/BedWidthProcessor.java @ 7189:4c8ce0c41dc2
SedimentLoadProcessor: Add debug output when handling an out.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 27 Sep 2013 14:40:39 +0200 |
parents | 1508ee33f85f |
children | 4374a8d26706 |
rev | line source |
---|---|
7145
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
3 * |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
7 */ |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
8 |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
9 package org.dive4elements.river.exports.process; |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
10 |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
11 import org.apache.log4j.Logger; |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
12 import org.jfree.data.xy.XYSeries; |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
13 |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
14 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
15 import org.dive4elements.artifacts.CallContext; |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
16 import org.dive4elements.river.artifacts.model.FacetTypes; |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
17 import org.dive4elements.river.exports.DiagramGenerator; |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
18 import org.dive4elements.river.exports.StyledSeriesBuilder; |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
19 import org.dive4elements.river.jfree.StyledXYSeries; |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
20 import org.dive4elements.river.themes.ThemeDocument; |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
21 |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
22 import org.dive4elements.river.artifacts.model.minfo.BedDiffYearResult; |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
23 import org.dive4elements.river.artifacts.model.minfo.MorphologicWidth; |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
24 |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
25 public class BedWidthProcessor extends DefaultProcessor { |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
26 |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
27 private final static Logger logger = |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
28 Logger.getLogger(BedWidthProcessor.class); |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
29 |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
30 public static final String I18N_AXIS_LABEL_DEFAULT = |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
31 "Breite [m]"; |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
32 public static final String I18N_AXIS_LABEL = |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
33 "chart.beddifference.yaxis.label.morph"; |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
34 |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
35 @Override |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
36 public void doOut( |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
37 DiagramGenerator generator, |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
38 ArtifactAndFacet bundle, |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
39 ThemeDocument theme, |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
40 boolean visible) { |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
41 CallContext context = generator.getCallContext(); |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
42 XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
43 theme); |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
44 Object data = bundle.getData(context); |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
45 |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
46 if (data instanceof BedDiffYearResult) { |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
47 BedDiffYearResult bData = (BedDiffYearResult) data; |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
48 StyledSeriesBuilder.addPoints(series, bData.getMorphWidthData(), true); |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
49 } else if (data instanceof MorphologicWidth) { |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
50 MorphologicWidth bData = (MorphologicWidth) data; |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
51 StyledSeriesBuilder.addPoints(series, bData.getAsArray(), true); |
7148
cde7db30847f
Add BedQuality Processors
Andre Heinecke <aheinecke@intevation.de>
parents:
7145
diff
changeset
|
52 } else { |
cde7db30847f
Add BedQuality Processors
Andre Heinecke <aheinecke@intevation.de>
parents:
7145
diff
changeset
|
53 logger.error("Unknown data for facet: " + bundle.getFacetName()); |
7145
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
54 } |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
55 |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
56 generator.addAxisSeries(series, axisName, visible); |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
57 } |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
58 |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
59 @Override |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
60 public boolean canHandle(String facettype) { |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
61 return facettype.equals(FacetTypes.BED_DIFFERENCE_MORPH_WIDTH) || |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
62 facettype.equals(FacetTypes.MORPHOLOGIC_WIDTH); |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
63 } |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
64 |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
65 @Override |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
66 public String getAxisLabel(DiagramGenerator generator) { |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
67 return generator.msg( |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
68 I18N_AXIS_LABEL, |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
69 I18N_AXIS_LABEL_DEFAULT); |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
70 } |
432047ee5b4b
Add BedWidthProcessor to handle width facets
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
71 } |