[Dive4elements-commits] [PATCH 6 of 7] Draw sediment load fraction 'unknown' in chart

Wald Commits scm-commit at wald.intevation.org
Fri Jun 21 15:38:18 CEST 2013


# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1371821808 -7200
# Node ID a8a97f27ca271c4c3982c8b739839b86b3b79100
# Parent  9a0f8d532797609f6fe0e53d7802b2f720a37abf
Draw sediment load fraction 'unknown' in chart.

diff -r 9a0f8d532797 -r a8a97f27ca27 artifacts/src/main/java/org/dive4elements/river/exports/minfo/SedimentLoadLSGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/SedimentLoadLSGenerator.java	Fri Jun 21 15:35:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/SedimentLoadLSGenerator.java	Fri Jun 21 15:36:48 2013 +0200
@@ -9,6 +9,7 @@
 package org.dive4elements.river.exports.minfo;
 
 import java.util.Arrays;
+import java.util.Set;
 
 import org.apache.log4j.Logger;
 import org.jfree.data.xy.XYSeries;
@@ -24,6 +25,8 @@
 import org.dive4elements.river.artifacts.model.WKms;
 import org.dive4elements.river.artifacts.model.minfo.BedDiffEpochResult;
 import org.dive4elements.river.artifacts.model.minfo.BedDiffYearResult;
+import org.dive4elements.river.artifacts.model.minfo.SedimentLoad;
+import org.dive4elements.river.artifacts.model.minfo.SedimentLoadFraction;
 import org.dive4elements.river.exports.StyledSeriesBuilder;
 import org.dive4elements.river.exports.XYChartGenerator;
 import org.dive4elements.river.jfree.Bounds;
@@ -145,6 +148,13 @@
                 attr,
                 visible);
         }
+        else if (FacetTypes.IS.SEDIMENT_LOAD_UNKNOWN(name)) {
+            doSedimentLoadUnknownOut(
+                (SedimentLoad)bundle.getData(context),
+                bundle,
+                attr,
+                visible);
+        }
         else if (name.equals(FLOW_VELOCITY_TOTALCHANNEL)) {
             doFlowVelocityTotalOut(
                 (FlowVelocityData) bundle.getData(context),
@@ -257,6 +267,24 @@
         addAxisSeries(series, YAXIS.L.idx, visible);
     }
 
+    protected void doSedimentLoadUnknownOut(SedimentLoad load,
+        ArtifactAndFacet aandf, Document theme, boolean visible) {
+
+        Set<Double> kms = load.getKms();
+        double[][] data = new double[2][kms.size()];
+        int counter = 0;
+        for (Double km: kms) {
+            SedimentLoadFraction fraction = load.getFraction(km);
+            data[0][counter] = km;
+            data[1][counter] = fraction.getUnknown();
+            counter++;
+        }
+        XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
+        StyledSeriesBuilder.addPoints(series, data, false);
+
+        addAxisSeries(series, YAXIS.L.idx, visible);
+    }
+
     protected void doFlowVelocityMainOut(
         FlowVelocityData data,
         ArtifactAndFacet aandf,


More information about the Dive4elements-commits mailing list