Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator2.java @ 9123:1cc7653ca84f
Cleanup of ChartGenerator and ChartGenerator2 code. Put some of the copy/pasted code into a common abstraction.
author | gernotbelger |
---|---|
date | Tue, 05 Jun 2018 19:21:16 +0200 |
parents | 5e38e2924c07 |
children |
comparison
equal
deleted
inserted
replaced
9122:b8e7f6becf78 | 9123:1cc7653ca84f |
---|---|
8 | 8 |
9 package org.dive4elements.river.exports; | 9 package org.dive4elements.river.exports; |
10 | 10 |
11 import org.dive4elements.river.artifacts.D4EArtifact; | 11 import org.dive4elements.river.artifacts.D4EArtifact; |
12 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; | 12 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; |
13 import org.dive4elements.artifacts.CallContext; | |
13 import org.dive4elements.river.jfree.Bounds; | 14 import org.dive4elements.river.jfree.Bounds; |
14 import org.dive4elements.river.themes.ThemeDocument; | 15 import org.dive4elements.river.themes.ThemeDocument; |
15 import org.dive4elements.river.artifacts.model.FacetTypes; | 16 import org.dive4elements.river.artifacts.model.FacetTypes; |
16 import org.dive4elements.river.artifacts.access.RiverAccess; | 17 import org.dive4elements.river.artifacts.access.RiverAccess; |
17 import org.dive4elements.river.artifacts.model.ZoomScale; | 18 import org.dive4elements.river.artifacts.model.ZoomScale; |
60 | 61 |
61 public static final String I18N_SUBTITLE_RADIUS = | 62 public static final String I18N_SUBTITLE_RADIUS = |
62 "chart.subtitle.radius"; | 63 "chart.subtitle.radius"; |
63 | 64 |
64 @Override | 65 @Override |
65 public String getDefaultChartSubtitle() { | 66 public String getDefaultChartSubtitle(final CallContext context) { |
66 double[] dist = getRange(); | 67 double[] dist = getRange(); |
67 | 68 |
68 String parts = ""; | 69 String parts = ""; |
69 if (subTitleParts != null && !subTitleParts.isEmpty()) { | 70 if (subTitleParts != null && !subTitleParts.isEmpty()) { |
70 for (String p : subTitleParts) { | 71 for (String p : subTitleParts) { |
122 log.debug("startkm for Radius is: " + candidate.getLowerBound() + | 123 log.debug("startkm for Radius is: " + candidate.getLowerBound() + |
123 " endkm: " + candidate.getUpperBound()); | 124 " endkm: " + candidate.getUpperBound()); |
124 | 125 |
125 // This might not be neccessary if every facet uses only the | 126 // This might not be neccessary if every facet uses only the |
126 // radius and does not do its own zoomscale calculation. | 127 // radius and does not do its own zoomscale calculation. |
128 final CallContext context = getContext(); | |
127 context.putContextValue("startkm", candidate.getLowerBound()); | 129 context.putContextValue("startkm", candidate.getLowerBound()); |
128 context.putContextValue("endkm", candidate.getUpperBound()); | 130 context.putContextValue("endkm", candidate.getUpperBound()); |
129 context.putContextValue("bounds_defined", true); | 131 context.putContextValue("bounds_defined", true); |
130 | 132 |
131 RiverContext fc = (RiverContext)context.globalContext(); | 133 RiverContext fc = (RiverContext)context.globalContext(); |
144 log.debug("PostProcess without bundles to process"); | 146 log.debug("PostProcess without bundles to process"); |
145 return; | 147 return; |
146 } | 148 } |
147 | 149 |
148 // fake startkm and endkm for the dry run | 150 // fake startkm and endkm for the dry run |
151 final CallContext context = getContext(); | |
149 context.putContextValue("startkm", 0d); | 152 context.putContextValue("startkm", 0d); |
150 context.putContextValue("endkm", 42d); | 153 context.putContextValue("endkm", 42d); |
151 for (SuperBundle superbundle: postOutAF) { | 154 for (SuperBundle superbundle: postOutAF) { |
152 // Dry run with fake start /end | 155 // Dry run with fake start /end |
153 // to get the filtered facets also included | 156 // to get the filtered facets also included |
183 // the radius of the filter / smoothing operation. So | 186 // the radius of the filter / smoothing operation. So |
184 // we postprocess them. | 187 // we postprocess them. |
185 | 188 |
186 SuperBundle superbundle = new SuperBundle(bundle, theme, visible); | 189 SuperBundle superbundle = new SuperBundle(bundle, theme, visible); |
187 if (postOutAF == null) { | 190 if (postOutAF == null) { |
188 postOutAF = new ArrayList<SuperBundle>(); | 191 postOutAF = new ArrayList<>(); |
189 } | 192 } |
190 postOutAF.add(superbundle); | 193 postOutAF.add(superbundle); |
191 if (visible) { | 194 if (visible) { |
192 log.debug("Adding radius subtitle."); | 195 log.debug("Adding radius subtitle."); |
193 | 196 |
194 addSubtitle(Resources.getMsg( | 197 addSubtitle(msg(I18N_SUBTITLE_RADIUS) + ": $RADIUS"); |
195 getCallContext().getMeta(), | |
196 I18N_SUBTITLE_RADIUS) + ": $RADIUS"); | |
197 } | 198 } |
198 return; | 199 return; |
199 } | 200 } |
200 super.doOut(bundle, theme, visible); | 201 super.doOut(bundle, theme, visible); |
201 } | 202 } |