changeset 3034:842502b3913a

JFreeChart: Added adapter class to bridge de.intevation.flys.artifacts.math.Function to org.jfree.data.function.Function2D. flys-artifacts/trunk@4603 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 06 Jun 2012 10:26:28 +0000
parents aba4104f41c9
children b388d888330d
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/jfree/Function2DAdapter.java
diffstat 2 files changed, 42 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Wed Jun 06 10:02:54 2012 +0000
+++ b/flys-artifacts/ChangeLog	Wed Jun 06 10:26:28 2012 +0000
@@ -1,3 +1,13 @@
+2012-06-06	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/jfree/Function2DAdapter.java:
+	  New. Adapter class to brigde de.intevation.flys.artifacts.math.Function
+	  to org.jfree.data.function.Function2D.
+
+	  Function2D objects can be used by org.jfree.data.general.DatasetUtilities
+	  to sample functions into XYDatasets.
+	  See DatasetUtilities.sampleFunction2D()
+
 2012-06-06	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	* doc/datacage.txt: New file that will contain datacage configuration
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/jfree/Function2DAdapter.java	Wed Jun 06 10:26:28 2012 +0000
@@ -0,0 +1,32 @@
+package de.intevation.flys.jfree;
+
+import de.intevation.flys.artifacts.math.Function;
+
+import org.jfree.data.function.Function2D;
+
+public class Function2DAdapter
+implements   Function2D
+{
+    protected Function function;
+
+    public Function2DAdapter() {
+    }
+
+    public Function2DAdapter(Function function) {
+        this.function = function;
+    }
+
+    public Function getFunction() {
+        return function;
+    }
+
+    public void setFunction(Function function) {
+        this.function = function;
+    }
+
+    @Override
+    public double getValue(double x) {
+        return function.value(x);
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org