changeset 8387:8c60595fd74c

Unify discharge curve subtitles.
author Tom Gottfried <tom@intevation.de>
date Tue, 07 Oct 2014 15:23:08 +0200
parents a9d493aba926
children 5b3a2908a346
files artifacts/doc/conf/generators/discharge-diagrams.xml artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator2.java artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java artifacts/src/main/java/org/dive4elements/river/exports/injector/KmFromGaugeNameInjector.java artifacts/src/main/java/org/dive4elements/river/exports/process/FixDerivedProcessor.java artifacts/src/main/java/org/dive4elements/river/exports/process/FixWQProcessor.java artifacts/src/main/resources/messages.properties artifacts/src/main/resources/messages_de.properties artifacts/src/main/resources/messages_de_DE.properties artifacts/src/main/resources/messages_en.properties
diffstat 10 files changed, 18 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/doc/conf/generators/discharge-diagrams.xml	Tue Oct 07 13:41:54 2014 +0200
+++ b/artifacts/doc/conf/generators/discharge-diagrams.xml	Tue Oct 07 15:23:08 2014 +0200
@@ -6,6 +6,9 @@
       converter="org.dive4elements.river.exports.DiagramAttributes"
       injectors="org.dive4elements.river.exports.injector.KmFromGaugeNumberInjector,org.dive4elements.river.exports.injector.PNPInjector">
     <title key="chart.historical.discharge.title" default="chart.historical.discharge.title"/>
+    <subtitle key="chart.discharge.curve.subtitle" default="-">
+        <arg expr="artifact.river"/>
+    </subtitle>
     &discharge-defaults;
   </output-generator>
 
@@ -14,9 +17,8 @@
       converter="org.dive4elements.river.exports.DiagramAttributes"
       injectors="org.dive4elements.river.exports.injector.KmFromLocationInjector,org.dive4elements.river.exports.injector.PNPInjector">
     <title key="chart.computed.discharge.curve.title" default="chart.computed.discharge.curve.title"/>
-    <subtitle key="chart.computed.discharge.curve.subtitle" default="-">
+    <subtitle key="chart.discharge.curve.subtitle" default="-">
         <arg expr="artifact.river"/>
-        <arg expr="artifact.ld_locations" type="double"/>
     </subtitle>
     &discharge-defaults;
   </output-generator>
@@ -26,9 +28,8 @@
       converter="org.dive4elements.river.exports.DiagramAttributes"
       injectors="org.dive4elements.river.exports.injector.KmFromGaugeNameInjector,org.dive4elements.river.exports.injector.PNPInjector">
     <title key="chart.discharge.curve.title" default="chart.discharge.curve.title"/>
-    <subtitle key="chart.computed.discharge.curve.subtitle" default="-">
+    <subtitle key="chart.discharge.curve.subtitle" default="-">
         <arg expr="artifact.river"/>
-        <arg expr="artifact.ld_locations" type="double"/>
     </subtitle>
     &discharge-defaults;
   </output-generator>
@@ -38,7 +39,7 @@
       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.fix.discharge.curve.subtitle" default="-">
+    <subtitle key="chart.discharge.curve.subtitle" default="-">
         <arg expr="artifact.river"/>
     </subtitle>
     &discharge-defaults;
@@ -49,7 +50,7 @@
       injectors="org.dive4elements.river.exports.injector.KmFromRequestInjector,org.dive4elements.river.exports.injector.PNPInjector"
       converter="org.dive4elements.river.exports.DiagramAttributes">
     <title key="chart.fixings.derivedcurve.title" default="-"/>
-    <subtitle key="chart.fix.discharge.curve.subtitle" default="-">
+    <subtitle key="chart.discharge.curve.subtitle" default="-">
         <arg expr="artifact.river"/>
     </subtitle>
     &discharge-defaults;
@@ -60,6 +61,9 @@
       injectors="org.dive4elements.river.exports.injector.PNPInjector"
       converter="org.dive4elements.river.exports.DiagramAttributes">
     <title key="chart.vollmer.discharge.curve.title" default="chart.vollmer.discharge.curve.title"/>
