changeset 8372:cac60032aa7d

merged.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 02 Oct 2014 14:02:57 +0200
parents 676687c3d8f0 (diff) 6e9c01a6e90e (current diff)
children 55b5d6d98d15
files artifacts/doc/conf/generators/discharge-diagrams.xml artifacts/src/main/java/org/dive4elements/river/exports/process/FixWQProcessor.java
diffstat 10 files changed, 29 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/doc/conf/generators/discharge-diagrams.xml	Thu Oct 02 11:49:15 2014 +0200
+++ b/artifacts/doc/conf/generators/discharge-diagrams.xml	Thu Oct 02 14:02:57 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>
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/QSectorFacet.java	Thu Oct 02 11:49:15 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/QSectorFacet.java	Thu Oct 02 14:02:57 2014 +0200
@@ -18,6 +18,8 @@
 import org.dive4elements.artifactdatabase.state.DefaultFacet;
 import org.dive4elements.artifactdatabase.state.Facet;
 
+import static org.dive4elements.river.exports.injector.InjectorConstants.CURRENT_KM;
+
 
 /**
  * Facet to access QSector that where added by user.
@@ -58,12 +60,12 @@
     public Object getData(Artifact artifact, CallContext context) {
         QSectorArtifact qsectorArtifact = (QSectorArtifact) artifact;
         if (qsectorArtifact == null || context == null ||
-            context.getContextValue("currentKm") == null) {
+            context.getContextValue(CURRENT_KM) == null) {
             log.error("No artifact, context or currentKm in QSectorFacet");
             return null;
         }
         double currentKm =
-            ((Double)context.getContextValue("currentKm")).doubleValue();
+            ((Double)context.getContextValue(CURRENT_KM)).doubleValue();
         return qsectorArtifact.getQSectors(currentKm, context);
     }
 
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/WQFacet.java	Thu Oct 02 11:49:15 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/WQFacet.java	Thu Oct 02 14:02:57 2014 +0200
@@ -14,6 +14,7 @@
 import org.dive4elements.artifactdatabase.state.DefaultFacet;
 
 import org.dive4elements.river.artifacts.WQKmsInterpolArtifact;
+import static org.dive4elements.river.exports.injector.InjectorConstants.CURRENT_KM;
 
 /**
  * Facet to show W|Q Values.
@@ -50,7 +51,7 @@
     public Object getData(Artifact artifact, CallContext context) {
         WQKmsInterpolArtifact interpolData =
             (WQKmsInterpolArtifact) artifact;
-        Double currentKm = (Double)context.getContextValue("currentKm");
+        Double currentKm = (Double)context.getContextValue(CURRENT_KM);
         return interpolData.getWQAtKm(currentKm);
     }
 
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixingsFacet.java	Thu Oct 02 11:49:15 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixingsFacet.java	Thu Oct 02 14:02:57 2014 +0200
@@ -12,6 +12,7 @@
 import org.dive4elements.river.artifacts.model.DataFacet;
 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
 
+import static org.dive4elements.river.exports.injector.InjectorConstants.CURRENT_KM;
 /**
  * Facet to access the current Km from the context safely
  *
@@ -20,7 +21,6 @@
 public class FixingsFacet extends DataFacet {
 
     public static final Double INVALID_KM = Double.valueOf(-1d);
-    public static final String CURRENT_KM = "currentKm";
 
     public FixingsFacet() {
     }
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator2.java	Thu Oct 02 11:49:15 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator2.java	Thu Oct 02 14:02:57 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;
     }
 
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/FixWQProcessor.java	Thu Oct 02 11:49:15 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/FixWQProcessor.java	Thu Oct 02 14:02:57 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. */
--- a/artifacts/src/main/resources/messages.properties	Thu Oct 02 11:49:15 2014 +0200
+++ b/artifacts/src/main/resources/messages.properties	Thu Oct 02 14:02:57 2014 +0200
@@ -175,6 +175,7 @@
 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.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}
@@ -363,6 +364,7 @@
 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	Thu Oct 02 11:49:15 2014 +0200
+++ b/artifacts/src/main/resources/messages_de.properties	Thu Oct 02 14:02:57 2014 +0200
@@ -175,6 +175,7 @@
 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.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}
@@ -364,6 +365,7 @@
 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	Thu Oct 02 11:49:15 2014 +0200
+++ b/artifacts/src/main/resources/messages_de_DE.properties	Thu Oct 02 14:02:57 2014 +0200
@@ -174,6 +174,7 @@
 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.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}
@@ -362,6 +363,7 @@
 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	Thu Oct 02 11:49:15 2014 +0200
+++ b/artifacts/src/main/resources/messages_en.properties	Thu Oct 02 14:02:57 2014 +0200
@@ -174,6 +174,7 @@
 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.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}
@@ -365,6 +366,7 @@
 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