Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/exports/process/WDiffProcessor.java @ 7808:ea6b441b4872 minfo-opt
Calculate the zoom dependent radius and add the informations to chart subtitle.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Fri, 07 Mar 2014 11:15:38 +0100 |
parents | 3841303a9158 |
children | bd0dfa57b1fe |
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(); |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
48 |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
49 double radius = scales.getRadius(river, start, end); |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
50 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
|
51 context.getMeta(), |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
52 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
|
53 new Object[] { radius })); |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
54 } |
ea6b441b4872
Calculate the zoom dependent radius and add the informations to chart subtitle.
Raimund Renkert <rrenkert@intevation.de>
parents:
7793
diff
changeset
|
55 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
|
56 } |
7102 | 57 @Override |
58 public boolean canHandle(String facetType) { | |
59 if (facetType == null) { | |
60 return false; | |
61 } | |
7793
3841303a9158
Add the new facet to drawable facets.
Raimund Renkert <rrenkert@intevation.de>
parents:
7118
diff
changeset
|
62 return facetType.equals(FacetTypes.W_DIFFERENCES) || |
3841303a9158
Add the new facet to drawable facets.
Raimund Renkert <rrenkert@intevation.de>
parents:
7118
diff
changeset
|
63 facetType.equals(FacetTypes.W_DIFFERENCES_FILTERED); |
7102 | 64 } |
7103
5009b151f146
Add AxisLabel handling to WDiffProcessor
Andre Heinecke <aheinecke@intevation.de>
parents:
7102
diff
changeset
|
65 |
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 @Override |
5009b151f146
Add AxisLabel handling to WDiffProcessor
Andre Heinecke <aheinecke@intevation.de>
parents:
7102
diff
changeset
|
68 public String getAxisLabel(DiagramGenerator generator) { |
5009b151f146
Add AxisLabel handling to WDiffProcessor
Andre Heinecke <aheinecke@intevation.de>
parents:
7102
diff
changeset
|
69 return generator.msg(I18N_WDIFF_YAXIS_LABEL, |
5009b151f146
Add AxisLabel handling to WDiffProcessor
Andre Heinecke <aheinecke@intevation.de>
parents:
7102
diff
changeset
|
70 I18N_WDIFF_YAXIS_LABEL_DEFAULT); |
5009b151f146
Add AxisLabel handling to WDiffProcessor
Andre Heinecke <aheinecke@intevation.de>
parents:
7102
diff
changeset
|
71 } |
7102 | 72 } |
73 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |