Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/exports/process/WDiffProcessor.java @ 8267:99912f51468d
A bit less chaos in i18n for bed heights.
author | "Tom Gottfried <tom@intevation.de>" |
---|---|
date | Fri, 12 Sep 2014 19:00:45 +0200 |
parents | e1b49fc9d2b5 |
children | cb33de3434a8 |
rev | line source |
---|---|
7102 | 1 /* Copyright (C) 2013 by Bundesanstalt für Gewässerkunde |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU AGPL (>=v3) | |
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the | |
6 * documentation coming with Dive4Elements River for details. | |
7 */ | |
8 | |
9 package org.dive4elements.river.exports.process; | |
10 | |
7808
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
11 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
12 import org.dive4elements.artifacts.CallContext; |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
13 import org.dive4elements.river.artifacts.D4EArtifact; |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
14 import org.dive4elements.river.artifacts.access.RiverAccess; |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
15 import org.dive4elements.river.artifacts.context.RiverContext; |
7102 | 16 import org.dive4elements.river.artifacts.model.FacetTypes; |
7808
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
17 import org.dive4elements.river.artifacts.model.ZoomScale; |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
18 import org.dive4elements.river.artifacts.resources.Resources; |
7103
5009b151f146
Add AxisLabel handling to WDiffProcessor
Andre Heinecke <aheinecke@intevation.de>
parents:
7102
diff
changeset
|
19 import org.dive4elements.river.exports.DiagramGenerator; |
7808
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
20 import org.dive4elements.river.themes.ThemeDocument; |
7102 | 21 |
22 public class WDiffProcessor extends WOutProcessor { | |
23 | |
7103
5009b151f146
Add AxisLabel handling to WDiffProcessor
Andre Heinecke <aheinecke@intevation.de>
parents:
7102
diff
changeset
|
24 public final static String I18N_WDIFF_YAXIS_LABEL = |
5009b151f146
Add AxisLabel handling to WDiffProcessor
Andre Heinecke <aheinecke@intevation.de>
parents:
7102
diff
changeset
|
25 "chart.w_differences.yaxis.label"; |
5009b151f146
Add AxisLabel handling to WDiffProcessor
Andre Heinecke <aheinecke@intevation.de>
parents:
7102
diff
changeset
|
26 |
5009b151f146
Add AxisLabel handling to WDiffProcessor
Andre Heinecke <aheinecke@intevation.de>
parents:
7102
diff
changeset
|
27 public final static String I18N_WDIFF_YAXIS_LABEL_DEFAULT = "m"; |
5009b151f146
Add AxisLabel handling to WDiffProcessor
Andre Heinecke <aheinecke@intevation.de>
parents:
7102
diff
changeset
|
28 |
7808
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
29 public static final String I18N_SUBTITLE_RADIUS = |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
30 "chart.subtitle.radius"; |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
31 |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
32 @Override |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
33 public void doOut( |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
34 DiagramGenerator generator, |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
35 ArtifactAndFacet bundle, |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
36 ThemeDocument theme, |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
37 boolean visible) { |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
38 CallContext context = generator.getCallContext(); |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
39 Double start = (Double)context.getContextValue("startkm"); |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
40 Double end = (Double)context.getContextValue("endkm"); |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
41 if (start != null && end != null) { |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
42 D4EArtifact artifact = (D4EArtifact)bundle.getArtifact(); |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
43 RiverContext fc = (RiverContext)context.globalContext(); |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
44 // Adaptive smoothing, based on zoom factor/diagram extents. |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
45 ZoomScale scales = (ZoomScale)fc.get("zoomscale"); |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
46 RiverAccess access = new RiverAccess((D4EArtifact)artifact); |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
47 String river = access.getRiverName(); |
8074
bd0dfa57b1fe
flys/issue1262: Introduce variable $RADIUS to be used in user defined chart sub titles.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7808
diff
changeset
|
48 double radius = scales.getRadius(river, start, end); |
bd0dfa57b1fe
flys/issue1262: Introduce variable $RADIUS to be used in user defined chart sub titles.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7808
diff
changeset
|
49 context.putContextValue("radius", radius); |
7808
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
50 |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
51 generator.addSubtitle(Resources.getMsg( |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
52 context.getMeta(), |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
53 I18N_SUBTITLE_RADIUS, |
8076
e1b49fc9d2b5
Fixed sub title zoom stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8074
diff
changeset
|
54 new Object[] { "$RADIUS" })); |
7808
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
55 } |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
56 super.doOut(generator, bundle, theme, visible); |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
57 } |
7102 | 58 @Override |
59 public boolean canHandle(String facetType) { | |
60 if (facetType == null) { | |
61 return false; | |
62 } | |
7793
3841303a9158
Add the new facet to drawable facets.
Raimund Renkert <rrenkert@intevation.de>
parents:
7118
diff
changeset
|
63 return facetType.equals(FacetTypes.W_DIFFERENCES) || |
3841303a9158
Add the new facet to drawable facets.
Raimund Renkert <rrenkert@intevation.de>
parents:
7118
diff
changeset
|
64 facetType.equals(FacetTypes.W_DIFFERENCES_FILTERED); |
7102 | 65 } |
7103
5009b151f146
Add AxisLabel handling to WDiffProcessor
Andre Heinecke <aheinecke@intevation.de>
parents:
7102
diff
changeset
|
66 |
5009b151f146
Add AxisLabel handling to WDiffProcessor
Andre Heinecke <aheinecke@intevation.de>
parents:
7102
diff
changeset
|
67 |
5009b151f146
Add AxisLabel handling to WDiffProcessor
Andre Heinecke <aheinecke@intevation.de>
parents:
7102
diff
changeset
|
68 @Override |
5009b151f146
Add AxisLabel handling to WDiffProcessor
Andre Heinecke <aheinecke@intevation.de>
parents:
7102
diff
changeset
|
69 public String getAxisLabel(DiagramGenerator generator) { |
5009b151f146
Add AxisLabel handling to WDiffProcessor
Andre Heinecke <aheinecke@intevation.de>
parents:
7102
diff
changeset
|
70 return generator.msg(I18N_WDIFF_YAXIS_LABEL, |
5009b151f146
Add AxisLabel handling to WDiffProcessor
Andre Heinecke <aheinecke@intevation.de>
parents:
7102
diff
changeset
|
71 I18N_WDIFF_YAXIS_LABEL_DEFAULT); |
5009b151f146
Add AxisLabel handling to WDiffProcessor
Andre Heinecke <aheinecke@intevation.de>
parents:
7102
diff
changeset
|
72 } |
7102 | 73 } |
74 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |