changeset 682:591249171c32

#77 The curves in a duration chart will have names now. flys-artifacts/trunk@2115 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 14 Jun 2011 15:34:27 +0000
parents dda282dcc44f
children 8a9456d5a081
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/DurationCurveGenerator.java flys-artifacts/src/main/resources/messages.properties flys-artifacts/src/main/resources/messages_de.properties flys-artifacts/src/main/resources/messages_de_DE.properties flys-artifacts/src/main/resources/messages_en.properties
diffstat 6 files changed, 67 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue Jun 14 13:54:19 2011 +0000
+++ b/flys-artifacts/ChangeLog	Tue Jun 14 15:34:27 2011 +0000
@@ -1,3 +1,16 @@
+2011-06-14  Ingo Weinzierl <ingo@intevation.de>
+
+	  flys/issue77 (Diagramm: Beschriftung der Kurven bei Dauerlinien)
+
+	* src/main/java/de/intevation/flys/exports/DurationCurveGenerator.java:
+	  Give the curves in the chart names.
+
+	* src/main/resources/messages.properties,
+	  src/main/resources/messages_de_DE.properties,
+	  src/main/resources/messages_en.properties,
+	  src/main/resources/messages_de.properties: Added titles for duration
+	  chart curves.
+
 2011-06-14  Sascha L. Teichmann <sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/services/DistanceInfoService.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/DurationCurveGenerator.java	Tue Jun 14 13:54:19 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/DurationCurveGenerator.java	Tue Jun 14 15:34:27 2011 +0000
@@ -16,8 +16,11 @@
 
 import de.intevation.artifacts.Artifact;
 
+import de.intevation.flys.model.River;
+
 import de.intevation.flys.artifacts.WINFOArtifact;
 import de.intevation.flys.artifacts.model.WQDay;
+import de.intevation.flys.artifacts.resources.Resources;
 
 
 /**
@@ -27,6 +30,9 @@
  */
 public class DurationCurveGenerator extends XYChartGenerator {
 
+    public static final String I18N_DURATION_W = "chart.duration.curve.curve.w";
+    public static final String I18N_DURATION_Q = "chart.duration.curve.curve.q";
+
     private static Logger logger =
         Logger.getLogger(DurationCurveGenerator.class);
 
@@ -159,11 +165,14 @@
             return;
         }
 
