[Dive4elements-commits] [PATCH 8 of 9] issue1370: StyledSeriesBuilder: Added add function with translation and scale factors

Wald Commits scm-commit at wald.intevation.org
Wed Jun 26 12:32:15 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1372243134 -7200
# Node ID 39aba54a4c15aa3bfd9d286f995a1db647979ae3
# Parent  6d58f5a4c96a09892088f968ece08f220e0023d0
issue1370: StyledSeriesBuilder: Added add function with translation and scale factors.

diff -r 6d58f5a4c96a -r 39aba54a4c15 artifacts/src/main/java/org/dive4elements/river/exports/StyledSeriesBuilder.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/StyledSeriesBuilder.java	Wed Jun 26 12:37:33 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/StyledSeriesBuilder.java	Wed Jun 26 12:38:54 2013 +0200
@@ -214,6 +214,26 @@
         }
     }
 
+    /**
+     * Add points to series (q to 1st dim, w to 2nd dim), adding wTrans to the
+     * W values and scaling it with wScale.
+     *
+     * @param series Series to add points to.
+     * @param wqkms WQKms to add to series.
+     * @param wAdd Value to add to each Q while adding to series.
+     * @param wScale multiply with
+     */
+    public static void addPointsQW(XYSeries series, WQKms wqkms, double wTrans, double wScale) {
+        if (wqkms == null) {
+            return;
+        }
+
+        int size = wqkms.size();
+
+        for (int i = 0; i < size; i++) {
+            series.add(wqkms.getQ(i), wScale * (wqkms.getW(i) + wTrans), false);
+        }
+    }
 
     /**
      * Add points to series (q to 1st dim, w to 2nd dim).


More information about the Dive4elements-commits mailing list