changeset 454:2c0c22e0935d

Added names for discharge curves (at gauges). flys-artifacts/trunk@1950 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 19 May 2011 09:45:29 +0000
parents 5aef92ea71a6
children 7137ef65c17c
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeCurveGenerator.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, 61 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Thu May 19 09:31:47 2011 +0000
+++ b/flys-artifacts/ChangeLog	Thu May 19 09:45:29 2011 +0000
@@ -1,3 +1,15 @@
+2011-05-19  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/DischargeCurveGenerator.java:
+	  The curves will now have names that consist of the gauge name and its
+	  valid time range.
+
+	* 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 i18n strings for the
+	  discharge curves.
+
 2011-05-19	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeCurveGenerator.java	Thu May 19 09:31:47 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeCurveGenerator.java	Thu May 19 09:45:29 2011 +0000
@@ -1,6 +1,7 @@
 package de.intevation.flys.exports;
 
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -14,8 +15,10 @@
 
 import de.intevation.artifacts.Artifact;
 
+import de.intevation.flys.model.DischargeTable;
 import de.intevation.flys.model.Gauge;
 import de.intevation.flys.model.River;
+import de.intevation.flys.model.TimeInterval;
 
 import de.intevation.flys.artifacts.FLYSArtifact;
 import de.intevation.flys.artifacts.model.DischargeTables;
@@ -130,10 +133,45 @@
         DischargeTables dt = new DischargeTables(river.getName(), gaugeNames);
         Map<String, double[][]> gaugeValues = dt.getValues(100d);
 
-        for (String gauge: gaugeNames) {
-            double[][] values = gaugeValues.get(gauge);
-            dataset.addSeries(gauge, values);
+        for (Gauge gauge: filtered) {
+            String gaugeName = gauge.getName();
+
+            double[][] values = gaugeValues.get(gaugeName);
+            dataset.addSeries(getSeriesName(gauge), values);
         }
     }
+
+
+    protected String getSeriesName(Gauge gauge) {
+        List<DischargeTable> dts = gauge.getDischargeTables();
+
+        for (DischargeTable dt: dts) {
+            if (dt.getKind() == 0) {
+                TimeInterval ti = dt.getTimeInterval();
+
+                Date start = ti.getStartTime();
+                Date end   = ti.getStopTime();
+
+                String name  = gauge.getName();
+
+                if (end == null) {
+                    Object[] args = new Object[] { name, start };
+                    return msg(
+                        "chart.discharge.curve.curve.valid.from",
+                        "",
+                        args);
+                }
+                else {
+                    Object[] args = new Object[] { name, start, end };
+                    return msg(
+                        "chart.discharge.curve.curve.valid.range",
+                        "",
+                        args);
+                }
+            }
+        }
+
+        return gauge.getName();
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/resources/messages.properties	Thu May 19 09:31:47 2011 +0000
+++ b/flys-artifacts/src/main/resources/messages.properties	Thu May 19 09:45:29 2011 +0000
@@ -23,6 +23,8 @@
 chart.discharge.curve.title = Discharge Curve
 chart.discharge.curve.xaxis.label = Q [m\u00b3/s]
 chart.discharge.curve.yaxis.label = W [cm]
+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.computed.discharge.curve.yaxis.label = W [NN + m]
--- a/flys-artifacts/src/main/resources/messages_de.properties	Thu May 19 09:31:47 2011 +0000
+++ b/flys-artifacts/src/main/resources/messages_de.properties	Thu May 19 09:45:29 2011 +0000
@@ -23,6 +23,8 @@
 chart.discharge.curve.title = Abflusskurve
 chart.discharge.curve.xaxis.label = Q [m\u00b3/s]
 chart.discharge.curve.yaxis.label = W [cm]
+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.computed.discharge.curve.yaxis.label = W [NN + m]
--- a/flys-artifacts/src/main/resources/messages_de_DE.properties	Thu May 19 09:31:47 2011 +0000
+++ b/flys-artifacts/src/main/resources/messages_de_DE.properties	Thu May 19 09:45:29 2011 +0000
@@ -23,6 +23,8 @@
 chart.discharge.curve.title = Abflusskurve
 chart.discharge.curve.xaxis.label = Q [m\u00b3/s]
 chart.discharge.curve.yaxis.label = W [cm]
+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.computed.discharge.curve.yaxis.label = W [NN + m]
--- a/flys-artifacts/src/main/resources/messages_en.properties	Thu May 19 09:31:47 2011 +0000
+++ b/flys-artifacts/src/main/resources/messages_en.properties	Thu May 19 09:45:29 2011 +0000
@@ -23,6 +23,8 @@
 chart.discharge.curve.title = Discharge Curve
 chart.discharge.curve.xaxis.label = Q [m\u00b3/s]
 chart.discharge.curve.yaxis.label = W [cm]
+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.computed.discharge.curve.yaxis.label = W [NN + m]

http://dive4elements.wald.intevation.org