+    <subtitle key="chart.discharge.curve.subtitle" default="-">
+        <arg expr="artifact.river"/>
+    </subtitle>
     &discharge-defaults;
   </output-generator>
 
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator2.java	Tue Oct 07 13:41:54 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator2.java	Tue Oct 07 15:23:08 2014 +0200
@@ -667,7 +667,8 @@
         }
         Object km = context.getContextValue(CURRENT_KM);
         if (km instanceof Number && s.contains("$KM")) {
-            return s.replace(", $KM", " " + ((Double)km).toString());
+            NumberFormat f = Formatter.getCalculationKm(context.getMeta());
+            return s.replace("$KM", f.format(km));
         }
         return s;
     }
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java	Tue Oct 07 13:41:54 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java	Tue Oct 07 15:23:08 2014 +0200
@@ -49,9 +49,6 @@
     public static final String I18N_CHART_TITLE =
         "chart.computed.discharge.curve.title";
 
-    public static final String I18N_CHART_SUBTITLE =
-        "chart.computed.discharge.curve.subtitle";
-
     public static final String I18N_YAXIS_LABEL =
         "chart.computed.discharge.curve.yaxis.label";
 
@@ -71,20 +68,6 @@
 
 
     @Override
-    protected String getDefaultChartSubtitle() {
-        double[] dist = getRange();
-
-        Object[] args = new Object[] {
-            getRiverName(),
-            dist[0]
-        };
-
-        return msg(I18N_CHART_SUBTITLE, "", args);
-    }
-
-
-
-    @Override
     protected String getDefaultYAxisLabel(int pos) {
         D4EArtifact flys = (D4EArtifact) master;
 
--- a/artifacts/src/main/java/org/dive4elements/river/exports/injector/KmFromGaugeNameInjector.java	Tue Oct 07 13:41:54 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/injector/KmFromGaugeNameInjector.java	Tue Oct 07 15:23:08 2014 +0200
@@ -40,7 +40,7 @@
             log.error("No Gauge could be found for name " + name + "!");
             return;
         }
-        ctx.putContextValue(CURRENT_KM, gauge.getStation());
+        ctx.putContextValue(CURRENT_KM, gauge.getStation().doubleValue());
         return;
     }
 
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/FixDerivedProcessor.java	Tue Oct 07 13:41:54 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/FixDerivedProcessor.java	Tue Oct 07 15:23:08 2014 +0200
@@ -29,8 +29,6 @@
 
     private String I18N_AXIS_LABEL = "chart.discharge.curve.yaxis.label";
 
-    private static final String I18N_SUBTITLE_KM = "chart.subtitle.km";
-
 
     public FixDerivedProcessor() {
     }
@@ -71,10 +69,6 @@
             series.putMetaData(metaData, bundle.getArtifact(), context);
         }
 
-        generator.addSubtitle(Resources.getMsg(
-            generator.getCallContext().getMeta(),
-                I18N_SUBTITLE_KM,
-                new Object[] { "$KM" }));
     }
 
     @Override
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/FixWQProcessor.java	Tue Oct 07 13:41:54 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/FixWQProcessor.java	Tue Oct 07 15:23:08 2014 +0200
@@ -49,8 +49,6 @@
 
     private String I18N_AXIS_LABEL = "chart.discharge.curve.yaxis.label";
 
-    public static final String I18N_SUBTITLE_KM =
-        "chart.subtitle.km";
 
     public FixWQProcessor() {
     }
@@ -93,10 +91,7 @@
             || 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. */
--- a/artifacts/src/main/resources/messages.properties	Tue Oct 07 13:41:54 2014 +0200
+++ b/artifacts/src/main/resources/messages.properties	Tue Oct 07 15:23:08 2014 +0200
@@ -174,8 +174,7 @@
 chart.discharge.curve.curve.valid.from = {0} (valid from {1,date,short})
 chart.discharge.curve.curve.valid.range = {0} (valid from {1,date,short} - {2,date,short})
 chart.computed.discharge.curve.title = Discharge Curve
