changeset 2278:08bb95e1fc41

"Bezugslinienverfahren": Fetch axis types from call context. flys-artifacts/trunk@3937 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 06 Feb 2012 15:57:31 +0000
parents 3f3e4f94171b
children 6eb6162f2cd2
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WWAxisTypes.java flys-artifacts/src/main/java/de/intevation/flys/exports/NormalizedReferenceCurveGenerator.java flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java
diffstat 4 files changed, 27 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Mon Feb 06 15:42:27 2012 +0000
+++ b/flys-artifacts/ChangeLog	Mon Feb 06 15:57:31 2012 +0000
@@ -1,3 +1,13 @@
+2012-02-06	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/WWAxisTypes.java:
+	  Added optional boolean flag to indicated if the data should be 'normalized'.
+	  TODO: Build the cascading normalising function call chain.
+
+	* src/main/java/de/intevation/flys/exports/NormalizedReferenceCurveGenerator.java,
+	  src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java:
+	  Fetch WWAxisTypes from call context to do the right scaling.
+
 2012-02-06  Raimund Renkert <raimund.renkert@intevation.de>
 
 	Added service for discharge infos at a specific gauge.
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WWAxisTypes.java	Mon Feb 06 15:42:27 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WWAxisTypes.java	Mon Feb 06 15:57:31 2012 +0000
@@ -40,6 +40,12 @@
     }
 
     public WW.ApplyFunctionIterator transform(WW ww) {
+        return transform(ww, false);
+    }
+
+    public WW.ApplyFunctionIterator transform(WW ww, boolean normalized) {
+        // TODO: Do normalising.
+
         Function function1 = inCm1
             ? new LinearFilterFunction(100d, -ww.getStartDatum())
             : Identity.IDENTITY;
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/NormalizedReferenceCurveGenerator.java	Mon Feb 06 15:42:27 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/NormalizedReferenceCurveGenerator.java	Mon Feb 06 15:57:31 2012 +0000
@@ -200,10 +200,13 @@
     ) {
         WW ww = (WW)data;
 
-        // TODO: Fetch from black board instead!
-        WWAxisTypes wwat = new WWAxisTypes(ww);
+        Object obj = context.getContextValue("reference.curve.axis.scale");
 
-        ApplyFunctionIterator iter = wwat.transform(ww);
+        WWAxisTypes wwat = obj instanceof WWAxisTypes
+            ? (WWAxisTypes)obj
+            : new WWAxisTypes(ww);
+
+        ApplyFunctionIterator iter = wwat.transform(ww, true);
 
         XYSeries series = new StyledXYSeries(
             ww.getName(), false, theme);
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java	Mon Feb 06 15:42:27 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java	Mon Feb 06 15:57:31 2012 +0000
@@ -200,8 +200,11 @@
     ) {
         WW ww = (WW)data;
 
-        // TODO: Fetch from black board instead!
-        WWAxisTypes wwat = new WWAxisTypes(ww);
+        Object obj = context.getContextValue("reference.curve.axis.scale");
+
+        WWAxisTypes wwat = obj instanceof WWAxisTypes
+            ? (WWAxisTypes)obj
+            : new WWAxisTypes(ww);
 
         ApplyFunctionIterator iter = wwat.transform(ww);
 

http://dive4elements.wald.intevation.org