diff 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
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator2.java	Tue Jun 05 19:10:38 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator2.java	Tue Jun 05 19:21:16 2018 +0200
@@ -10,6 +10,7 @@
 
 import org.dive4elements.river.artifacts.D4EArtifact;
 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
+import org.dive4elements.artifacts.CallContext;
 import org.dive4elements.river.jfree.Bounds;
 import org.dive4elements.river.themes.ThemeDocument;
 import org.dive4elements.river.artifacts.model.FacetTypes;
@@ -62,7 +63,7 @@
         "chart.subtitle.radius";
 
     @Override
-    public String getDefaultChartSubtitle() {
+    public String getDefaultChartSubtitle(final CallContext context) {
         double[] dist = getRange();
 
         String parts = "";
@@ -124,6 +125,7 @@
 
         // This might not be neccessary if every facet uses only the
         // radius and does not do its own zoomscale calculation.
+        final CallContext context = getContext();
         context.putContextValue("startkm", candidate.getLowerBound());
         context.putContextValue("endkm", candidate.getUpperBound());
         context.putContextValue("bounds_defined", true);
@@ -146,6 +148,7 @@
         }
 
         // fake startkm and endkm for the dry run
+        final CallContext context = getContext();
         context.putContextValue("startkm", 0d);
         context.putContextValue("endkm", 42d);
         for (SuperBundle superbundle: postOutAF) {
@@ -185,15 +188,13 @@
 
             SuperBundle superbundle = new SuperBundle(bundle, theme, visible);
             if (postOutAF == null) {
-                postOutAF = new ArrayList<SuperBundle>();
+                postOutAF = new ArrayList<>();
             }
             postOutAF.add(superbundle);
             if (visible) {
                 log.debug("Adding radius subtitle.");
 
-                addSubtitle(Resources.getMsg(
-                            getCallContext().getMeta(),
-                            I18N_SUBTITLE_RADIUS) + ": $RADIUS");
+                addSubtitle(msg(I18N_SUBTITLE_RADIUS) + ": $RADIUS");
             }
             return;
         }

http://dive4elements.wald.intevation.org