[PATCH 3 of 4] Add DiagramGenerator doOut function

Wald Commits scm-commit at wald.intevation.org
Mon Sep 23 10:26:20 CEST 2013


# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1379924601 -7200
# Branch generator-refactoring
# Node ID 6563262052abf0ebaa910aad24d8fedf8b7cb3f3
# Parent  c7d8adb91576287c6968dddae216c8d87566ec50
Add DiagramGenerator doOut function

diff -r c7d8adb91576 -r 6563262052ab artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffYearProcessor.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffYearProcessor.java	Mon Sep 23 10:22:52 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffYearProcessor.java	Mon Sep 23 10:23:21 2013 +0200
@@ -17,6 +17,7 @@
 import org.dive4elements.river.artifacts.model.minfo.BedDiffYearResult;
 import org.dive4elements.river.exports.StyledSeriesBuilder;
 import org.dive4elements.river.exports.XYChartGenerator;
+import org.dive4elements.river.exports.DiagramGenerator;
 import org.dive4elements.river.jfree.StyledXYSeries;
 import org.dive4elements.river.themes.ThemeDocument;
 
@@ -31,6 +32,38 @@
 
     @Override
     public void doOut(
+            DiagramGenerator generator,
+            ArtifactAndFacet bundle,
+            ThemeDocument    theme,
+            boolean          visible) {
+        CallContext context = generator.getCallContext();
+        Object data = bundle.getData(context);
+        if (data instanceof BedDiffYearResult) {
+            String facetType = bundle.getFacetName();
+            BedDiffYearResult bData = (BedDiffYearResult) data;
+
+            double[][] points;
+            if (BED_DIFFERENCE_YEAR_HEIGHT1.equals(facetType)) {
+                points = bData.getHeights1Data();
+            } else {
+                points = bData.getHeights2Data();
+            }
+            XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme);
+            StyledSeriesBuilder.addPointsFactorY(series,
+                points,
+                false,
+                GAP_TOLERANCE,
+                100d);
+
+            generator.addAxisSeries(series, axisName, visible);
+
+            return;
+        }
+        logger.error("Can't process " + data.getClass().getName() + " objects");
+    }
+
+    @Override
+    public void doOut(
             XYChartGenerator generator,
             ArtifactAndFacet bundle,
             ThemeDocument theme,


More information about the Dive4elements-commits mailing list