[PATCH 1 of 7] Initial DischargeProcessor-commit (skeleton)

Wald Commits scm-commit at wald.intevation.org
Wed Aug 21 11:03:01 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1376996583 -7200
# Node ID 9b35bf3227e91d5bca30cd564413c790d73815e3
# Parent  2d96d8240e3efe91a5305b6c1ad741c5c9ed8185
Initial DischargeProcessor-commit (skeleton).

diff -r 2d96d8240e3e -r 9b35bf3227e9 artifacts/src/main/java/org/dive4elements/river/exports/process/DischargeProcessor.java
--- /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 :


More information about the Dive4elements-commits mailing list