changeset 6878:9b35bf3227e9

Initial DischargeProcessor-commit (skeleton).
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 20 Aug 2013 13:03:03 +0200
parents 2d96d8240e3e
children 1186fa8a0bb9
files artifacts/src/main/java/org/dive4elements/river/exports/process/DischargeProcessor.java
diffstat 1 files changed, 74 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/DischargeProcessor.java	Tue Aug 20 13:03:03 2013 +0200
@@ -0,0 +1,74 @@
+/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+
+package org.dive4elements.river.exports.process;
+
+import org.apache.log4j.Logger;
+import org.jfree.data.xy.XYSeries;
+import org.w3c.dom.Document;
+
+import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.river.artifacts.model.FacetTypes;
+import org.dive4elements.river.artifacts.model.WQKms;
+import org.dive4elements.river.exports.StyledSeriesBuilder;
+import org.dive4elements.river.exports.XYChartGenerator;
+import org.dive4elements.river.jfree.StyledXYSeries;
+
+
+/** Helper for data handling in discharge diagrams. */
+public class DischargeProcessor
+implements   Processor, FacetTypes {
+
+    private final static Logger logger =
+            Logger.getLogger(DischargeProcessor.class);
+
+
+    /** Process data, add it to plot. */
+    @Override
+    public void doOut(
+            XYChartGenerator generator,
+            ArtifactAndFacet aandf,
+            Document theme,
+            boolean visible,
+            int index
+    ) {
+        CallContext context = generator.getCallContext();
+        Object data = aandf.getData(context);
+        if (data instanceof WQKms) {
+            // TODO: Fetch point
+            return;
+        }
+        logger.error("Can't process " + data.getClass().getName() + " objects");
+    }
+
+
+    /** True if this processor knows how to deal with facetType. */
+    @Override
+    public boolean canHandle(String facetType) {
+        return BED_DIFFERENCE_HEIGHT_YEAR.equals(facetType);
+    }
+
+
+    /** TODO Handle WQKms point data. */
+    protected void doWQKmsPointOut(XYChartGenerator generator,
+        WQKms data,
+        ArtifactAndFacet aandf,
+        Document theme,
+        boolean visible,
+        int axidx) {
+
+        /*
+        XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
+        StyledSeriesBuilder.addPoints(series, data.getHeightPerYearData(), false, GAP_TOLERANCE);
+
+        generator.addAxisSeries(series, axidx, visible);
+        */
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org