+        WINFOArtifact winfo = (WINFOArtifact) artifact;
+        River         river = winfo.getRiver();
+
         if (facet.equals(DURATION_CURVE_W)) {
-            doWOut(getDurationCurveData(artifact));
+            doWOut(getDurationCurveData(artifact), river.getName());
         }
         else if (facet.equals(DURATION_CURVE_Q)) {
-            doQOut(getDurationCurveData(artifact));
+            doQOut(getDurationCurveData(artifact), river.getName());
         }
         else {
             logger.warn("Unknown facet name: " + facet);
@@ -176,12 +185,14 @@
      * Creates the series for a duration curve's W facet.
      *
      * @param wqdays The WQDay store that contains the Ws.
+     * @param river The name of the river.
      */
-    protected void doWOut(WQDay wqdays) {
+    protected void doWOut(WQDay wqdays, String river) {
         logger.debug("DurationCurveGenerator.doWOut");
 
         // TODO find the correct series name
-        XYSeries series = new XYSeries("W-1");
+        XYSeries series = new XYSeries(
+            getSeriesName(river, DURATION_CURVE_W));
 
         int size = wqdays.size();
         for (int i = 0; i < size; i++) {
@@ -199,12 +210,14 @@
      * Creates the series for a duration curve's Q facet.
      *
      * @param wqdays The WQDay store that contains the Qs.
+     * @param river The name of the river.
      */
-    protected void doQOut(WQDay wqdays) {
+    protected void doQOut(WQDay wqdays, String river) {
         logger.debug("DurationCurveGenerator.doQOut");
 
         // TODO find the correct series name
-        XYSeries series = new XYSeries("Q-1");
+        XYSeries series = new XYSeries(
+            getSeriesName(river, DURATION_CURVE_Q));
 
         int size = wqdays.size();
         for (int i = 0; i < size; i++) {
@@ -230,5 +243,32 @@
         WINFOArtifact winfoArtifact = (WINFOArtifact) artifact;
         return winfoArtifact.getDurationCurveData();
     }
+
+
+    protected String getSeriesName(String river, String type) {
+        Object[] args = new Object[] { river };
+
+        if (type == null || type.length() == 0) {
+            logger.warn("No duration curve type given.");
+            return "n/a";
+        }
+        else if (type.equals(DURATION_CURVE_W)) {
+            return Resources.getMsg(
+                context.getMeta(),
+                I18N_DURATION_W,
+                "W",
+                args);
+        }
+        else if (type.equals(DURATION_CURVE_Q)) {
+            return Resources.getMsg(
+                context.getMeta(),
+                I18N_DURATION_Q,
+                "W",
+                args);
+        }
+
+        logger.warn("Could not determine chart curve type: " + type);
+        return type;
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/resources/messages.properties	Tue Jun 14 13:54:19 2011 +0000
+++ b/flys-artifacts/src/main/resources/messages.properties	Tue Jun 14 15:34:27 2011 +0000
@@ -33,6 +33,8 @@
 chart.duration.curve.subtitle = {0}-km: {1,number,#.###}
 chart.duration.curve.xaxis.label = Duration of Non-Exceedence [Days]
 chart.duration.curve.yaxis.label = W [NN + m]
+chart.duration.curve.curve.w = Waterlevel duration curve for {0}
+chart.duration.curve.curve.q = Discharge duration curve for {0}
 
 export.waterlevel.csv.header.km = River-Km
 export.waterlevel.csv.header.w = W [NN + m]
--- a/flys-artifacts/src/main/resources/messages_de.properties	Tue Jun 14 13:54:19 2011 +0000
+++ b/flys-artifacts/src/main/resources/messages_de.properties	Tue Jun 14 15:34:27 2011 +0000
@@ -33,6 +33,8 @@
 chart.duration.curve.subtitle = {0}-km: {1,number,#.###}
 chart.duration.curve.xaxis.label = Unterschreitungsdauer [Tage]
 chart.duration.curve.yaxis.label = W [NN + m]
+chart.duration.curve.curve.w = Wasserstandsdauerline f\u00fcr {0}
+chart.duration.curve.curve.q = Abflussdauerline f\u00fcr {0}
 
 export.waterlevel.csv.header.km = Fluss-Km
 export.waterlevel.csv.header.w = W [NN + m]
--- a/flys-artifacts/src/main/resources/messages_de_DE.properties	Tue Jun 14 13:54:19 2011 +0000
+++ b/flys-artifacts/src/main/resources/messages_de_DE.properties	Tue Jun 14 15:34:27 2011 +0000
@@ -33,6 +33,8 @@
 chart.duration.curve.subtitle = {0}-km: {1,number,#.###}
 chart.duration.curve.xaxis.label = Unterschreitungsdauer [Tage]
 chart.duration.curve.yaxis.label = W [NN + m]
+chart.duration.curve.curve.w = Wasserstandsdauerline f\u00fcr {0}
+chart.duration.curve.curve.q = Abflussdauerline f\u00fcr {0}
 
 export.waterlevel.csv.header.km = Fluss-Km
 export.waterlevel.csv.header.w = W [NN + m]
--- a/flys-artifacts/src/main/resources/messages_en.properties	Tue Jun 14 13:54:19 2011 +0000
+++ b/flys-artifacts/src/main/resources/messages_en.properties	Tue Jun 14 15:34:27 2011 +0000
@@ -33,6 +33,8 @@
 chart.duration.curve.subtitle = {0}-km: {1,number,#.###}
 chart.duration.curve.xaxis.label = Duration of Non-Exceedence [Days]
 chart.duration.curve.yaxis.label = W [NN + m]
+chart.duration.curve.curve.w = Waterlevel duration curve for {0}
+chart.duration.curve.curve.q = Discharge duration curve for {0}
 
 export.waterlevel.csv.header.km = River-Km
 export.waterlevel.csv.header.w = W [NN + m]

http://dive4elements.wald.intevation.org