[PATCH 18 of 19] Initial commit of sediment density processor
Wald Commits
scm-commit at wald.intevation.org
Mon Sep 30 17:30:43 CEST 2013
# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1380555642 -7200
# Node ID 8817bb81cf27ddc952112f966d3e40428c04af75
# Parent c453f7ecf479006a56788e97c62361b1a9678631
Initial commit of sediment density processor.
diff -r c453f7ecf479 -r 8817bb81cf27 artifacts/src/main/java/org/dive4elements/river/exports/process/SedimentDensityProcessor.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/SedimentDensityProcessor.java Mon Sep 30 17:40:42 2013 +0200
@@ -0,0 +1,73 @@
+/* Copyright (C) 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.dive4elements.artifactdatabase.state.ArtifactAndFacet;
+import org.dive4elements.artifacts.CallContext;
+
+import org.dive4elements.river.artifacts.model.FacetTypes;
+import org.dive4elements.river.artifacts.model.minfo.SedimentDensity;
+
+import org.dive4elements.river.exports.DiagramGenerator;
+import org.dive4elements.river.exports.StyledSeriesBuilder;
+import org.dive4elements.river.jfree.StyledXYSeries;
+import org.dive4elements.river.themes.ThemeDocument;
+
+
+/** Process Sediment Density data. */
+public class SedimentDensityProcessor extends DefaultProcessor {
+
+ /** Private logger. */
+ private final static Logger logger =
+ Logger.getLogger(SedimentDensityProcessor.class);
+
+ public static final String I18N_AXIS_LABEL_DEFAULT =
+ "Sedimentdichte [t/m^3]";
+ public static final String I18N_AXIS_LABEL =
+ "chart.yaxis.label.sedimentdensity";
+
+ @Override
+ public void doOut(
+ DiagramGenerator generator,
+ ArtifactAndFacet bundle,
+ ThemeDocument theme,
+ boolean visible) {
+ CallContext context = generator.getCallContext();
+ XYSeries series = new StyledXYSeries(bundle.getFacetDescription(),
+ theme);
+ Object data = bundle.getData(context);
+ String facetName = bundle.getFacetName();
+ double [][] points;
+
+ if (facetName.equals(FacetTypes.SEDIMENT_DENSITY)) {
+ points =((SedimentDensity) data).getDensities(2006);
+ } else {
+ logger.error("Unknown facet name: " + facetName);
+ return;
+ }
+ StyledSeriesBuilder.addPoints(series, points, true);
+
+ generator.addAxisSeries(series, axisName, visible);
+ }
+
+ @Override
+ public boolean canHandle(String facettype) {
+ return facettype.equals(FacetTypes.SEDIMENT_DENSITY);
+ }
+
+ @Override
+ public String getAxisLabel(DiagramGenerator generator) {
+ return generator.msg(
+ I18N_AXIS_LABEL,
+ I18N_AXIS_LABEL_DEFAULT);
+ }
+}
More information about the Dive4elements-commits
mailing list