changeset 3109:63ef889eea2b

SQ: Directly sample our Function objects instead of Function2D from JFreeChart. flys-artifacts/trunk@4708 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 19 Jun 2012 15:39:02 +0000
parents 2d4d9050b1c6
children 88d49a0a55f0
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/sq/SQRelationGenerator.java flys-artifacts/src/main/java/de/intevation/flys/jfree/JFreeUtil.java
diffstat 3 files changed, 35 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue Jun 19 15:31:37 2012 +0000
+++ b/flys-artifacts/ChangeLog	Tue Jun 19 15:39:02 2012 +0000
@@ -1,3 +1,12 @@
+2012-06-19	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/jfree/JFreeUtil.java: Directly
+	  sample "our" Function objects instead of JFreeChart Function2Ds.
+
+	* src/main/java/de/intevation/flys/exports/sq/SQRelationGenerator.java:
+	  Removed JFreeChart Function2D wrapper and directly use our Function
+	  objects.
+
 2012-06-19	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/exports/fixings/FixDerivedCurveGenerator.java,
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/sq/SQRelationGenerator.java	Tue Jun 19 15:31:37 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/sq/SQRelationGenerator.java	Tue Jun 19 15:39:02 2012 +0000
@@ -1,24 +1,27 @@
 package de.intevation.flys.exports.sq;
 
+import de.intevation.artifactdatabase.state.ArtifactAndFacet;
+import de.intevation.artifactdatabase.state.Facet;
+
+import de.intevation.flys.artifacts.model.FacetTypes;
+
+import de.intevation.flys.artifacts.model.sq.SQ;
+import de.intevation.flys.artifacts.model.sq.SQFunction;
+
+import de.intevation.flys.exports.XYChartGenerator;
+
+import de.intevation.flys.jfree.JFreeUtil;
+import de.intevation.flys.jfree.StyledXYSeries;
+
 import org.apache.log4j.Logger;
 
 import org.jfree.chart.axis.LogarithmicAxis;
 import org.jfree.chart.axis.NumberAxis;
+
 import org.jfree.data.xy.XYSeries;
 
 import org.w3c.dom.Document;
 
-import de.intevation.artifactdatabase.state.ArtifactAndFacet;
-import de.intevation.artifactdatabase.state.Facet;
-
-import de.intevation.flys.artifacts.model.FacetTypes;
-import de.intevation.flys.artifacts.model.sq.SQ;
-import de.intevation.flys.artifacts.model.sq.SQFunction;
-import de.intevation.flys.exports.XYChartGenerator;
-import de.intevation.flys.jfree.Function2DAdapter;
-import de.intevation.flys.jfree.JFreeUtil;
-import de.intevation.flys.jfree.StyledXYSeries;
-
 /**
  * An OutGenerator that generates charts for MINFO sq relation.
  *
@@ -126,7 +129,7 @@
         SQFunction func = (SQFunction) artifactAndFacet.getData(context);
 
         XYSeries series = JFreeUtil.sampleFunction2D(
-            new Function2DAdapter(func.getFunction()),
+            func.getFunction(),
             attr,
             "SQ Curve",
             10,
--- a/flys-artifacts/src/main/java/de/intevation/flys/jfree/JFreeUtil.java	Tue Jun 19 15:31:37 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/jfree/JFreeUtil.java	Tue Jun 19 15:39:02 2012 +0000
@@ -1,17 +1,17 @@
 package de.intevation.flys.jfree;
 
+import de.intevation.flys.artifacts.math.Function;
+
 import java.awt.Shape;
+
 import java.awt.geom.Rectangle2D;
 
 import java.util.Iterator;
 
-import org.w3c.dom.Document;
-
 import org.jfree.chart.entity.ChartEntity;
 import org.jfree.chart.entity.EntityCollection;
 
-import org.jfree.data.function.Function2D;
-
+import org.w3c.dom.Document;
 
 public class JFreeUtil {
 
@@ -53,12 +53,12 @@
 
 
     public static StyledXYSeries sampleFunction2D(
-        Function2D func,
-        Document   theme,
-        String     seriesKey,
-        int        samples,
-        double     start,
-        double     end
+        Function func,
+        Document theme,
+        String   seriesKey,
+        int      samples,
+        double   start,
+        double   end
     ) {
         StyledXYSeries series = new StyledXYSeries(seriesKey, theme);
 
@@ -66,7 +66,7 @@
 
         for (int i = 0; i < samples; i++) {
             double x = start + (step * i);
-            series.add(x, func.getValue(x));
+            series.add(x, func.value(x));
         }
 
         return series;

http://dive4elements.wald.intevation.org