[PATCH 2 of 4] Fixed W/Q diagram subtitle in fix analysis

Wald Commits scm-commit at wald.intevation.org
Thu Oct 2 14:03:03 CEST 2014


# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1412251160 -7200
# Node ID e1ff1263d79a13ee1c0433db87fba4bcfb8c8760
# Parent  a5bd0a5b8efda6b57091f9a9f9563bc4e38864eb
Fixed W/Q diagram subtitle in fix analysis.

diff -r a5bd0a5b8efd -r e1ff1263d79a artifacts/doc/conf/generators/discharge-diagrams.xml
--- a/artifacts/doc/conf/generators/discharge-diagrams.xml	Thu Oct 02 13:57:50 2014 +0200
+++ b/artifacts/doc/conf/generators/discharge-diagrams.xml	Thu Oct 02 13:59:20 2014 +0200
@@ -38,9 +38,8 @@
       converter="org.dive4elements.river.exports.DiagramAttributes"
       injectors="org.dive4elements.river.exports.injector.KmFromRequestInjector,org.dive4elements.river.exports.injector.PNPInjector">
       <title key="chart.fixings.discharge.curve.title" default="Fixierungsanalyse W/Q"/>
-    <subtitle key="chart.computed.discharge.curve.subtitle" default="-">
+    <subtitle key="chart.fix.discharge.curve.subtitle" default="-">
         <arg expr="artifact.river"/>
-        <arg expr="context.currentkm" type="double"/>
     </subtitle>
     &discharge-defaults;
   </output-generator>
diff -r a5bd0a5b8efd -r e1ff1263d79a artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator2.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator2.java	Thu Oct 02 13:57:50 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator2.java	Thu Oct 02 13:59:20 2014 +0200
@@ -72,6 +72,8 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
+import static org.dive4elements.river.exports.injector.InjectorConstants.CURRENT_KM;
+
 /**
  * Implementation of the OutGenerator interface for charts.
  * It should provide some basic things that equal in all chart types.
@@ -663,6 +665,10 @@
             NumberFormat f = Formatter.getCSVFormatter(context);
             return s.replace("$RADIUS", f.format(radius));
         }
+        Object km = context.getContextValue(CURRENT_KM);
+        if (km instanceof Number && s.contains("$KM")) {
+            return s.replace(", $KM", " " + ((Double)km).toString());
+        }
         return s;
     }
 
diff -r a5bd0a5b8efd -r e1ff1263d79a artifacts/src/main/java/org/dive4elements/river/exports/process/FixWQProcessor.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/FixWQProcessor.java	Thu Oct 02 13:57:50 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/FixWQProcessor.java	Thu Oct 02 13:59:20 2014 +0200
@@ -49,6 +49,9 @@
 
     private String I18N_AXIS_LABEL = "chart.discharge.curve.yaxis.label";
 
+    public static final String I18N_SUBTITLE_KM =
+        "chart.subtitle.km";
+
     public FixWQProcessor() {
     }
 
@@ -90,6 +93,10 @@
             || FIX_WQ_LS.equals(facetType)) {
             doWQOut(generator, bundle, theme, visible);
         }
+        generator.addSubtitle(Resources.getMsg(
+                generator.getCallContext().getMeta(),
+                    I18N_SUBTITLE_KM,
+                    new Object[] { "$KM" }));
     }
 
     /** Add sector average points to chart. */


More information about the Dive4Elements-commits mailing list