diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java @ 738:5abdb2fa8eb1

Fix for flys/issue147 flys-artifacts/trunk@2234 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sun, 26 Jun 2011 14:46:48 +0000
parents d9d9f67af984
children 9ff7e06bcb77
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Sun Jun 26 13:07:44 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Sun Jun 26 14:46:48 2011 +0000
@@ -344,14 +344,19 @@
             return error(new WQKms[0], "No Wst found for selected river.");
         }
 
-        double refKm = Double.NaN;
 
-        if (!isFreeQ()) {
-            double [] range = getDistance();
-            if (range == null) {
-                return error(new WQKms[0], "No range found");
-            }
+        double [] range = getDistance();
+        if (range == null) {
+            return error(new WQKms[0], "No range found");
+        }
 
+        double refKm;
+
+        if (isFreeQ()) {
+            refKm = range[0];
+            logger.debug("'free' calculation (km " + refKm + ")");
+        }
+        else {
             Gauge gauge = river.determineGaugeByPosition(range[0]);
             if (gauge == null) {
                 return error(
@@ -364,8 +369,7 @@
                 "reference gauge: " + gauge.getName() + " (km " + refKm + ")");
         }
 
-        return computeWaterlevelData(
-            kms, qs, ws, wst, refKm, river.getKmUp());
+        return computeWaterlevelData(kms, qs, ws, wst, refKm);
     }
 
     /**
@@ -383,12 +387,11 @@
         double []     qs,
         double []     ws,
         WstValueTable wst,
-        double        refKm,
-        boolean       up
+        double        refKm
     ) {
         logger.info("WINFOArtifact.computeWaterlevelData");
 
-        Calculation1 calc1 = new Calculation1(kms, qs, ws, refKm, up);
+        Calculation1 calc1 = new Calculation1(kms, qs, ws, refKm);
 
         return calc1.calculate(wst);
     }

http://dive4elements.wald.intevation.org