-chart.computed.discharge.curve.subtitle = {0}-km: {1,number,#.###}
-chart.fix.discharge.curve.subtitle = {0}-km:
+chart.discharge.curve.subtitle = {0}-km: $KM
 chart.computed.discharge.curve.yaxis.label = W [{0}]
 chart.computed.discharge.curve.curve.label = Discharge Curve {0} km {1}
 chart.computed.discharge.curve.gauge = current DC {0} {1} - {2}
@@ -364,7 +363,6 @@
 chart.beddifference.yaxis.label.morph = Width [m]
 chart.beddifference.yaxis.label.heights = Absolute Height [{0}]
 chart.subtitle.radius = Width of sample window for moving average: {0} km
-chart.subtitle.km = {0}
 
 export.csv.header.km = km
 export.csv.header.year = year
--- a/artifacts/src/main/resources/messages_de.properties	Tue Oct 07 13:41:54 2014 +0200
+++ b/artifacts/src/main/resources/messages_de.properties	Tue Oct 07 15:23:08 2014 +0200
@@ -174,8 +174,7 @@
 chart.discharge.curve.curve.valid.from = {0} (g\u00fcltig ab {1,date,medium})
 chart.discharge.curve.curve.valid.range = {0} (g\u00fcltig ab {1,date,medium} - {2,date,medium})
 chart.computed.discharge.curve.title = Abflusskurve
-chart.computed.discharge.curve.subtitle = {0}-km: {1,number,#.###}
-chart.fix.discharge.curve.subtitle = {0}-km:
+chart.discharge.curve.subtitle = {0}-km: $KM
 chart.computed.discharge.curve.yaxis.label = W [{0}]
 chart.computed.discharge.curve.curve.label = Abflusskurve {0} km {1}
 chart.computed.discharge.curve.gauge = aktuelle AT {0} {1} - {2}
@@ -365,7 +364,6 @@
 chart.beddifference.yaxis.label.morph = Breite [m]
 chart.beddifference.yaxis.label.heights = Absolute H\u00f6he [m]
 chart.subtitle.radius = Fensterbreite f\u00fcr gleitenden Mittelwert: {0} km
-chart.subtitle.km = {0}
 
 export.csv.header.km = km
 export.csv.header.year = Jahr
--- a/artifacts/src/main/resources/messages_de_DE.properties	Tue Oct 07 13:41:54 2014 +0200
+++ b/artifacts/src/main/resources/messages_de_DE.properties	Tue Oct 07 15:23:08 2014 +0200
@@ -173,8 +173,7 @@
 chart.discharge.curve.curve.valid.from = {0} (g\u00fcltig ab {1,date,medium})
 chart.discharge.curve.curve.valid.range = {0} (g\u00fcltig ab {1,date,medium} - {2,date,medium})
 chart.computed.discharge.curve.title = Abflusskurve
-chart.computed.discharge.curve.subtitle = {0}-km: {1,number,#.###}
-chart.fix.discharge.curve.subtitle = {0}-km:
+chart.discharge.curve.subtitle = {0}-km: $KM
 chart.computed.discharge.curve.yaxis.label = W [{0}]
 chart.computed.discharge.curve.curve.label = Abflusskurve {0} km {1}
 chart.computed.discharge.curve.gauge = aktuelle AT {0} {1} - {2}
@@ -363,7 +362,6 @@
 chart.beddifference.yaxis.label.morph = Breite [m]
 chart.beddifference.yaxis.label.heights = Absolute H\u00f6he [{0}]
 chart.subtitle.radius = Fensterbreite f\u00fcr gleitenden Mittelwert: {0} km
-chart.subtitle.km = {0}
 
 export.csv.header.km = km
 export.csv.header.year = Jahr
--- a/artifacts/src/main/resources/messages_en.properties	Tue Oct 07 13:41:54 2014 +0200
+++ b/artifacts/src/main/resources/messages_en.properties	Tue Oct 07 15:23:08 2014 +0200
@@ -173,8 +173,7 @@
 chart.discharge.curve.curve.valid.from = {0} (valid from {1,date,short})
 chart.discharge.curve.curve.valid.range = {0} (valid from {1,date,short} - {2,date,short})
 chart.computed.discharge.curve.title = Discharge Curve
-chart.computed.discharge.curve.subtitle = {0}-km: {1,number,#.###}
-chart.fix.discharge.curve.subtitle = {0}-km:
+chart.discharge.curve.subtitle = {0}-km: $KM
 chart.computed.discharge.curve.yaxis.label = W [{0}]
 chart.computed.discharge.curve.curve.label = Discharge Curve {0} km {1}
 chart.computed.discharge.curve.gauge = current DC {0} {1} - {2}
@@ -366,7 +365,6 @@
 chart.beddifference.yaxis.label.morph = Width [m]
 chart.beddifference.yaxis.label.heights = Absolute Height [m]
 chart.subtitle.radius = Radius for weighted Average: {0} km
-chart.subtitle.km = {0}
 
 export.csv.header.km = km
 export.csv.header.year = year

http://dive4elements.wald.intevation.org