[PATCH 3 of 3] (issue1670) Remove parallel implementation for gaps in line themes

Wald Commits scm-commit at wald.intevation.org
Mon Apr 20 15:33:23 CEST 2015


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1429536723 -7200
# Node ID a60a6e7ca24a82f666025574c47b7bac36c81f42
# Parent  5c7b4f4a2e6c44f031d13341fef0def50a22c48c
(issue1670) Remove parallel implementation for gaps in line themes.

diff -r 5c7b4f4a2e6c -r a60a6e7ca24a artifacts/src/main/java/org/dive4elements/river/exports/process/BedWidthProcessor.java
--- 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());
         }
diff -r 5c7b4f4a2e6c -r a60a6e7ca24a artifacts/src/main/java/org/dive4elements/river/jfree/GapInserter.java
--- 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;
-    }
-}


More information about the Dive4Elements-commits mailing list