diff flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java @ 1712:7e19449d7826

#253 Modified the title creation of chart curves - titles will now equal the Facet's description. flys-artifacts/trunk@2984 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 17 Oct 2011 10:47:36 +0000
parents bdb05dc9b763
children eb35570df0e8
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java	Mon Oct 17 08:45:26 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java	Mon Oct 17 10:47:36 2011 +0000
@@ -100,13 +100,15 @@
         Facet        f    = flys.getNativeFacet(facet);
 
         if (name.equals(COMPUTED_DISCHARGE_Q)) {
-            doQOut((WQKms) f.getData(artifact, context), attr, visible);
+            doQOut((WQKms) f.getData(artifact, context), facet, attr, visible);
         }
         else if (name.equals(COMPUTED_DISCHARGE_MAINVALUES_Q)) {
-            doMainValueQAnnotations(f.getData(artifact, context), attr,visible);
+            doMainValueQAnnotations(
+                f.getData(artifact, context), facet, attr,visible);
         }
         else if (name.equals(COMPUTED_DISCHARGE_MAINVALUES_W)) {
-            doMainValueWAnnotations(f.getData(artifact, context), attr,visible);
+            doMainValueWAnnotations(
+                f.getData(artifact, context), facet, attr,visible);
         }
         else {
             logger.warn("Unknown facet type for computed discharge: " + name);
@@ -120,6 +122,7 @@
      */
     protected void doMainValueWAnnotations(
         Object   o,
+        Facet    facet,
         Document theme,
         boolean  visible
     ) {
@@ -127,6 +130,7 @@
 
         FLYSAnnotation fa = (FLYSAnnotation) o;
         fa.setTheme(theme);
+        fa.setLabel(facet.getDescription());
         addAnnotations(fa, visible);
     }
 
@@ -136,6 +140,7 @@
      */
     protected void doMainValueQAnnotations(
         Object   o,
+        Facet    facet,
         Document theme,
         boolean  visible
     ) {
@@ -143,6 +148,7 @@
 
         FLYSAnnotation fa = (FLYSAnnotation) o;
         fa.setTheme(theme);
+        fa.setLabel(facet.getDescription());
         addAnnotations(fa, visible);
     }
 
@@ -152,12 +158,17 @@
      * @param wqkms actual data
      * @param theme theme to use.
      */
-    protected void doQOut(WQKms wqkms, Document theme, boolean visible) {
+    protected void doQOut(
+        WQKms    wqkms,
+        Facet    facet,
+        Document theme,
+        boolean  visible
+    ) {
         int size = wqkms.size();
 
         double[]   res  = new double[3];
 
-        XYSeries series = new StyledXYSeries(getSeriesName(wqkms), theme);
+        XYSeries series = new StyledXYSeries(facet.getDescription(), theme);
         for (int i = 0; i < size; i++) {
             res = wqkms.get(i, res);
             series.add(res[1], res[0]);
@@ -165,21 +176,5 @@
 
         addFirstAxisSeries(series, visible);
     }
-
-
-    /**
-     * Get the series name to display in legend.
-     */
-    protected String getSeriesName(WQKms wqkms) {
-        Object[] args = new Object[] {
-            getRiverName(),
-            wqkms.getName()
-        };
-
-        return msg(
-            "chart.computed.discharge.curve.curve.label",
-            "",
-            args);
-    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org