changeset 381:52b6de9d0ab4

The DischargeCurveGenerator uses public methods of FLYSArtifact to retrieve all necessary information of the current settings. flys-artifacts/trunk@1797 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 02 May 2011 16:44:02 +0000
parents 5f55047a17e8
children e07d1c3f7667
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeCurveGenerator.java
diffstat 2 files changed, 14 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Mon May 02 16:28:57 2011 +0000
+++ b/flys-artifacts/ChangeLog	Mon May 02 16:44:02 2011 +0000
@@ -1,3 +1,9 @@
+2011-05-02  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/DischargeCurveGenerator.java:
+	  Uses the methods of FLYSArtifact to retrieve the necessary information
+	  rivername and selected distance.
+
 2011-05-02	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeCurveGenerator.java	Mon May 02 16:28:57 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeCurveGenerator.java	Mon May 02 16:44:02 2011 +0000
@@ -15,6 +15,7 @@
 import de.intevation.artifacts.Artifact;
 
 import de.intevation.flys.model.Gauge;
+import de.intevation.flys.model.River;
 
 import de.intevation.flys.artifacts.FLYSArtifact;
 import de.intevation.flys.artifacts.model.DischargeTables;
@@ -75,15 +76,11 @@
 
         FLYSArtifact flysArtifact = (FLYSArtifact) artifact;
 
-        String river = (String) flysArtifact.getData("river").getValue();
-        String from  = (String) flysArtifact.getData("ld_from").getValue();
-        String to    = (String) flysArtifact.getData("ld_to").getValue();
-
-        double f = Double.parseDouble(from);
-        double t = Double.parseDouble(to);
+        River    river    = flysArtifact.getRiver();
+        double[] distance = flysArtifact.getDistance();
 
         List<double[]> ranges = new ArrayList<double[]>();
-        ranges.add(new double [] { f, t });
+        ranges.add(distance);
 
         List<Gauge> gauges   = GaugesFactory.getGauges(river);
         List<Gauge> filtered = GaugesFactory.filterRanges(gauges, ranges);
@@ -93,9 +90,9 @@
             int numFiltered = filtered != null ? filtered.size() : 0;
 
             logger.debug("++++++++++++++++++++");
-            logger.debug("Search gauges for river: " + river);
-            logger.debug("-> ... from range: " + from);
-            logger.debug("-> ... to range: " + to);
+            logger.debug("Search gauges for river: " + river.getName());
+            logger.debug("-> ... from range: " + distance[0]);
+            logger.debug("-> ... to range: " + distance[1]);
             logger.debug("-> Found " + numGauges + " gauges in total.");
             logger.debug("-> Found " + numFiltered + " gauges after filtering.");
             logger.debug("++++++++++++++++++++");
@@ -107,7 +104,7 @@
             gaugeNames[idx++] = gauge.getName();
         }
 
-        DischargeTables dt = new DischargeTables(river, gaugeNames);
+        DischargeTables dt = new DischargeTables(river.getName(), gaugeNames);
         Map<String, double[][]> gaugeValues = dt.getValues(100d);
 
         for (String gauge: gaugeNames) {

http://dive4elements.wald.intevation.org