changeset 2245:16598bd04f70

Use the ApplyFunctionIterator in reference curve generation. flys-artifacts/trunk@3894 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 03 Feb 2012 12:16:59 +0000
parents 7335c526befd
children 99ef93ce18bd
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ComputationRangeState.java flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java
diffstat 3 files changed, 29 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Feb 03 11:45:22 2012 +0000
+++ b/flys-artifacts/ChangeLog	Fri Feb 03 12:16:59 2012 +0000
@@ -1,3 +1,11 @@
+2012-02-03	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java:
+	  Use the WW.ApplyFunctionIterator to fetch the data.
+
+	* src/main/java/de/intevation/flys/artifacts/states/ComputationRangeState.java:
+	  Removed superfluous imports.
+
 2012-02-03  Ingo Weinzierl <ingo@intevation.de>
 
 	* doc/conf/artifacts/winfo.xml: Registered a ReportFacet for historical
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ComputationRangeState.java	Fri Feb 03 11:45:22 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ComputationRangeState.java	Fri Feb 03 12:16:59 2012 +0000
@@ -18,7 +18,6 @@
 
 import de.intevation.flys.model.DischargeTable;
 import de.intevation.flys.model.Gauge;
-import de.intevation.flys.model.River;
 import de.intevation.flys.model.TimeInterval;
 
 import de.intevation.flys.artifacts.FLYSArtifact;
@@ -28,7 +27,6 @@
 import de.intevation.flys.artifacts.model.CalculationResult;
 import de.intevation.flys.artifacts.model.FacetTypes;
 import de.intevation.flys.artifacts.model.GaugesFactory;
-import de.intevation.flys.artifacts.model.RiverFactory;
 import de.intevation.flys.artifacts.model.WaterlevelFacet;
 import de.intevation.flys.artifacts.model.WQKms;
 import de.intevation.flys.artifacts.resources.Resources;
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java	Fri Feb 03 11:45:22 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java	Fri Feb 03 12:16:59 2012 +0000
@@ -1,28 +1,25 @@
 package de.intevation.flys.exports;
 
-import java.awt.Font;
-
-import org.w3c.dom.Document;
-
-import org.apache.log4j.Logger;
-
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.axis.NumberAxis;
-import org.jfree.chart.axis.ValueAxis;
-import org.jfree.chart.plot.XYPlot;
-import org.jfree.chart.title.TextTitle;
-import org.jfree.data.Range;
-import org.jfree.data.xy.XYSeries;
-
 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
 
 import de.intevation.flys.artifacts.model.FacetTypes;
+
+import de.intevation.flys.artifacts.model.WW.ApplyFunctionIterator;
+
 import de.intevation.flys.artifacts.model.WW;
-import de.intevation.flys.artifacts.resources.Resources;
 
-import de.intevation.flys.jfree.FLYSAnnotation;
 import de.intevation.flys.jfree.StyledXYSeries;
 
+import java.awt.Font;
+
+import org.apache.log4j.Logger;
+
+import org.jfree.chart.axis.NumberAxis;
+
+import org.jfree.data.xy.XYSeries;
+
+import org.w3c.dom.Document;
+
 
 /**
  * An OutGenerator that generates reference curves.
@@ -180,13 +177,16 @@
         Object   data,
         Document theme,
         boolean  visible
-    ){
+    ) {
         XYSeries series = new StyledXYSeries("TODO-RCG", theme);
 
-        WW ww = (WW) (((WW.ApplyFunctionIterator)data).getWW());
-        int size = ww.size();
-        for (int i = 0; i < size; i++) {
-            series.add(ww.getW1(i), ww.getW2(i));
+        ApplyFunctionIterator iter = (ApplyFunctionIterator)data;
+
+        double [] values = new double[2];
+
+        while (iter.hasNext()) {
+            iter.next(values);
+            series.add(values[0], values[1]);
         }
 
         addAxisSeries(series, YAXIS.W.idx, visible);

http://dive4elements.wald.intevation.org