diff flys-artifacts/src/main/java/de/intevation/flys/exports/sq/SQRelationGenerator.java @ 3077:5c87d4ca1bd3

Added chart and export generator stubs for SQ relation. flys-artifacts/trunk@4672 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 15 Jun 2012 10:17:22 +0000
parents
children 8ad8a227d983
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/sq/SQRelationGenerator.java	Fri Jun 15 10:17:22 2012 +0000
@@ -0,0 +1,135 @@
+package de.intevation.flys.exports.sq;
+
+import org.apache.log4j.Logger;
+
+import org.jfree.chart.axis.LogarithmicAxis;
+import org.jfree.chart.axis.NumberAxis;
+
+import org.w3c.dom.Document;
+
+import de.intevation.artifactdatabase.state.ArtifactAndFacet;
+import de.intevation.artifactdatabase.state.Facet;
+
+import de.intevation.flys.artifacts.model.FacetTypes;
+import de.intevation.flys.exports.XYChartGenerator;
+
+/**
+ * An OutGenerator that generates charts for MINFO sq relation.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class SQRelationGenerator
+extends      XYChartGenerator
+implements   FacetTypes
+{
+    public enum YAXIS {
+        S(0);
+        protected int idx;
+        private YAXIS(int c) {
+           idx = c;
+        }
+    }
+
+    /** The logger that is used in this generator. */
+    private static Logger logger = Logger.getLogger(SQRelationGenerator.class);
+
+
+    @Override
+    protected YAxisWalker getYAxisWalker() {
+        return new YAxisWalker() {
+            @Override
+            public int length() {
+                return YAXIS.values().length;
+            }
+
+            @Override
+            public String getId(int idx) {
+                YAXIS[] yaxes = YAXIS.values();
+                return yaxes[idx].toString();
+            }
+        };
+    }
+
+
+    @Override
+    public String getDefaultChartTitle() {
+        return "TODO: CHART TITLE";
+    }
+
+
+    @Override
+    protected String getDefaultXAxisLabel() {
+        return "TODO: XAXIS LABEL";
+    }
+
+
+    @Override
+    protected String getDefaultYAxisLabel(int index) {
+        return "TODO: YAXIS LABEL " + index;
+    }
+
+
+    @Override
+    protected NumberAxis createYAxis(int index) {
+        return new LogarithmicAxis("TODO: LABEL " + index);
+    }
+
+
+    @Override
+    public void doOut(
+        ArtifactAndFacet artifactAndFacet,
+        Document         attr,
+        boolean          visible
+    ) {
+        logger.debug("doOut");
+
+        Facet  facet = artifactAndFacet.getFacet();
+        String name  = facet != null ? facet.getName() : null;
+
+        if (name == null || name.length() == 0) {
+            logger.warn("Invalid facet with no name given!");
+            return;
+        }
+
+        if (IS.SQ_CURVE(name)) {
+            doSQCurveOut(artifactAndFacet, attr, visible);
+        }
+        else if (IS.SQ_MEASUREMENT(name)) {
+            doSQMeasurementsOut(artifactAndFacet, attr, visible);
+        }
+        else if (IS.SQ_OUTLIER(name)) {
+            doSQOutliersOut(artifactAndFacet, attr, visible);
+        }
+    }
+
+
+    protected void doSQCurveOut(
+        ArtifactAndFacet artifactAndFacet,
+        Document         attr,
+        boolean          visible
+    ) {
+        logger.debug("doSQCurveOut");
+        logger.error("NOT IMPLEMENTED: doSQCurveOut");
+    }
+
+
+    protected void doSQMeasurementsOut(
+        ArtifactAndFacet artifactAndFacet,
+        Document         attr,
+        boolean          visible
+    ) {
+        logger.debug("doSQMeasurementsOut");
+        logger.error("NOT IMPLEMENTED: doSQMeasurementsOut");
+    }
+
+
+    protected void doSQOutliersOut(
+        ArtifactAndFacet artifactAndFacet,
+        Document         attr,
+        boolean          visible
+    ) {
+        logger.debug("doSQOutliersOut");
+        logger.error("NOT IMPLEMENTED: doSQOutliersOut");
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org