changeset 2229:9dc81827b187

Add some fake 'input' data for reference curve. plot references curves from input km to input km +2. flys-artifacts/trunk@3869 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 01 Feb 2012 15:00:13 +0000
parents 4db19a88bddb
children 59af81364eb1
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WW.java flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java
diffstat 4 files changed, 56 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Wed Feb 01 14:48:00 2012 +0000
+++ b/flys-artifacts/ChangeLog	Wed Feb 01 15:00:13 2012 +0000
@@ -1,3 +1,17 @@
+2012-02-01  Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Fake some reference curve input values to have working prototype
+	to work on.
+
+	* src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java:
+	  Syntax-stunt fake reference inputs.
+
+	* src/main/java/de/intevation/flys/artifacts/model/WW.java
+	  (getW1): Accessor for first w at index (for the raw ww).
+
+	* src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java
+	  (doReferenceOut): Plot the raw W-over-W.
+
 2012-02-01  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java: Create time
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Wed Feb 01 14:48:00 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Wed Feb 01 15:00:13 2012 +0000
@@ -649,6 +649,7 @@
         return calc4.calculate(table, range[0], range[1], range[2]);
     }
 
+
     /**
      * Returns the data that is computed by a reference curve computation.
      *
@@ -683,7 +684,12 @@
         return calc5.calculate(wst);
     }
 
+
     protected Double getReferenceStartKm() {
+        if (true) {
+            return FLYSUtils.getLocations(this)[0];
+        }
+
         StateData sd = getData("reference_start");
 
         if (sd == null) {
@@ -709,8 +715,10 @@
     }
 
     protected double [] getReferenceEndKms() {
+        StateData sd = getData("reference_end");
 
-        StateData sd = getData("reference_end");
+        if(true)
+        return new double[] {getReferenceStartKm() + 2.0d};
 
         if (sd == null) {
             logger.warn("no reference end given.");
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WW.java	Wed Feb 01 14:48:00 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WW.java	Wed Feb 01 15:00:13 2012 +0000
@@ -93,6 +93,10 @@
         ws2.add(w2);
     }
 
+    public double getW1(int idx) {
+        return ws.getQuick(idx);
+    }
+
     public double getW2(int idx) {
         return ws2.getQuick(idx);
     }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java	Wed Feb 01 14:48:00 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java	Wed Feb 01 15:00:13 2012 +0000
@@ -17,7 +17,7 @@
 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
 
 import de.intevation.flys.artifacts.model.FacetTypes;
-import de.intevation.flys.artifacts.model.WQDay;
+import de.intevation.flys.artifacts.model.WW;
 import de.intevation.flys.artifacts.resources.Resources;
 
 import de.intevation.flys.jfree.FLYSAnnotation;
@@ -144,10 +144,17 @@
         return label;
     }
 
+
+    /**
+     * Called for each facet/them in the out mapped to this generator.
+     * @param artifactFacet artifact and facet for this theme.
+     * @param theme         styling info.
+     * @param visible       Whether or not the theme is visible.
+     */
     @Override
     public void doOut(
         ArtifactAndFacet artifactFacet,
-        Document         attr,
+        Document         theme,
         boolean          visible
     ) {
         String name = artifactFacet.getFacetName();
@@ -159,12 +166,9 @@
             return;
         }
 
-        /*
-        if (name.equals(REFERENCE_W)) {
-            //doReference
+        if (name.equals(REFERENCE_CURVE)) {
+            doReferenceOut(artifactFacet.getData(context), theme, visible);
         }
-        */
-        if (false) {}
         else {
             logger.warn("Unknown facet name: " + name);
             return;
@@ -172,6 +176,24 @@
     }
 
 
+    public void doReferenceOut(
+        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));
+        }
+
+        addAxisSeries(series, YAXIS.W.idx, visible);
+    }
+
+
+    /** Get Walker to iterate over all axes. */
     @Override
     protected YAxisWalker getYAxisWalker() {
         return new YAxisWalker() {

http://dive4elements.wald.intevation.org