changeset 8699:a60a6e7ca24a

(issue1670) Remove parallel implementation for gaps in line themes.
author Tom Gottfried <tom@intevation.de>
date Mon, 20 Apr 2015 15:32:03 +0200
parents 5c7b4f4a2e6c
children 32a91eac0bc2
files artifacts/src/main/java/org/dive4elements/river/exports/process/BedWidthProcessor.java artifacts/src/main/java/org/dive4elements/river/jfree/GapInserter.java
diffstat 2 files changed, 4 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedWidthProcessor.java	Mon Apr 20 15:31:12 2015 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedWidthProcessor.java	Mon Apr 20 15:32:03 2015 +0200
@@ -16,7 +16,6 @@
 import org.dive4elements.river.artifacts.model.FacetTypes;
 import org.dive4elements.river.exports.DiagramGenerator;
 import org.dive4elements.river.exports.StyledSeriesBuilder;
-import org.dive4elements.river.jfree.GapInserter;
 import org.dive4elements.river.jfree.StyledXYSeries;
 import org.dive4elements.river.themes.ThemeDocument;
 
@@ -56,12 +55,11 @@
             MorphologicWidth bData = (MorphologicWidth) data;
             StyledSeriesBuilder.addPoints(series, bData.getAsArray(), true);
         } else if (data instanceof double[][]) {
-            GapInserter gi = new GapInserter(series, GAP_WIDTH);
-
             double[][]values = (double[][]) data;
-            for (int i = 0; i < values[0].length; i++) {
-                gi.add(values[0][i], values[1][i]);
-            }
+            StyledSeriesBuilder.addPoints(series,
+                values,
+                false,
+                GAP_WIDTH);
         } else {
             log.error("Unknown data for facet: " + bundle.getFacetName());
         }
--- a/artifacts/src/main/java/org/dive4elements/river/jfree/GapInserter.java	Mon Apr 20 15:31:12 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-package org.dive4elements.river.jfree;
-
-import org.jfree.data.xy.XYSeries;
-
-public class GapInserter {
-
-    private XYSeries series;
-    private double   gap;
-    private double   lastX;
-
-    public GapInserter() {
-    }
-
-    public GapInserter(XYSeries series, double gap) {
-        lastX = Double.NaN;
-        this.series = series;
-        this.gap = Math.abs(gap);
-    }
-
-    public void add(double x, double y) {
-        if (!Double.isNaN(lastX) && !Double.isNaN(x) && Math.abs(x - lastX) > gap) {
-            series.add((x + lastX)/2.0, Double.NaN, false);
-        }
-        series.add(x, y, false);
-        lastX = x;
-    }
-}

http://dive4elements.wald.intevation.org