Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffYearProcessor.java @ 8730:cb33de3434a8
(issue1754) Proper subtitle handling for Radius
This deduplicates the subtitle and zoom / radius calculation code
by moving it out of the processors. Doing this fixes cases where
the subtitle would be removed when a the according filtered facet
was removed although it should still have shown the Range for example.
Range is now also added as a subtitle for the difference diagrams.
This adds some tasty hack (with cheese) to determine wether or
not the user has set the subtitle. See the comment in
getChartSubtitlePure in LongitudinalSectionGenerator2 for details.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Thu, 30 Apr 2015 13:06:51 +0200 |
parents | 5dea205ea3e7 |
children | 8dbb969091c5 |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffYearProcessor.java Thu Apr 30 13:02:37 2015 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffYearProcessor.java Thu Apr 30 13:06:51 2015 +0200 @@ -14,10 +14,7 @@ import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; import org.dive4elements.artifacts.CallContext; import org.dive4elements.river.artifacts.D4EArtifact; -import org.dive4elements.river.artifacts.access.RiverAccess; -import org.dive4elements.river.artifacts.context.RiverContext; import org.dive4elements.river.artifacts.model.FacetTypes; -import org.dive4elements.river.artifacts.model.ZoomScale; import org.dive4elements.river.artifacts.resources.Resources; import org.dive4elements.river.exports.StyledSeriesBuilder; import org.dive4elements.river.exports.DiagramGenerator; @@ -39,8 +36,6 @@ "chart.beddifference.yaxis.label.diff"; public static final String I18N_AXIS_LABEL_DEFAULT = "delta S [cm]"; - public static final String I18N_SUBTITLE_RADIUS = - "chart.subtitle.radius"; @Override public void doOut( @@ -54,8 +49,6 @@ bundle.getFacet().getMetaData(bundle.getArtifact(), context); yAxisLabel = metaData.get("Y"); - setSubtitleRadius(generator, bundle, context); - Object data = bundle.getData(context); if (data == null) { return; @@ -83,30 +76,6 @@ return; } - private void setSubtitleRadius( - DiagramGenerator generator, - ArtifactAndFacet bundle, - CallContext context - ) { - Double start = (Double)context.getContextValue("startkm"); - Double end = (Double)context.getContextValue("endkm"); - if (start != null && end != null) { - D4EArtifact artifact = (D4EArtifact)bundle.getArtifact(); - RiverContext fc = (RiverContext)context.globalContext(); - // Adaptive smoothing, based on zoom factor/diagram extents. - ZoomScale scales = (ZoomScale)fc.get("zoomscale"); - RiverAccess access = new RiverAccess((D4EArtifact)artifact); - String river = access.getRiverName(); - - double radius = scales.getRadius(river, start, end); - context.putContextValue("radius", radius); - generator.addSubtitle(Resources.getMsg( - context.getMeta(), - I18N_SUBTITLE_RADIUS, - new Object[] { "$RADIUS" })); - } - } - @Override public boolean canHandle(String facetType) { return BED_DIFFERENCE_YEAR.equals(facetType) // from BedDifferencesYear