changeset 7985:10debf4b82be facet-metadata

Split bed differences facet into data specific facets.
author Raimund Renkert <rrenkert@intevation.de>
date Tue, 01 Jul 2014 15:09:56 +0200
parents cf674b03901a
children b0cee7dfd6fe
files artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffFilterFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffHeightMinFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffHeightMinFilterFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffHeightSubFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffHeightSubFilterFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffMorphMinFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffMorphSubFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffPerYearFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffPerYearFilterFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffSoundingWidthFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffYearFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffYearFilterFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/DifferencesState.java artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffHeightYearProcessor.java artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffYearProcessor.java artifacts/src/main/java/org/dive4elements/river/exports/process/BedWidthProcessor.java
diffstat 17 files changed, 824 insertions(+), 246 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffFacet.java	Tue Jul 01 15:09:56 2014 +0200
@@ -0,0 +1,66 @@
+/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+
+package org.dive4elements.river.artifacts.model.minfo;
+
+import org.apache.log4j.Logger;
+
+import org.dive4elements.artifactdatabase.state.Facet;
+import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.model.CalculationResult;
+import org.dive4elements.river.artifacts.model.DataFacet;
+import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
+
+
+public class BedDiffFacet
+extends DataFacet
+{
+    private static Logger logger = Logger.getLogger(BedDiffFacet.class);
+
+    public BedDiffFacet() {
+    }
+
+    public BedDiffFacet(int idx, String name, String description,
+        ComputeType type, String stateId, String hash) {
+        super(idx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.beddifference.axis.label.y");
+    }
+
+    public Object getData(Artifact artifact, CallContext context) {
+        logger.debug("Get data for bed density at index: " + index);
+
+        D4EArtifact flys = (D4EArtifact) artifact;
+
+        CalculationResult res = (CalculationResult) flys.compute(context, hash,
+            stateId, type, false);
+
+        BedDiffYearResult[] resultData =
+            (BedDiffYearResult[]) res.getData(); // TODO CAST TO SPECIFIC CLASS
+
+        if (resultData != null && resultData.length > index) {
+            BedDiffYearResult data = resultData[index];
+            return data.getDifferencesData();
+        }
+        return null;
+    }
+
+    /** Copy deeply. */
+    @Override
+    public Facet deepCopy() {
+        BedDiffFacet copy = new BedDiffFacet();
+        copy.set(this);
+        copy.type = type;
+        copy.hash = hash;
+        copy.stateId = stateId;
+        return copy;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffFilterFacet.java	Tue Jul 01 15:09:56 2014 +0200
@@ -0,0 +1,79 @@
+/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+
+package org.dive4elements.river.artifacts.model.minfo;
+
+import org.apache.log4j.Logger;
+
+import org.dive4elements.artifactdatabase.state.Facet;
+import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.access.RiverAccess;
+import org.dive4elements.river.artifacts.context.RiverContext;
+import org.dive4elements.river.artifacts.model.CalculationResult;
+import org.dive4elements.river.artifacts.model.DataFacet;
+import org.dive4elements.river.artifacts.math.MovingAverage;
+import org.dive4elements.river.artifacts.model.ZoomScale;
+import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
+
+
+public class BedDiffFilterFacet
+extends DataFacet
+{
+    private static Logger logger = Logger.getLogger(BedDiffFilterFacet.class);
+
+    public BedDiffFilterFacet() {
+    }
+
+    public BedDiffFilterFacet(int idx, String name, String description,
+        ComputeType type, String stateId, String hash) {
+        super(idx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.beddifference.height.yaxis.label");
+    }
+
+    public Object getData(Artifact artifact, CallContext context) {
+        logger.debug("Get data for bed density at index: " + index);
+
+        D4EArtifact flys = (D4EArtifact) artifact;
+
+        CalculationResult res = (CalculationResult) flys.compute(context, hash,
+            stateId, type, false);
+
+        BedDiffYearResult[] data =
+            (BedDiffYearResult[]) res.getData(); // TODO CAST TO SPECIFIC CLASS
+        Double start = (Double)context.getContextValue("startkm");
+        Double end = (Double)context.getContextValue("endkm");
+        if(start != null && end != null) {
+            RiverContext fc = (RiverContext)context.globalContext();
+            // Adaptive smoothing, based on zoom factor/diagram extents.
+            ZoomScale scales = (ZoomScale)fc.get("zoomscale");
+            RiverAccess access = new RiverAccess((D4EArtifact)artifact);
+            String river = access.getRiverName();
+
+            double radius = scales.getRadius(river, start, end);
+            BedDiffYearResult oldData = data[index];
+            double[][] diffs = MovingAverage.weighted(oldData.getDifferencesData(), radius);
+            return diffs;
+        }
+        return null;
+    }
+
+    /** Copy deeply. */
+    @Override
+    public Facet deepCopy() {
+        BedDiffFilterFacet copy = new BedDiffFilterFacet();
+        copy.set(this);
+        copy.type = type;
+        copy.hash = hash;
+        copy.stateId = stateId;
+        return copy;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffHeightMinFacet.java	Tue Jul 01 15:09:56 2014 +0200
@@ -0,0 +1,58 @@
+package org.dive4elements.river.artifacts.model.minfo;
+
+import org.apache.log4j.Logger;
+import org.dive4elements.artifactdatabase.state.Facet;
+import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.model.CalculationResult;
+import org.dive4elements.river.artifacts.model.DataFacet;
+import org.dive4elements.river.artifacts.model.FacetTypes;
+import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
+
+
+public class BedDiffHeightMinFacet
+extends DataFacet
+implements FacetTypes
+{
+    private static Logger logger = Logger.getLogger(BedDiffHeightMinFacet.class);
+
+    public BedDiffHeightMinFacet() {
+    }
+
+    public BedDiffHeightMinFacet(int idx, String name, String description,
+        ComputeType type, String stateId, String hash) {
+        super(idx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.beddifference.axis.label.y");
+    }
+
+    public Object getData(Artifact artifact, CallContext context) {
+        logger.debug("Get data for bed density at index: " + index);
+
+        D4EArtifact flys = (D4EArtifact) artifact;
+
+        CalculationResult res = (CalculationResult) flys.compute(context, hash,
+            stateId, type, false);
+
+        BedDiffYearResult[] resultData =
+            (BedDiffYearResult[]) res.getData(); // TODO CAST TO SPECIFIC CLASS
+
+        if (resultData != null && resultData.length > index) {
+            BedDiffYearResult data = resultData[index];
+            return data.getHeights1Data();
+        }
+        return null;
+    }
+
+    /** Copy deeply. */
+    @Override
+    public Facet deepCopy() {
+        BedDiffHeightMinFacet copy = new BedDiffHeightMinFacet();
+        copy.set(this);
+        copy.type = type;
+        copy.hash = hash;
+        copy.stateId = stateId;
+        return copy;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffHeightMinFilterFacet.java	Tue Jul 01 15:09:56 2014 +0200
@@ -0,0 +1,79 @@
+/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+
+package org.dive4elements.river.artifacts.model.minfo;
+
+import org.apache.log4j.Logger;
+
+import org.dive4elements.artifactdatabase.state.Facet;
+import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.access.RiverAccess;
+import org.dive4elements.river.artifacts.context.RiverContext;
+import org.dive4elements.river.artifacts.model.CalculationResult;
+import org.dive4elements.river.artifacts.model.DataFacet;
+import org.dive4elements.river.artifacts.math.MovingAverage;
+import org.dive4elements.river.artifacts.model.ZoomScale;
+import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
+
+
+public class BedDiffHeightMinFilterFacet
+extends DataFacet
+{
+    private static Logger logger = Logger.getLogger(BedDiffHeightMinFilterFacet.class);
+
+    public BedDiffHeightMinFilterFacet() {
+    }
+
+    public BedDiffHeightMinFilterFacet(int idx, String name, String description,
+        ComputeType type, String stateId, String hash) {
+        super(idx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.beddifference.height.yaxis.label");
+    }
+
+    public Object getData(Artifact artifact, CallContext context) {
+        logger.debug("Get data for bed density at index: " + index);
+
+        D4EArtifact flys = (D4EArtifact) artifact;
+
+        CalculationResult res = (CalculationResult) flys.compute(context, hash,
+            stateId, type, false);
+
+        BedDiffYearResult[] data =
+            (BedDiffYearResult[]) res.getData(); // TODO CAST TO SPECIFIC CLASS
+        Double start = (Double)context.getContextValue("startkm");
+        Double end = (Double)context.getContextValue("endkm");
+        if(start != null && end != null) {
+            RiverContext fc = (RiverContext)context.globalContext();
+            // Adaptive smoothing, based on zoom factor/diagram extents.
+            ZoomScale scales = (ZoomScale)fc.get("zoomscale");
+            RiverAccess access = new RiverAccess((D4EArtifact)artifact);
+            String river = access.getRiverName();
+
+            double radius = scales.getRadius(river, start, end);
+            BedDiffYearResult oldData = data[index];
+            double[][] heights = MovingAverage.weighted(oldData.getHeights1Data(), radius);
+            return heights;
+        }
+        return null;
+    }
+
+    /** Copy deeply. */
+    @Override
+    public Facet deepCopy() {
+        BedDiffHeightMinFilterFacet copy = new BedDiffHeightMinFilterFacet();
+        copy.set(this);
+        copy.type = type;
+        copy.hash = hash;
+        copy.stateId = stateId;
+        return copy;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffHeightSubFacet.java	Tue Jul 01 15:09:56 2014 +0200
@@ -0,0 +1,58 @@
+package org.dive4elements.river.artifacts.model.minfo;
+
+import org.apache.log4j.Logger;
+import org.dive4elements.artifactdatabase.state.Facet;
+import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.model.CalculationResult;
+import org.dive4elements.river.artifacts.model.DataFacet;
+import org.dive4elements.river.artifacts.model.FacetTypes;
+import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
+
+
+public class BedDiffHeightSubFacet
+extends DataFacet
+implements FacetTypes
+{
+    private static Logger logger = Logger.getLogger(BedDiffHeightSubFacet.class);
+
+    public BedDiffHeightSubFacet() {
+    }
+
+    public BedDiffHeightSubFacet(int idx, String name, String description,
+        ComputeType type, String stateId, String hash) {
+        super(idx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.beddifference.axis.label.y");
+    }
+
+    public Object getData(Artifact artifact, CallContext context) {
+        logger.debug("Get data for bed density at index: " + index);
+
+        D4EArtifact flys = (D4EArtifact) artifact;
+
+        CalculationResult res = (CalculationResult) flys.compute(context, hash,
+            stateId, type, false);
+
+        BedDiffYearResult[] resultData =
+            (BedDiffYearResult[]) res.getData(); // TODO CAST TO SPECIFIC CLASS
+
+        if (resultData != null && resultData.length > index) {
+            BedDiffYearResult data = resultData[index];
+            return data.getHeights2Data();
+        }
+        return null;
+    }
+
+    /** Copy deeply. */
+    @Override
+    public Facet deepCopy() {
+        BedDiffHeightSubFacet copy = new BedDiffHeightSubFacet();
+        copy.set(this);
+        copy.type = type;
+        copy.hash = hash;
+        copy.stateId = stateId;
+        return copy;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffHeightSubFilterFacet.java	Tue Jul 01 15:09:56 2014 +0200
@@ -0,0 +1,79 @@
+/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+
+package org.dive4elements.river.artifacts.model.minfo;
+
+import org.apache.log4j.Logger;
+
+import org.dive4elements.artifactdatabase.state.Facet;
+import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.access.RiverAccess;
+import org.dive4elements.river.artifacts.context.RiverContext;
+import org.dive4elements.river.artifacts.model.CalculationResult;
+import org.dive4elements.river.artifacts.model.DataFacet;
+import org.dive4elements.river.artifacts.math.MovingAverage;
+import org.dive4elements.river.artifacts.model.ZoomScale;
+import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
+
+
+public class BedDiffHeightSubFilterFacet
+extends DataFacet
+{
+    private static Logger logger = Logger.getLogger(BedDiffHeightSubFilterFacet.class);
+
+    public BedDiffHeightSubFilterFacet() {
+    }
+
+    public BedDiffHeightSubFilterFacet(int idx, String name, String description,
+        ComputeType type, String stateId, String hash) {
+        super(idx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.beddifference.height.yaxis.label");
+    }
+
+    public Object getData(Artifact artifact, CallContext context) {
+        logger.debug("Get data for bed density at index: " + index);
+
+        D4EArtifact flys = (D4EArtifact) artifact;
+
+        CalculationResult res = (CalculationResult) flys.compute(context, hash,
+            stateId, type, false);
+
+        BedDiffYearResult[] data =
+            (BedDiffYearResult[]) res.getData(); // TODO CAST TO SPECIFIC CLASS
+        Double start = (Double)context.getContextValue("startkm");
+        Double end = (Double)context.getContextValue("endkm");
+        if(start != null && end != null) {
+            RiverContext fc = (RiverContext)context.globalContext();
+            // Adaptive smoothing, based on zoom factor/diagram extents.
+            ZoomScale scales = (ZoomScale)fc.get("zoomscale");
+            RiverAccess access = new RiverAccess((D4EArtifact)artifact);
+            String river = access.getRiverName();
+
+            double radius = scales.getRadius(river, start, end);
+            BedDiffYearResult oldData = data[index];
+            double[][] heights = MovingAverage.weighted(oldData.getHeights2Data(), radius);
+            return heights;
+        }
+        return null;
+    }
+
+    /** Copy deeply. */
+    @Override
+    public Facet deepCopy() {
+        BedDiffHeightSubFilterFacet copy = new BedDiffHeightSubFilterFacet();
+        copy.set(this);
+        copy.type = type;
+        copy.hash = hash;
+        copy.stateId = stateId;
+        return copy;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffMorphMinFacet.java	Tue Jul 01 15:09:56 2014 +0200
@@ -0,0 +1,58 @@
+package org.dive4elements.river.artifacts.model.minfo;
+
+import org.apache.log4j.Logger;
+import org.dive4elements.artifactdatabase.state.Facet;
+import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.model.CalculationResult;
+import org.dive4elements.river.artifacts.model.DataFacet;
+import org.dive4elements.river.artifacts.model.FacetTypes;
+import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
+
+
+public class BedDiffMorphMinFacet
+extends DataFacet
+implements FacetTypes
+{
+    private static Logger logger = Logger.getLogger(BedDiffMorphMinFacet.class);
+
+    public BedDiffMorphMinFacet() {
+    }
+
+    public BedDiffMorphMinFacet(int idx, String name, String description,
+        ComputeType type, String stateId, String hash) {
+        super(idx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.beddifference.axis.label.y");
+    }
+
+    public Object getData(Artifact artifact, CallContext context) {
+        logger.debug("Get data for bed density at index: " + index);
+
+        D4EArtifact flys = (D4EArtifact) artifact;
+
+        CalculationResult res = (CalculationResult) flys.compute(context, hash,
+            stateId, type, false);
+
+        BedDiffYearResult[] resultData =
+            (BedDiffYearResult[]) res.getData(); // TODO CAST TO SPECIFIC CLASS
+
+        if (resultData != null && resultData.length > index) {
+            BedDiffYearResult data = resultData[index];
+            return data.getMorphWidth1Data();
+        }
+        return null;
+    }
+
+    /** Copy deeply. */
+    @Override
+    public Facet deepCopy() {
+        BedDiffMorphMinFacet copy = new BedDiffMorphMinFacet();
+        copy.set(this);
+        copy.type = type;
+        copy.hash = hash;
+        copy.stateId = stateId;
+        return copy;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffMorphSubFacet.java	Tue Jul 01 15:09:56 2014 +0200
@@ -0,0 +1,58 @@
+package org.dive4elements.river.artifacts.model.minfo;
+
+import org.apache.log4j.Logger;
+import org.dive4elements.artifactdatabase.state.Facet;
+import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.model.CalculationResult;
+import org.dive4elements.river.artifacts.model.DataFacet;
+import org.dive4elements.river.artifacts.model.FacetTypes;
+import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
+
+
+public class BedDiffMorphSubFacet
+extends DataFacet
+implements FacetTypes
+{
+    private static Logger logger = Logger.getLogger(BedDiffMorphSubFacet.class);
+
+    public BedDiffMorphSubFacet() {
+    }
+
+    public BedDiffMorphSubFacet(int idx, String name, String description,
+        ComputeType type, String stateId, String hash) {
+        super(idx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.beddifference.axis.label.y");
+    }
+
+    public Object getData(Artifact artifact, CallContext context) {
+        logger.debug("Get data for bed density at index: " + index);
+
+        D4EArtifact flys = (D4EArtifact) artifact;
+
+        CalculationResult res = (CalculationResult) flys.compute(context, hash,
+            stateId, type, false);
+
+        BedDiffYearResult[] resultData =
+            (BedDiffYearResult[]) res.getData(); // TODO CAST TO SPECIFIC CLASS
+
+        if (resultData != null && resultData.length > index) {
+            BedDiffYearResult data = resultData[index];
+            return data.getMorphWidth2Data();
+        }
+        return null;
+    }
+
+    /** Copy deeply. */
+    @Override
+    public Facet deepCopy() {
+        BedDiffMorphSubFacet copy = new BedDiffMorphSubFacet();
+        copy.set(this);
+        copy.type = type;
+        copy.hash = hash;
+        copy.stateId = stateId;
+        return copy;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffPerYearFacet.java	Tue Jul 01 15:09:56 2014 +0200
@@ -0,0 +1,58 @@
+package org.dive4elements.river.artifacts.model.minfo;
+
+import org.apache.log4j.Logger;
+import org.dive4elements.artifactdatabase.state.Facet;
+import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.model.CalculationResult;
+import org.dive4elements.river.artifacts.model.DataFacet;
+import org.dive4elements.river.artifacts.model.FacetTypes;
+import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
+
+
+public class BedDiffPerYearFacet
+extends DataFacet
+implements FacetTypes
+{
+    private static Logger logger = Logger.getLogger(BedDiffPerYearFacet.class);
+
+    public BedDiffPerYearFacet() {
+    }
+
+    public BedDiffPerYearFacet(int idx, String name, String description,
+        ComputeType type, String stateId, String hash) {
+        super(idx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.beddifference.axis.label.y");
+    }
+
+    public Object getData(Artifact artifact, CallContext context) {
+        logger.debug("Get data for bed density at index: " + index);
+
+        D4EArtifact flys = (D4EArtifact) artifact;
+
+        CalculationResult res = (CalculationResult) flys.compute(context, hash,
+            stateId, type, false);
+
+        BedDiffYearResult[] resultData =
+            (BedDiffYearResult[]) res.getData(); // TODO CAST TO SPECIFIC CLASS
+
+        if (resultData != null && resultData.length > index) {
+            BedDiffYearResult data = resultData[index];
+            return data.getHeightPerYearData();
+        }
+        return null;
+    }
+
+    /** Copy deeply. */
+    @Override
+    public Facet deepCopy() {
+        BedDiffPerYearFacet copy = new BedDiffPerYearFacet();
+        copy.set(this);
+        copy.type = type;
+        copy.hash = hash;
+        copy.stateId = stateId;
+        return copy;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffPerYearFilterFacet.java	Tue Jul 01 15:09:56 2014 +0200
@@ -0,0 +1,79 @@
+/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+
+package org.dive4elements.river.artifacts.model.minfo;
+
+import org.apache.log4j.Logger;
+
+import org.dive4elements.artifactdatabase.state.Facet;
+import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.access.RiverAccess;
+import org.dive4elements.river.artifacts.context.RiverContext;
+import org.dive4elements.river.artifacts.model.CalculationResult;
+import org.dive4elements.river.artifacts.model.DataFacet;
+import org.dive4elements.river.artifacts.math.MovingAverage;
+import org.dive4elements.river.artifacts.model.ZoomScale;
+import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
+
+
+public class BedDiffPerYearFilterFacet
+extends DataFacet
+{
+    private static Logger logger = Logger.getLogger(BedDiffPerYearFilterFacet.class);
+
+    public BedDiffPerYearFilterFacet() {
+    }
+
+    public BedDiffPerYearFilterFacet(int idx, String name, String description,
+        ComputeType type, String stateId, String hash) {
+        super(idx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.beddifference.height.yaxis.label");
+    }
+
+    public Object getData(Artifact artifact, CallContext context) {
+        logger.debug("Get data for bed density at index: " + index);
+
+        D4EArtifact flys = (D4EArtifact) artifact;
+
+        CalculationResult res = (CalculationResult) flys.compute(context, hash,
+            stateId, type, false);
+
+        BedDiffYearResult[] data =
+            (BedDiffYearResult[]) res.getData(); // TODO CAST TO SPECIFIC CLASS
+        Double start = (Double)context.getContextValue("startkm");
+        Double end = (Double)context.getContextValue("endkm");
+        if(start != null && end != null) {
+            RiverContext fc = (RiverContext)context.globalContext();
+            // Adaptive smoothing, based on zoom factor/diagram extents.
+            ZoomScale scales = (ZoomScale)fc.get("zoomscale");
+            RiverAccess access = new RiverAccess((D4EArtifact)artifact);
+            String river = access.getRiverName();
+
+            double radius = scales.getRadius(river, start, end);
+            BedDiffYearResult oldData = data[index];
+            double[][] diffs = MovingAverage.weighted(oldData.getHeightPerYearData(), radius);
+            return diffs;
+        }
+        return null;
+    }
+
+    /** Copy deeply. */
+    @Override
+    public Facet deepCopy() {
+        BedDiffPerYearFilterFacet copy = new BedDiffPerYearFilterFacet();
+        copy.set(this);
+        copy.type = type;
+        copy.hash = hash;
+        copy.stateId = stateId;
+        return copy;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffSoundingWidthFacet.java	Tue Jul 01 15:09:56 2014 +0200
@@ -0,0 +1,58 @@
+package org.dive4elements.river.artifacts.model.minfo;
+
+import org.apache.log4j.Logger;
+import org.dive4elements.artifactdatabase.state.Facet;
+import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.model.CalculationResult;
+import org.dive4elements.river.artifacts.model.DataFacet;
+import org.dive4elements.river.artifacts.model.FacetTypes;
+import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
+
+
+public class BedDiffSoundingWidthFacet
+extends DataFacet
+implements FacetTypes
+{
+    private static Logger logger = Logger.getLogger(BedDiffSoundingWidthFacet.class);
+
+    public BedDiffSoundingWidthFacet() {
+    }
+
+    public BedDiffSoundingWidthFacet(int idx, String name, String description,
+        ComputeType type, String stateId, String hash) {
+        super(idx, name, description, type, hash, stateId);
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", "chart.beddifference.axis.label.y");
+    }
+
+    public Object getData(Artifact artifact, CallContext context) {
+        logger.debug("Get data for bed density at index: " + index);
+
+        D4EArtifact flys = (D4EArtifact) artifact;
+
+        CalculationResult res = (CalculationResult) flys.compute(context, hash,
+            stateId, type, false);
+
+        BedDiffYearResult[] resultData =
+            (BedDiffYearResult[]) res.getData(); // TODO CAST TO SPECIFIC CLASS
+
+        if (resultData != null && resultData.length > index) {
+            BedDiffYearResult data = resultData[index];
+            return data.getSoundingWidthData();
+        }
+        return null;
+    }
+
+    /** Copy deeply. */
+    @Override
+    public Facet deepCopy() {
+        BedDiffSoundingWidthFacet copy = new BedDiffSoundingWidthFacet();
+        copy.set(this);
+        copy.type = type;
+        copy.hash = hash;
+        copy.stateId = stateId;
+        return copy;
+    }
+}
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffYearFacet.java	Tue Jul 01 13:27:53 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
- * Software engineering by Intevation GmbH
- *
- * This file is Free Software under the GNU AGPL (>=v3)
- * and comes with ABSOLUTELY NO WARRANTY! Check out the
- * documentation coming with Dive4Elements River for details.
- */
-
-package org.dive4elements.river.artifacts.model.minfo;
-
-import org.apache.log4j.Logger;
-
-import org.dive4elements.artifactdatabase.state.Facet;
-import org.dive4elements.artifacts.Artifact;
-import org.dive4elements.artifacts.CallContext;
-import org.dive4elements.river.artifacts.D4EArtifact;
-import org.dive4elements.river.artifacts.model.CalculationResult;
-import org.dive4elements.river.artifacts.model.DataFacet;
-import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
-
-
-public class BedDiffYearFacet
-extends DataFacet
-{
-    private static Logger logger = Logger.getLogger(BedDiffYearFacet.class);
-
-    public BedDiffYearFacet() {
-    }
-
-    public BedDiffYearFacet(int idx, String name, String description,
-        ComputeType type, String stateId, String hash) {
-        super(idx, name, description, type, hash, stateId);
-        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
-        this.metaData.put("Y", "chart.beddifference.axis.label.y");
-    }
-
-    public Object getData(Artifact artifact, CallContext context) {
-        logger.debug("Get data for bed density at index: " + index);
-
-        D4EArtifact flys = (D4EArtifact) artifact;
-
-        CalculationResult res = (CalculationResult) flys.compute(context, hash,
-            stateId, type, false);
-
-        BedDiffYearResult[] data =
-            (BedDiffYearResult[]) res.getData(); // TODO CAST TO SPECIFIC CLASS
-
-        return data != null && data.length > index ? data[index] : null;
-    }
-
-    /** Copy deeply. */
-    @Override
-    public Facet deepCopy() {
-        BedDiffYearFacet copy = new BedDiffYearFacet();
-        copy.set(this);
-        copy.type = type;
-        copy.hash = hash;
-        copy.stateId = stateId;
-        return copy;
-    }
-}
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffYearFilterFacet.java	Tue Jul 01 13:27:53 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
- * Software engineering by Intevation GmbH
- *
- * This file is Free Software under the GNU AGPL (>=v3)
- * and comes with ABSOLUTELY NO WARRANTY! Check out the
- * documentation coming with Dive4Elements River for details.
- */
-
-package org.dive4elements.river.artifacts.model.minfo;
-
-import org.apache.log4j.Logger;
-
-import org.dive4elements.artifactdatabase.state.Facet;
-import org.dive4elements.artifacts.Artifact;
-import org.dive4elements.artifacts.CallContext;
-import org.dive4elements.river.artifacts.D4EArtifact;
-import org.dive4elements.river.artifacts.access.RiverAccess;
-import org.dive4elements.river.artifacts.context.RiverContext;
-import org.dive4elements.river.artifacts.model.CalculationResult;
-import org.dive4elements.river.artifacts.model.DataFacet;
-import org.dive4elements.river.artifacts.math.MovingAverage;
-import org.dive4elements.river.artifacts.model.ZoomScale;
-import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
-
-
-public class BedDiffYearFilterFacet
-extends DataFacet
-{
-    private static Logger logger = Logger.getLogger(BedDiffYearFilterFacet.class);
-
-    public BedDiffYearFilterFacet() {
-    }
-
-    public BedDiffYearFilterFacet(int idx, String name, String description,
-        ComputeType type, String stateId, String hash) {
-        super(idx, name, description, type, hash, stateId);
-        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
-        this.metaData.put("Y", "chart.beddifference.height.yaxis.label");
-    }
-
-    public Object getData(Artifact artifact, CallContext context) {
-        logger.debug("Get data for bed density at index: " + index);
-
-        D4EArtifact flys = (D4EArtifact) artifact;
-
-        CalculationResult res = (CalculationResult) flys.compute(context, hash,
-            stateId, type, false);
-
-        BedDiffYearResult[] data =
-            (BedDiffYearResult[]) res.getData(); // TODO CAST TO SPECIFIC CLASS
-        Double start = (Double)context.getContextValue("startkm");
-        Double end = (Double)context.getContextValue("endkm");
-        if(start != null && end != null) {
-            RiverContext fc = (RiverContext)context.globalContext();
-            // Adaptive smoothing, based on zoom factor/diagram extents.
-            ZoomScale scales = (ZoomScale)fc.get("zoomscale");
-            RiverAccess access = new RiverAccess((D4EArtifact)artifact);
-            String river = access.getRiverName();
-
-            double radius = scales.getRadius(river, start, end);
-            BedDiffYearResult oldData = data[index];
-            BedDiffYearResult newData = new BedDiffYearResult();
-            newData.setStart(oldData.getStart());
-            newData.setEnd(oldData.getEnd());
-            double[][] diffs = MovingAverage.weighted(oldData.getDifferencesData(), radius);
-            double[][] heights1 = MovingAverage.weighted(oldData.getHeights1Data(), radius);
-            double[][] heights2 = MovingAverage.weighted(oldData.getHeights2Data(), radius);
-            double[][] morph1 = oldData.getMorphWidth1Data();
-            double[][] morph2 = oldData.getMorphWidth2Data();
-            double[][] sounding = oldData.getSoundingWidthData();
-            double[][] year = MovingAverage.weighted(oldData.getHeightPerYearData(), radius);
-            for(int j = 0; j < diffs[0].length; j++) {
-                newData.addKm(diffs[0][j]);
-                newData.addBedHeights(year[1][j]);
-                newData.addMorphWidth1(morph1[1][j]);
-                newData.addMorphWidth2(morph2[1][j]);
-                newData.addSoundingWidth(sounding[1][j]);
-                newData.addDifference(diffs[1][j]);
-                newData.addHeight1(heights1[1][j]);
-                newData.addHeight2(heights2[1][j]);
-            }
-            return newData;
-        }
-        return data != null && data.length > index ? data[index] : null;
-    }
-
-    /** Copy deeply. */
-    @Override
-    public Facet deepCopy() {
-        BedDiffYearFilterFacet copy = new BedDiffYearFilterFacet();
-        copy.set(this);
-        copy.type = type;
-        copy.hash = hash;
-        copy.stateId = stateId;
-        return copy;
-    }
-}
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/DifferencesState.java	Tue Jul 01 13:27:53 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/DifferencesState.java	Tue Jul 01 15:09:56 2014 +0200
@@ -25,8 +25,17 @@
 import org.dive4elements.river.artifacts.model.DataFacet;
 import org.dive4elements.river.artifacts.model.FacetTypes;
 import org.dive4elements.river.artifacts.model.minfo.BedDiffCalculation;
-import org.dive4elements.river.artifacts.model.minfo.BedDiffYearFacet;
-import org.dive4elements.river.artifacts.model.minfo.BedDiffYearFilterFacet;
+import org.dive4elements.river.artifacts.model.minfo.BedDiffFacet;
+import org.dive4elements.river.artifacts.model.minfo.BedDiffHeightMinFacet;
+import org.dive4elements.river.artifacts.model.minfo.BedDiffHeightMinFilterFacet;
+import org.dive4elements.river.artifacts.model.minfo.BedDiffHeightSubFacet;
+import org.dive4elements.river.artifacts.model.minfo.BedDiffHeightSubFilterFacet;
+import org.dive4elements.river.artifacts.model.minfo.BedDiffMorphMinFacet;
+import org.dive4elements.river.artifacts.model.minfo.BedDiffMorphSubFacet;
+import org.dive4elements.river.artifacts.model.minfo.BedDiffPerYearFacet;
+import org.dive4elements.river.artifacts.model.minfo.BedDiffPerYearFilterFacet;
+import org.dive4elements.river.artifacts.model.minfo.BedDiffSoundingWidthFacet;
+import org.dive4elements.river.artifacts.model.minfo.BedDiffFilterFacet;
 import org.dive4elements.river.artifacts.model.minfo.BedDiffYearResult;
 import org.dive4elements.river.artifacts.model.minfo.BedDifferencesResult;
 import org.dive4elements.river.artifacts.resources.Resources;
@@ -112,7 +121,7 @@
         newFacets.add(new DataFacet(PDF, "PDF data", ComputeType.ADVANCE, hash, id));
         for (int idx = 0; idx < results.length; idx++) {
             if (results[idx] instanceof BedDiffYearResult) {
-                newFacets.add(new BedDiffYearFacet(
+                newFacets.add(new BedDiffFacet(
                     idx,
                     BED_DIFFERENCE_YEAR,
                     createBedDiffYearDescription(
@@ -122,28 +131,28 @@
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
-                newFacets.add(new BedDiffYearFacet(
+                newFacets.add(new BedDiffSoundingWidthFacet(
                     idx,
                     BED_DIFFERENCE_SOUNDING_WIDTH,
                     createBedDiffSoundingDescription(meta),
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
-                newFacets.add(new BedDiffYearFacet(
+                newFacets.add(new BedDiffMorphMinFacet(
                     idx,
                     BED_DIFFERENCE_MORPH_WIDTH1,
                     createBedDiffMorph1Description(meta),
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
-                newFacets.add(new BedDiffYearFacet(
+                newFacets.add(new BedDiffMorphSubFacet(
                     idx,
                     BED_DIFFERENCE_MORPH_WIDTH2,
                     createBedDiffMorph2Description(meta),
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
-                newFacets.add(new BedDiffYearFacet(
+                newFacets.add(new BedDiffHeightMinFacet(
                     idx,
                     BED_DIFFERENCE_YEAR_HEIGHT1,
                     createBedDiffHeightDescription(
@@ -154,7 +163,7 @@
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
-                 newFacets.add(new BedDiffYearFacet(
+                 newFacets.add(new BedDiffHeightSubFacet(
                     idx,
                     BED_DIFFERENCE_YEAR_HEIGHT2,
                     createBedDiffHeightDescription(
@@ -165,7 +174,7 @@
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
-                newFacets.add(new BedDiffYearFacet(
+                newFacets.add(new BedDiffPerYearFacet(
                     idx,
                     BED_DIFFERENCE_HEIGHT_YEAR,
                     createBedDiffAbsoluteDescription(
@@ -175,7 +184,7 @@
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
-                newFacets.add(new BedDiffYearFilterFacet(
+                newFacets.add(new BedDiffFilterFacet(
                     idx,
                     BED_DIFFERENCE_YEAR_FILTERED,
                     createBedDiffYearDescription(
@@ -185,7 +194,7 @@
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
-                newFacets.add(new BedDiffYearFilterFacet(
+                newFacets.add(new BedDiffHeightMinFilterFacet(
                     idx,
                     BED_DIFFERENCE_YEAR_HEIGHT1_FILTERED,
                     createBedDiffHeightDescription(
@@ -196,7 +205,7 @@
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
-                 newFacets.add(new BedDiffYearFilterFacet(
+                 newFacets.add(new BedDiffHeightSubFilterFacet(
                     idx,
                     BED_DIFFERENCE_YEAR_HEIGHT2_FILTERED,
                     createBedDiffHeightDescription(
@@ -207,7 +216,7 @@
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
-                newFacets.add(new BedDiffYearFilterFacet(
+                newFacets.add(new BedDiffPerYearFilterFacet(
                     idx,
                     BED_DIFFERENCE_HEIGHT_YEAR_FILTERED,
                     createBedDiffAbsoluteDescription(
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffHeightYearProcessor.java	Tue Jul 01 13:27:53 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffHeightYearProcessor.java	Tue Jul 01 15:09:56 2014 +0200
@@ -49,17 +49,36 @@
             DiagramGenerator generator,
             ArtifactAndFacet bundle,
             ThemeDocument    theme,
-            boolean          visible) {
+            boolean          visible
+    ) {
         CallContext context = generator.getCallContext();
         Object data = bundle.getData(context);
         Map<String, String> metaData = bundle.getFacet().getMetaData(
             bundle.getArtifact(), context);
 
-        if (!(data instanceof BedDiffYearResult)) {
+        if (!(data instanceof double[][])) {
             // Should not happen if canHandle is correct
             logger.error("Can't process " + data.getClass().getName() + " objects");
             return;
         }
+
+        setSubtitleRadius(generator, bundle, context);
+
+        double[][] bData = (double[][]) data;
+
+        StyledXYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme);
+        series.putMetaData(metaData, bundle.getArtifact(), context);
+
+        StyledSeriesBuilder.addPoints(series, bData, false, GAP_TOLERANCE);
+
+        generator.addAxisSeries(series, axisName, visible);
+    }
+
+    private void setSubtitleRadius(
+        DiagramGenerator generator,
+        ArtifactAndFacet bundle,
+        CallContext context
+    ) {
         Double start = (Double)context.getContextValue("startkm");
         Double end = (Double)context.getContextValue("endkm");
         if (start != null && end != null) {
@@ -76,12 +95,6 @@
                 I18N_SUBTITLE_RADIUS,
                 new Object[] { radius }));
         }
-        BedDiffYearResult bData = (BedDiffYearResult) data;
-        StyledXYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme);
-        series.putMetaData(metaData, bundle.getArtifact(), context);
-        StyledSeriesBuilder.addPoints(series, bData.getHeightPerYearData(), false, GAP_TOLERANCE);
-
-        generator.addAxisSeries(series, axisName, visible);
     }
 
     @Override
@@ -95,15 +108,15 @@
         CallContext context = generator.getCallContext();
         Object data = bundle.getData(context);
 
-        if (!(data instanceof BedDiffYearResult)) {
+        if (!(data instanceof double[][])) {
             // Should not happen if canHandle is correct
             logger.error("Can't process " + data.getClass().getName() + " objects");
             return;
         }
 
-        BedDiffYearResult bData = (BedDiffYearResult) data;
+        double[][] bData = (double[][]) data;
         XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme);
-        StyledSeriesBuilder.addPoints(series, bData.getHeightPerYearData(), false, GAP_TOLERANCE);
+        StyledSeriesBuilder.addPoints(series, bData, false, GAP_TOLERANCE);
 
         generator.addAxisSeries(series, index, visible);
     }
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffYearProcessor.java	Tue Jul 01 13:27:53 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffYearProcessor.java	Tue Jul 01 15:09:56 2014 +0200
@@ -50,44 +50,56 @@
             DiagramGenerator generator,
             ArtifactAndFacet bundle,
             ThemeDocument    theme,
-            boolean          visible) {
+            boolean          visible
+    ) {
         CallContext context = generator.getCallContext();
         Object data = bundle.getData(context);
         Map<String, String> metaData =
             bundle.getFacet().getMetaData(bundle.getArtifact(), context);
         yAxisLabel = metaData.get("Y");
-        if (data instanceof BedDiffYearResult) {
-            Double start = (Double)context.getContextValue("startkm");
-            Double end = (Double)context.getContextValue("endkm");
-            if (start != null && end != null) {
-                D4EArtifact artifact = (D4EArtifact)bundle.getArtifact();
-                RiverContext fc = (RiverContext)context.globalContext();
-                // Adaptive smoothing, based on zoom factor/diagram extents.
-                ZoomScale scales = (ZoomScale)fc.get("zoomscale");
-                RiverAccess access = new RiverAccess((D4EArtifact)artifact);
-                String river = access.getRiverName();
-
-                double radius = scales.getRadius(river, start, end);
-                generator.addSubtitle(Resources.getMsg(
-                    context.getMeta(),
-                    I18N_SUBTITLE_RADIUS,
-                    new Object[] { radius }));
-            }
-            BedDiffYearResult bData = (BedDiffYearResult) data;
-
-            StyledXYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme);
-            series.putMetaData(metaData, bundle.getArtifact(), context);
-            StyledSeriesBuilder.addPointsFactorY(series,
-                bData.getDifferencesData(),
-                false,
-                GAP_TOLERANCE,
-                100d);
-
-            generator.addAxisSeries(series, axisName, visible);
-
+        if (!(data instanceof double[][])) {
+            logger.error("Can't process " + data.getClass().getName() + " objects");
             return;
         }
-        logger.error("Can't process " + data.getClass().getName() + " objects");
+
+        setSubtitleRadius(generator, bundle, context);
+
+        double[][] bData = (double[][]) data;
+
+        StyledXYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme);
+        series.putMetaData(metaData, bundle.getArtifact(), context);
+        StyledSeriesBuilder.addPointsFactorY(series,
+            bData,
+            false,
+            GAP_TOLERANCE,
+            100d);
+
+        generator.addAxisSeries(series, axisName, visible);
+
+        return;
+    }
+
+    private void setSubtitleRadius(
+        DiagramGenerator generator,
+        ArtifactAndFacet bundle,
+        CallContext context
+    ) {
+        Double start = (Double)context.getContextValue("startkm");
+        Double end = (Double)context.getContextValue("endkm");
+        if (start != null && end != null) {
+            D4EArtifact artifact = (D4EArtifact)bundle.getArtifact();
+            RiverContext fc = (RiverContext)context.globalContext();
+            // Adaptive smoothing, based on zoom factor/diagram extents.
+            ZoomScale scales = (ZoomScale)fc.get("zoomscale");
+            RiverAccess access = new RiverAccess((D4EArtifact)artifact);
+            String river = access.getRiverName();
+
+            double radius = scales.getRadius(river, start, end);
+            generator.addSubtitle(Resources.getMsg(
+                context.getMeta(),
+                I18N_SUBTITLE_RADIUS,
+                new Object[] { radius }));
+        }
     }
 
     @Override
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedWidthProcessor.java	Tue Jul 01 13:27:53 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedWidthProcessor.java	Tue Jul 01 15:09:56 2014 +0200
@@ -56,42 +56,16 @@
         series.putMetaData(metaData, bundle.getArtifact(), context);
         yAxisLabel = metaData.get("Y");
         Object data = bundle.getData(context);
-        String facetName = bundle.getFacetName();
 
-        if (facetName.equals(FacetTypes.BED_DIFFERENCE_SOUNDING_WIDTH) &&
-            data instanceof BedDiffYearResult) {
-            BedDiffYearResult bData = (BedDiffYearResult) data;
-            StyledSeriesBuilder.addPoints(
-                series,
-                bData.getSoundingWidthData(),
-                false,
-                0.110d);
-        } else if (facetName.equals(FacetTypes.BED_DIFFERENCE_MORPH_WIDTH1) &&
-            data instanceof BedDiffYearResult) {
-            BedDiffYearResult bData = (BedDiffYearResult) data;
-            StyledSeriesBuilder.addPoints(series, bData.getMorphWidth1Data(), true);
-        } else if (facetName.equals(FacetTypes.BED_DIFFERENCE_MORPH_WIDTH2) &&
-            data instanceof BedDiffYearResult) {
-            BedDiffYearResult bData = (BedDiffYearResult) data;
-            StyledSeriesBuilder.addPoints(series, bData.getMorphWidth2Data(), true);
-        } else if (data instanceof MorphologicWidth) {
+        if (data instanceof MorphologicWidth) {
             MorphologicWidth bData = (MorphologicWidth) data;
             StyledSeriesBuilder.addPoints(series, bData.getAsArray(), true);
-        } else if (data instanceof BedHeightSingleData) {
-            BedHeightSingleData bData = (BedHeightSingleData)data;
-            double[] width = bData.getSoundingWidths();
-            double[] stations = bData.getStations().toNativeArray();
-
+        } else if (data instanceof double[][]) {
             GapInserter gi = new GapInserter(series, GAP_WIDTH);
 
-            for (int i = 0; i < width.length; i++) {
-                gi.add(stations[i], width[i]);
-            }
-        } else if (data instanceof List<?>) {
-            List<BedHeightSingleValue> bData = (List<BedHeightSingleValue>)data;
-
-            for(BedHeightSingleValue bvalue: bData) {
-                series.add(bvalue.getStation(), bvalue.getSoundingWidth());
+            double[][]values = (double[][]) data;
+            for (int i = 0; i < values[0].length; i++) {
+                gi.add(values[0][i], values[1][i]);
             }
         } else {
             logger.error("Unknown data for facet: " + bundle.getFacetName());

http://dive4elements.wald.intevation.org