[PATCH 4 of 4] Add DiagramGenerator doOut function

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


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

diff -r 6563262052ab -r cdae0ff8960b artifacts/src/main/java/org/dive4elements/river/exports/process/BedheightProcessor.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedheightProcessor.java	Mon Sep 23 10:23:21 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedheightProcessor.java	Mon Sep 23 10:24:47 2013 +0200
@@ -17,6 +17,7 @@
 import org.dive4elements.artifacts.CallContext;
 import org.dive4elements.river.artifacts.model.minfo.BedHeightSingle;
 import org.dive4elements.river.exports.XYChartGenerator;
+import org.dive4elements.river.exports.DiagramGenerator;
 import org.dive4elements.river.jfree.StyledXYSeries;
 import org.dive4elements.river.model.BedHeightSingleValue;
 import org.dive4elements.river.themes.ThemeDocument;
@@ -30,6 +31,38 @@
 
     @Override
     public void doOut(
+            DiagramGenerator generator,
+            ArtifactAndFacet bundle,
+            ThemeDocument    theme,
+            boolean          visible) {
+        CallContext context = generator.getCallContext();
+        Object data = bundle.getData(context);
+        XYSeries series = new StyledXYSeries(bundle.getFacetDescription(),
+                theme);
+        if (data instanceof BedHeightSingle) {
+            BedHeightSingle bData = (BedHeightSingle)data;
+            double[] width = bData.getMorphWidths();
+            double[] stations = bData.getStations().toNativeArray();
+
+            logger.debug("doBedheightSingleOut");
+
+            for (int i = 0; i < width.length; i++) {
+                series.add(stations[i], width[i], false);
+            }
+        } else if (data instanceof List<?>) {
+            List<BedHeightSingleValue> bData = (List<BedHeightSingleValue>)data;
+
+            logger.debug("doBedheightSingleValueOut");
+
+            for(BedHeightSingleValue bvalue: bData) {
+                series.add(bvalue.getStation(), bvalue.getSoundingWidth());
+            }
+        }
+        generator.addAxisSeries(series, axisName, visible);
+    }
+
+    @Override
+    public void doOut(
             XYChartGenerator generator,
             ArtifactAndFacet bundle,
             ThemeDocument theme,


More information about the Dive4elements-commits mailing list