diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java @ 677:a95f34f1f39a

Added error reporting to 'Abflusskurve' calculation. flys-artifacts/trunk@2101 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 10 Jun 2011 14:24:15 +0000
parents c501f27c1f71
children 19a3185822a4
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Fri Jun 10 12:38:08 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Fri Jun 10 14:24:15 2011 +0000
@@ -34,6 +34,7 @@
 import de.intevation.flys.artifacts.model.WstValueTable;
 import de.intevation.flys.artifacts.model.WstValueTable.QPosition;
 import de.intevation.flys.artifacts.model.WstValueTableFactory;
+import de.intevation.flys.artifacts.model.Calculation2;
 import de.intevation.flys.artifacts.model.Calculation3;
 import de.intevation.flys.artifacts.model.Calculation4;
 import de.intevation.flys.artifacts.model.Segment;
@@ -455,24 +456,11 @@
 
         // TODO Introduce a caching mechanism here!
 
-        setComputedDischargeCurveNames(wqkms, locations[0]);
-
         return wqkms;
     }
 
 
     /**
-     * Sets the name of the computed discharge curve data.
-     *
-     * @param wqkms The computed WQKms object.
-     * @param l The location used for the computation.
-     */
-    public static void setComputedDischargeCurveNames(WQKms wqkms, double l) {
-        wqkms.setName(Double.toString(l));
-    }
-
-
-    /**
      * Computes the data used to create computed discharge curves.
      *
      * @param wst The WstValueTable that is used for the interpolation.
@@ -487,21 +475,11 @@
     {
         logger.info("WINFOArtifact.computeDischargeCurveData");
 
-        double[][] wqs = wst.interpolateWQ(location);
-
-        if (wqs == null) {
-            logger.error("Cannot compute discharge curve data.");
-            return null;
-        }
+        Calculation2 calculation = new Calculation2(location);
 
-        double[] ws = wqs[0];
-        double[] qs = wqs[1];
+        WQKms wqkms = calculation.calculate(wst);
 
-        WQKms wqkms = new WQKms(ws.length);
-
-        for (int i = 0; i < ws.length; i++) {
-            wqkms.add(ws[i], qs[i], location);
-        }
+        // TODO: Report errors to the user
 
         return wqkms;
     }

http://dive4elements.wald.intevation.org