Mercurial > dive4elements > river
comparison 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 |
comparison
equal
deleted
inserted
replaced
7807:ad4a3980092f | 7808:ea6b441b4872 |
---|---|
6 * documentation coming with Dive4Elements River for details. | 6 * documentation coming with Dive4Elements River for details. |
7 */ | 7 */ |
8 | 8 |
9 package org.dive4elements.river.exports.process; | 9 package org.dive4elements.river.exports.process; |
10 | 10 |
11 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; | |
12 import org.dive4elements.artifacts.CallContext; | |
13 import org.dive4elements.river.artifacts.D4EArtifact; | |
14 import org.dive4elements.river.artifacts.access.RiverAccess; | |
15 import org.dive4elements.river.artifacts.context.RiverContext; | |
11 import org.dive4elements.river.artifacts.model.FacetTypes; | 16 import org.dive4elements.river.artifacts.model.FacetTypes; |
17 import org.dive4elements.river.artifacts.model.ZoomScale; | |
18 import org.dive4elements.river.artifacts.resources.Resources; | |
12 import org.dive4elements.river.exports.DiagramGenerator; | 19 import org.dive4elements.river.exports.DiagramGenerator; |
20 import org.dive4elements.river.themes.ThemeDocument; | |
13 | 21 |
14 public class WDiffProcessor extends WOutProcessor { | 22 public class WDiffProcessor extends WOutProcessor { |
15 | 23 |
16 public final static String I18N_WDIFF_YAXIS_LABEL = | 24 public final static String I18N_WDIFF_YAXIS_LABEL = |
17 "chart.w_differences.yaxis.label"; | 25 "chart.w_differences.yaxis.label"; |
18 | 26 |
19 public final static String I18N_WDIFF_YAXIS_LABEL_DEFAULT = "m"; | 27 public final static String I18N_WDIFF_YAXIS_LABEL_DEFAULT = "m"; |
20 | 28 |
29 public static final String I18N_SUBTITLE_RADIUS = | |
30 "chart.subtitle.radius"; | |
31 | |
32 @Override | |
33 public void doOut( | |
34 DiagramGenerator generator, | |
35 ArtifactAndFacet bundle, | |
36 ThemeDocument theme, | |
37 boolean visible) { | |
38 CallContext context = generator.getCallContext(); | |
39 Double start = (Double)context.getContextValue("startkm"); | |
40 Double end = (Double)context.getContextValue("endkm"); | |
41 if (start != null && end != null) { | |
42 D4EArtifact artifact = (D4EArtifact)bundle.getArtifact(); | |
43 RiverContext fc = (RiverContext)context.globalContext(); | |
44 // Adaptive smoothing, based on zoom factor/diagram extents. | |
45 ZoomScale scales = (ZoomScale)fc.get("zoomscale"); | |
46 RiverAccess access = new RiverAccess((D4EArtifact)artifact); | |
47 String river = access.getRiverName(); | |
48 | |
49 double radius = scales.getRadius(river, start, end); | |
50 generator.addSubtitle(Resources.getMsg( | |
51 context.getMeta(), | |
52 I18N_SUBTITLE_RADIUS, | |
53 new Object[] { radius })); | |
54 } | |
55 super.doOut(generator, bundle, theme, visible); | |
56 } | |
21 @Override | 57 @Override |
22 public boolean canHandle(String facetType) { | 58 public boolean canHandle(String facetType) { |
23 if (facetType == null) { | 59 if (facetType == null) { |
24 return false; | 60 return false; |
25 } | 61 } |