changeset 2006:5aecebcc4698

Add area dataseries when facet delivers one. flys-artifacts/trunk@3448 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 16 Dec 2011 14:48:14 +0000
parents 79b15491177a
children 70901aef9a8b
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java
diffstat 2 files changed, 33 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Dec 16 14:42:10 2011 +0000
+++ b/flys-artifacts/ChangeLog	Fri Dec 16 14:48:14 2011 +0000
@@ -1,3 +1,11 @@
+2011-12-16	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Add area dataseries when facet delivering one.
+
+	* src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java
+	  (doOut): Handle area facets.
+	  (doArea): Register areas for area facets.
+
 2011-12-16	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	Add simple area registerig functions.
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java	Fri Dec 16 14:42:10 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java	Fri Dec 16 14:48:14 2011 +0000
@@ -148,12 +148,37 @@
                 attr,
                 visible);
         }
+        else if (name.equals(AREA)) {
+            doArea(artifactFacet.getData(context),
+                artifactFacet.getFacetDescription(),
+                attr,
+                visible);
+        }
         else {
             logger.warn("CrossSection.doOut: Unknown facet name: " + name);
             return;
         }
     }
 
+    /**
+     * Do Area out.
+     */
+    protected void doArea(
+        Object     o,
+        String     seriesName,
+        Document   theme,
+        boolean    visible
+    ) {
+        logger.debug("CrossSectionGenerator.doArea");
+
+        // TODO make this more stable.
+        Object[] doubles = (Object[]) o;
+        XYSeries up   = new StyledXYSeries("up",   false, theme);
+        XYSeries down = new StyledXYSeries("down", false, theme);
+        StyledSeriesBuilder.addPoints(up,   (double [][]) doubles[0]);
+        StyledSeriesBuilder.addPoints(down, (double [][]) doubles[1]);
+        addAreaSeries(up, down, 0, visible);
+    }
 
     /**
      * Do cross sections waterline out.

http://dive4elements.wald.intevation.org