changeset 7148:cde7db30847f

Add BedQuality Processors
author Andre Heinecke <aheinecke@intevation.de>
date Wed, 25 Sep 2013 15:57:50 +0200
parents 41779c13f9e4
children 8b4b9f00bc45
files artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDensityProcessor.java artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDiameterProcessor.java artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityPorosityProcessor.java artifacts/src/main/java/org/dive4elements/river/exports/process/BedWidthProcessor.java
diffstat 4 files changed, 245 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDensityProcessor.java	Wed Sep 25 15:57:50 2013 +0200
@@ -0,0 +1,76 @@
+/* Copyright (C) 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.exports.process;
+
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.jfree.data.xy.XYSeries;
+
+import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.river.artifacts.model.minfo.BedHeightSingle;
+import org.dive4elements.river.artifacts.model.FacetTypes;
+import org.dive4elements.river.exports.DiagramGenerator;
+import org.dive4elements.river.exports.StyledSeriesBuilder;
+import org.dive4elements.river.jfree.StyledXYSeries;
+import org.dive4elements.river.model.BedHeightSingleValue;
+import org.dive4elements.river.themes.ThemeDocument;
+
+import org.dive4elements.river.artifacts.model.minfo.BedParametersResult;
+
+public class BedQualityDensityProcessor extends DefaultProcessor {
+
+    private final static Logger logger =
+            Logger.getLogger(BedQualityDensityProcessor.class);
+
+    public static final String I18N_AXIS_LABEL_DEFAULT =
+        "Dichte [t/m^3]";
+    public static final String I18N_AXIS_LABEL =
+        "chart.bedquality.yaxis.label.density";
+
+    @Override
+    public void doOut(
+            DiagramGenerator generator,
+            ArtifactAndFacet bundle,
+            ThemeDocument    theme,
+            boolean          visible) {
+        CallContext context = generator.getCallContext();
+        XYSeries series = new StyledXYSeries(bundle.getFacetDescription(),
+                theme);
+        Object data = bundle.getData(context);
+        String facetName = bundle.getFacetName();
+        double [][] points;
+
+        if (facetName.equals(FacetTypes.BED_QUALITY_SEDIMENT_DENSITY_TOPLAYER)) {
+            points = ((BedParametersResult) data).getDensityCapData();
+        } else if (facetName.equals(FacetTypes.BED_QUALITY_SEDIMENT_DENSITY_SUBLAYER)) {
+            points = ((BedParametersResult) data).getDensitySubData();
+        } else {
+            logger.error("Unknown facet name: " + facetName);
+            return;
+        }
+        StyledSeriesBuilder.addPoints(series, points, true);
+
+        generator.addAxisSeries(series, axisName, visible);
+    }
+
+    @Override
+    public boolean canHandle(String facettype) {
+        return facettype.equals(FacetTypes.BED_QUALITY_SEDIMENT_DENSITY_SUBLAYER) ||
+            facettype.equals(FacetTypes.BED_QUALITY_SEDIMENT_DENSITY_TOPLAYER);
+    }
+
+    @Override
+    public String getAxisLabel(DiagramGenerator generator) {
+        return generator.msg(
+                I18N_AXIS_LABEL,
+                I18N_AXIS_LABEL_DEFAULT);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDiameterProcessor.java	Wed Sep 25 15:57:50 2013 +0200
@@ -0,0 +1,89 @@
+/* Copyright (C) 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.exports.process;
+
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.jfree.data.xy.XYSeries;
+
+import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.river.artifacts.model.minfo.BedHeightSingle;
+import org.dive4elements.river.artifacts.model.FacetTypes;
+import org.dive4elements.river.exports.DiagramGenerator;
+import org.dive4elements.river.exports.StyledSeriesBuilder;
+import org.dive4elements.river.jfree.StyledXYSeries;
+import org.dive4elements.river.model.BedHeightSingleValue;
+import org.dive4elements.river.themes.ThemeDocument;
+
+import org.dive4elements.river.artifacts.model.minfo.BedDiameterData;
+import org.dive4elements.river.artifacts.model.minfo.BedDiameterResult;
+import org.dive4elements.river.artifacts.model.minfo.BedloadDiameterResult;
+
+public class BedQualityDiameterProcessor extends DefaultProcessor {
+
+    private final static Logger logger =
+            Logger.getLogger(BedQualityDiameterProcessor.class);
+
+    public static final String I18N_AXIS_LABEL_DEFAULT =
+        "Durchmesser [mm]";
+    public static final String I18N_AXIS_LABEL =
+        "chart.bedquality.yaxis.label.diameter";
+
+    @Override
+    public void doOut(
+            DiagramGenerator generator,
+            ArtifactAndFacet bundle,
+            ThemeDocument    theme,
+            boolean          visible) {
+        CallContext context = generator.getCallContext();
+        XYSeries series = new StyledXYSeries(bundle.getFacetDescription(),
+                theme);
+        Object data = bundle.getData(context);
+        String facetName = bundle.getFacetName();
+        double [][] points;
+
+        if (facetName.equals(FacetTypes.BED_QUALITY_BED_DIAMETER_TOPLAYER)) {
+            points = ((BedDiameterResult) data).getDiameterCapData();
+        } else if (facetName.equals(FacetTypes.BED_QUALITY_BED_DIAMETER_SUBLAYER)) {
+            points = ((BedDiameterResult) data).getDiameterSubData();
+        } else if (facetName.equals(FacetTypes.BED_QUALITY_BEDLOAD_DIAMETER)) {
+            points = ((BedloadDiameterResult) data).getDiameterData();
+        } else if (facetName.equals(FacetTypes.BED_DIAMETER_DATA_TOP) ||
+                 facetName.equals(FacetTypes.BED_DIAMETER_DATA_SUB) ||
+                 facetName.equals(FacetTypes.BEDLOAD_DIAMETER_DATA)) {
+            points = ((BedDiameterData) data).getDiameterData();
+        } else {
+            logger.error("Unknown facet name: " + facetName);
+            return;
+        }
+        StyledSeriesBuilder.addPoints(series, points, true);
+
+        generator.addAxisSeries(series, axisName, visible);
+    }
+
+    @Override
+    public boolean canHandle(String facettype) {
+        return facettype.equals(FacetTypes.BED_QUALITY_BED_DIAMETER_TOPLAYER) ||
+            facettype.equals(FacetTypes.BED_QUALITY_BED_DIAMETER_SUBLAYER) ||
+            facettype.equals(FacetTypes.BED_QUALITY_BEDLOAD_DIAMETER) ||
+            facettype.equals(FacetTypes.BED_DIAMETER_DATA_TOP) ||
+            facettype.equals(FacetTypes.BED_DIAMETER_DATA_SUB) ||
+            facettype.equals(FacetTypes.BEDLOAD_DIAMETER_DATA);
+    }
+
+    @Override
+    public String getAxisLabel(DiagramGenerator generator) {
+        return generator.msg(
+                I18N_AXIS_LABEL,
+                I18N_AXIS_LABEL_DEFAULT);
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityPorosityProcessor.java	Wed Sep 25 15:57:50 2013 +0200
@@ -0,0 +1,78 @@
+/* Copyright (C) 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.exports.process;
+
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.jfree.data.xy.XYSeries;
+
+import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.river.artifacts.model.minfo.BedHeightSingle;
+import org.dive4elements.river.artifacts.model.FacetTypes;
+import org.dive4elements.river.exports.DiagramGenerator;
+import org.dive4elements.river.exports.StyledSeriesBuilder;
+import org.dive4elements.river.jfree.StyledXYSeries;
+import org.dive4elements.river.model.BedHeightSingleValue;
+import org.dive4elements.river.themes.ThemeDocument;
+
+import org.dive4elements.river.artifacts.model.minfo.BedParametersResult;
+
+public class BedQualityPorosityProcessor extends DefaultProcessor {
+
+    private final static Logger logger =
+            Logger.getLogger(BedQualityPorosityProcessor.class);
+
+    public static final String I18N_AXIS_LABEL_DEFAULT =
+        "Porosität [%]";
+    public static final String I18N_AXIS_LABEL =
+        "chart.bedquality.yaxis.label.porosity";
+
+    @Override
+    public void doOut(
+            DiagramGenerator generator,
+            ArtifactAndFacet bundle,
+            ThemeDocument    theme,
+            boolean          visible) {
+        CallContext context = generator.getCallContext();
+        XYSeries series = new StyledXYSeries(bundle.getFacetDescription(),
+                theme);
+        Object data = bundle.getData(context);
+        String facetName = bundle.getFacetName();
+        double [][] points;
+
+        if (facetName.equals(FacetTypes.BED_QUALITY_POROSITY_TOPLAYER)) {
+            points = ((BedParametersResult) data).getPorosityCapData();
+        } else if (facetName.equals(FacetTypes.BED_QUALITY_BED_DIAMETER_SUBLAYER)) {
+            points = ((BedParametersResult) data).getPorositySubData();
+        } else {
+            logger.error("Unknown facet name: " + facetName);
+            return;
+        }
+        StyledSeriesBuilder.addPoints(series, points, true);
+
+        generator.addAxisSeries(series, axisName, visible);
+    }
+
+    @Override
+    public boolean canHandle(String facettype) {
+        return facettype.equals(FacetTypes.BED_QUALITY_POROSITY_TOPLAYER) ||
+            facettype.equals(FacetTypes.BED_QUALITY_POROSITY_SUBLAYER);
+    }
+
+    @Override
+    public String getAxisLabel(DiagramGenerator generator) {
+        return generator.msg(
+                I18N_AXIS_LABEL,
+                I18N_AXIS_LABEL_DEFAULT);
+    }
+}
+
+
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedWidthProcessor.java	Wed Sep 25 15:08:48 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedWidthProcessor.java	Wed Sep 25 15:57:50 2013 +0200
@@ -53,6 +53,8 @@
         } else if (data instanceof MorphologicWidth) {
             MorphologicWidth bData = (MorphologicWidth) data;
             StyledSeriesBuilder.addPoints(series, bData.getAsArray(), true);
+        } else {
+            logger.error("Unknown data for facet: " + bundle.getFacetName());
         }
 
         generator.addAxisSeries(series, axisName, visible);

http://dive4elements.wald.intevation.org