changeset 452:343f248e4c8c

use correct kms and step width now now flys-artifacts/trunk@1948 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 19 May 2011 09:24:08 +0000 (2011-05-19)
parents 73bc64c4a7b0
children 5aef92ea71a6
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/LinearRemap.java
diffstat 3 files changed, 23 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Wed May 18 17:37:06 2011 +0000
+++ b/flys-artifacts/ChangeLog	Thu May 19 09:24:08 2011 +0000
@@ -1,3 +1,11 @@
+2011-05-19	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java:
+	  Use the correct method to generate kms.
+
+	* src/main/java/de/intevation/flys/artifacts/math/LinearRemap.java:
+	  Added some logging to test the map in debug mode.
+
 2011-05-18	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Wed May 18 17:37:06 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Thu May 19 09:24:08 2011 +0000
@@ -589,10 +589,8 @@
         double [] boundWs = new double[boundKms.length];
         double [] boundQs = new double[boundKms.length];
 
-        // XXX: Is there some state missing?
-
-        double [] okms = getExplodedValues(
-            boundKms[0], boundKms[boundKms.length-1], DEFAULT_KM_STEPS);
+        double [] okms = getKms(new double [] {
+            boundKms[0], boundKms[boundKms.length-1] });
 
         ArrayList<WQKms> results = new ArrayList<WQKms>();
 
@@ -637,7 +635,7 @@
 
     protected static String joinDoubles(double [] x) {
         if (x == null) {
-            return "null";
+            return "";
         }
         StringBuilder sb = new StringBuilder();
         for (int i = 0; i < x.length; ++i) {
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/LinearRemap.java	Wed May 18 17:37:06 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/LinearRemap.java	Thu May 19 09:24:08 2011 +0000
@@ -1,7 +1,11 @@
 package de.intevation.flys.artifacts.math;
 
+import org.apache.log4j.Logger;
+
 public class LinearRemap
 {
+    private static Logger logger = Logger.getLogger(LinearRemap.class);
+
     public static class Segment {
 
         protected Segment next;
@@ -58,6 +62,14 @@
         }
 
         head = new Segment(from, to, m, b, head);
+
+        if (logger.isDebugEnabled()) {
+            logger.debug("LinearRemap.add --------- enter");
+            logger.debug("  range: [" + from + ", " + to + "]");
+            logger.debug("  " + x1 + " -> " + y1 + " (" + head.eval(x1) + ")");
+            logger.debug("  " + x2 + " -> " + y2 + " (" + head.eval(x2) + ")");
+            logger.debug("LinearRemap.add --------- leave");
+        }
     }
 
     public double eval(double pos, double x) {

http://dive4elements.wald.intevation.org