changeset 2574:3598690dc9e2

Fix flys/issue501 (manual points have two legend entries). flys-artifacts/trunk@4105 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 01 Mar 2012 14:52:15 +0000
parents 39145db61317
children 475dd07c2cb1
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java
diffstat 2 files changed, 21 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Thu Mar 01 14:45:36 2012 +0000
+++ b/flys-artifacts/ChangeLog	Thu Mar 01 14:52:15 2012 +0000
@@ -1,3 +1,10 @@
+2012-03-01	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Fix flys/issue501 (manual points have two legend entries).
+
+	* src/main/java/de/intevation/flys/exports/XYChartGenerator.java:
+	  Respect wish to not have a legend entry.
+
 2012-03-01	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	Fix flys/issue636 (cross-section: name of waterlevel facets).
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Thu Mar 01 14:45:36 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Thu Mar 01 14:52:15 2012 +0000
@@ -137,7 +137,8 @@
             this.datasets.add(series);
         }
 
-        /** True if to be renedered as area. */
+        // TODO obsolete?
+        /** True if to be rendered as area. */
         @Override
         public boolean isArea(XYDataset series) {
             return (series instanceof StyledAreaSeriesCollection);
@@ -667,6 +668,7 @@
 
     /**
      * Add a text and a line annotation.
+     * @area convenience to determine positions in plot.
      */
     public void addStickyAnnotation(
         StickyAxisAnnotation annotation,
@@ -958,19 +960,19 @@
     ){
         // Running into trouble here.
         logger.debug("doAnnotations");
-        if (aandf == null) {
-            logger.warn(
-                "Facet for Annotations is null. " +
-                "This should never happen!");
-            return;
-        }
-
-        Facet facet = aandf.getFacet();
 
         // Add all annotations to our annotation pool.
         annotations.setTheme(theme);
-        if (facet != null)
+        if (aandf != null) {
+            Facet facet = aandf.getFacet();
             annotations.setLabel(aandf.getFacetDescription());
+        }
+        else {
+            logger.debug(
+                "Art/Facet for Annotations is null. " +
+                "This should never happen!");
+        }
+
         addAnnotations(annotations, visible);
     }
 
@@ -1014,7 +1016,8 @@
         FLYSAnnotation annotations = new FLYSAnnotation(null, null, null, theme);
         annotations.setTextAnnotations(xy);
 
-        doAnnotations(annotations, aandf, theme, visible);
+        // Do not generate second legend entry. (null was passed for the aand before).
+        doAnnotations(annotations, null, theme, visible);
         addAxisSeries(series, axisIndex, visible);
     }
 

http://dive4elements.wald.intevation.org