diff artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator.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 740d65e4aa14
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator.java	Tue Jun 05 19:10:38 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator.java	Tue Jun 05 19:21:16 2018 +0200
@@ -10,6 +10,7 @@
 
 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
 import org.dive4elements.artifactdatabase.state.Facet;
+import org.dive4elements.artifacts.CallContext;
 import org.dive4elements.river.artifacts.D4EArtifact;
 import org.dive4elements.river.artifacts.geom.Lines;
 import org.dive4elements.river.artifacts.model.AreaFacet;
@@ -157,18 +158,17 @@
      * @return the default title for this chart.
      */
     @Override
-    public String getDefaultChartTitle() {
+    public String getDefaultChartTitle(final CallContext context) {
         return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT);
     }
 
-
     /**
      * Returns the default subtitle for this chart.
      *
      * @return the default subtitle for this chart.
      */
     @Override
-    protected String getDefaultChartSubtitle() {
+    protected String getDefaultChartSubtitle(final CallContext context) {
         double[] dist = getRange();
 
         Object[] args = null;
@@ -208,8 +208,8 @@
      * Get internationalized label for the x axis.
      */
     @Override
-    protected String getDefaultXAxisLabel() {
-        D4EArtifact flys = (D4EArtifact) master;
+    protected String getDefaultXAxisLabel(CallContext context) {
+        D4EArtifact flys = getArtifact();
 
         return msg(
             I18N_XAXIS_LABEL,
@@ -241,7 +241,7 @@
      * Get internationalized label for the y axis.
      */
     protected String getWAxisLabel() {
-        D4EArtifact flys = (D4EArtifact) master;
+        D4EArtifact flys = getArtifact();
 
         String unit = RiverUtils.getRiver(flys).getWstUnit().getName();
 
@@ -340,6 +340,8 @@
             return;
         }
 
+        CallContext context = getContext();
+        
         Processor wProcessor = new WOutProcessor();
         Processor qProcessor = new QOutProcessor();
         Processor bdyProcessor = new BedDiffYearProcessor();

http://dive4elements.wald.intevation.org