diff flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/SedimentLoadLSGenerator.java @ 5653:5231e6b849ce

issue1077: Handle overlapping measurement station ranges, refactored Generator, Allow gaps in graph (not sorting, living with NaNs).
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 11 Apr 2013 10:52:56 +0200
parents 04687db03218
children e95427ed80e5
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/SedimentLoadLSGenerator.java	Thu Apr 11 10:14:18 2013 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/SedimentLoadLSGenerator.java	Thu Apr 11 10:52:56 2013 +0200
@@ -126,57 +126,8 @@
             context.putContextValue("startkm", bounds.getLower());
             context.putContextValue("endkm", bounds.getUpper());
         }
-        if (name.equals(SEDIMENT_LOAD_COARSE)) {
-            doSedimentLoadCoarseOut(
-                (double[][]) bundle.getData(context),
-                bundle,
-                attr,
-                visible);
-        }
-        else if (name.equals(SEDIMENT_LOAD_SAND)) {
-            doSedimentLoadSandOut(
-                (double[][]) bundle.getData(context),
-                bundle,
-                attr,
-                visible);
-        }
-        else if (name.equals(SEDIMENT_LOAD_FINEMIDDLE)) {
-            doSedimentLoadFineMiddleOut(
-                (double[][]) bundle.getData(context),
-                bundle,
-                attr,
-                visible);
-        }
-        else if (name.equals(SEDIMENT_LOAD_SUSP_SAND)) {
-            doSedimentLoadSuspSandOut(
-                (double[][]) bundle.getData(context),
-                bundle,
-                attr,
-                visible);
-        }
-        else if (name.equals(SEDIMENT_LOAD_SUSP_SAND_BED)) {
-            doSedimentLoadSuspSandBedOut(
-                (double[][]) bundle.getData(context),
-                bundle,
-                attr,
-                visible);
-        }
-        else if (name.equals(SEDIMENT_LOAD_SUSP_SEDIMENT)) {
-            doSedimentLoadSuspSedimentOut(
-                (double[][]) bundle.getData(context),
-                bundle,
-                attr,
-                visible);
-        }
-        else if (name.equals(SEDIMENT_LOAD_TOTAL_LOAD)) {
-            doSedimentLoadTotalLoadOut(
-                (double[][]) bundle.getData(context),
-                bundle,
-                attr,
-                visible);
-        }
-        else if (name.equals(SEDIMENT_LOAD_TOTAL)) {
-            doSedimentLoadTotalOut(
+        if (FacetTypes.IS.SEDIMENT_LOAD(SEDIMENT_LOAD_COARSE)) {
+            doSedimentLoadOut(
                 (double[][]) bundle.getData(context),
                 bundle,
                 attr,
@@ -290,75 +241,12 @@
         return label;
     }
 
-    // TODO all double[][] eating *Out() can be subsumed.
-    protected void doSedimentLoadCoarseOut(double[][] data,
-        ArtifactAndFacet aandf, Document theme, boolean visible) {
-
-        XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
-        StyledSeriesBuilder.addPoints(series, data, true);
-
-        addAxisSeries(series, YAXIS.L.idx, visible);
-    }
-
-    protected void doSedimentLoadSandOut(double[][] data,
-        ArtifactAndFacet aandf, Document theme, boolean visible) {
-
-        XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
-        StyledSeriesBuilder.addPoints(series, data, true);
-
-        addAxisSeries(series, YAXIS.L.idx, visible);
-    }
-
-    protected void doSedimentLoadFineMiddleOut(double[][] data,
-        ArtifactAndFacet aandf, Document theme, boolean visible) {
-
-        XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
-        StyledSeriesBuilder.addPoints(series, data, true);
-
-        addAxisSeries(series, YAXIS.L.idx, visible);
-    }
-
-    protected void doSedimentLoadSuspSandOut(double[][] data,
+    protected void doSedimentLoadOut(double[][] data,
         ArtifactAndFacet aandf, Document theme, boolean visible) {
 
-        XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
-        StyledSeriesBuilder.addPoints(series, data, true);
-
-        addAxisSeries(series, YAXIS.L.idx, visible);
-    }
-
-    protected void doSedimentLoadSuspSandBedOut(double[][] data,
-        ArtifactAndFacet aandf, Document theme, boolean visible) {
-
-        XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
-        StyledSeriesBuilder.addPoints(series, data, true);
-
-        addAxisSeries(series, YAXIS.L.idx, visible);
-    }
-
-    protected void doSedimentLoadSuspSedimentOut(double[][] data,
-        ArtifactAndFacet aandf, Document theme, boolean visible) {
-
-        XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
-        StyledSeriesBuilder.addPoints(series, data, true);
-
-        addAxisSeries(series, YAXIS.L.idx, visible);
-    }
-
-    protected void doSedimentLoadTotalLoadOut(double[][] data,
-        ArtifactAndFacet aandf, Document theme, boolean visible) {
-
-        XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
-        StyledSeriesBuilder.addPoints(series, data, true);
-
-        addAxisSeries(series, YAXIS.L.idx, visible);
-    }
-
-    protected void doSedimentLoadTotalOut(double[][] data,
-        ArtifactAndFacet aandf, Document theme, boolean visible) {
-
-        XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
-        StyledSeriesBuilder.addPoints(series, data, true);
+        // Allow for gaps (NaNs).
+        XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), false, theme);
+        StyledSeriesBuilder.addPoints(series, data, false);
 
         addAxisSeries(series, YAXIS.L.idx, visible);
     }
@@ -436,5 +324,4 @@
             setInverted(true);
         }
     }
-
 }

http://dive4elements.wald.intevation.org