[Dive4elements-commits] [PATCH 2 of 2] FixWQCurveGenerator: Handle extreme_wq_curve facets (stub)

Wald Commits scm-commit at wald.intevation.org
Tue Oct 30 12:01:50 CET 2012


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1351595189 -3600
# Node ID 33d6d4025d0f09ec15b95f410ace9fbc016b58f7
# Parent  f36550788addc63114cde7ffab849131fb734c48
FixWQCurveGenerator: Handle extreme_wq_curve facets (stub).

diff -r f36550788add -r 33d6d4025d0f flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java	Tue Oct 30 12:04:49 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java	Tue Oct 30 12:06:29 2012 +0100
@@ -30,6 +30,8 @@
 import de.intevation.flys.artifacts.model.QWDDateRange;
 import de.intevation.flys.artifacts.model.WKms;
 import de.intevation.flys.artifacts.model.WQKms;
+import de.intevation.flys.artifacts.model.extreme.Curve;
+import de.intevation.flys.artifacts.model.extreme.ExtremeCurveFacet;
 import de.intevation.flys.artifacts.model.fixings.FixFunction;
 import de.intevation.flys.artifacts.model.fixings.FixWQCurveFacet;
 import de.intevation.flys.artifacts.model.fixings.QWD;
@@ -149,6 +151,9 @@
                     aaf,
                     doc, visible, YAXIS.W.idx);
         }
+        else if (name.equals(EXTREME_WQ_CURVE)) {
+            doExtremeCurveOut(aaf, doc, visible);
+        }
         else {
             logger.warn("Unknown facet name " + name);
             return;
@@ -202,6 +207,7 @@
         }
     }
 
+
     /** Add reference event points to chart */
     protected void doReferenceEventsOut(ArtifactAndFacet aaf, Document doc, boolean visible) {
         logger.debug("doReferenceEventsOut");
@@ -234,6 +240,31 @@
         }
     }
 
+
+    /** Do Extreme Curve out */
+    // TODO Refactor, donate own Generator.
+    protected void doExtremeCurveOut(ArtifactAndFacet aaf, Document doc, boolean visible) {
+        logger.debug("doExtremeCurveOut");
+        ExtremeCurveFacet facet = (ExtremeCurveFacet) aaf.getFacet();
+        Curve curve = (Curve) facet.getData(aaf.getArtifact(), context);
+        if (curve == null) {
+            logger.warn("doExtremeCurveOut: Facet does not contain Curve");
+            return;
+        }
+        // TODO find max Q.
+        // TODO add marker where extrapolation starts.
+        double maxQ = 4000;
+        StyledXYSeries series = JFreeUtil.sampleFunction2D(
+                curve,
+                doc,
+                aaf.getFacetDescription(),
+                500,   // number of samples
+                0.0 ,  // start
+                maxQ); // end
+
+        addAxisSeries(series, 0, visible);
+    }
+
     protected void doWQCurveOut(ArtifactAndFacet aaf, Document doc, boolean visible) {
         logger.debug("doWQCurveOut");
 


More information about the Dive4elements-commits mailing list