[Dive4elements-commits] [PATCH 7 of 7] Added chart generator for sediment load output
Wald Commits
scm-commit at wald.intevation.org
Fri Nov 2 14:59:41 CET 2012
# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1351864731 -3600
# Node ID e596b2cc9f38c68529946b2f020f8e6cd0b83d1f
# Parent 1fb224bb2c6b41cc3919ba760fd58cd6b634dce3
Added chart generator for sediment load output.
The generator builds a longitudinal section chart containing sediment loads.
diff -r 1fb224bb2c6b -r e596b2cc9f38 flys-artifacts/doc/conf/conf.xml
--- a/flys-artifacts/doc/conf/conf.xml Fri Nov 02 14:54:29 2012 +0100
+++ b/flys-artifacts/doc/conf/conf.xml Fri Nov 02 14:58:51 2012 +0100
@@ -341,6 +341,8 @@
<output-generator name="fix_waterlevel_export">de.intevation.flys.exports.WaterlevelExporter</output-generator>
<output-generator name="fix_vollmer_wq_curve">de.intevation.flys.exports.fixings.FixWQCurveGenerator</output-generator>
<output-generator name="fix_vollmer_wq_curve_chartinfo">de.intevation.flys.exports.fixings.FixWQCurveInfoGenerator</output-generator>
+ <output-generator name="sedimentload_ls">de.intevation.flys.exports.minfo.SedimentLoadLSGenerator</output-generator>
+ <output-generator name="sedimentload_ls_chartinfo">de.intevation.flys.exports.minfo.SedimentLoadLSInfoGenerator</output-generator>
<!-- Error report generators. -->
<output-generator name="discharge_longitudinal_section_report">de.intevation.flys.exports.ReportGenerator</output-generator>
<output-generator name="waterlevel_report">de.intevation.flys.exports.ReportGenerator</output-generator>
diff -r 1fb224bb2c6b -r e596b2cc9f38 flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/SedimentLoadLSGenerator.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/SedimentLoadLSGenerator.java Fri Nov 02 14:58:51 2012 +0100
@@ -0,0 +1,217 @@
+package de.intevation.flys.exports.minfo;
+
+import org.apache.log4j.Logger;
+import org.jfree.data.xy.XYSeries;
+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.artifacts.model.minfo.SedimentLoadResult;
+import de.intevation.flys.exports.StyledSeriesBuilder;
+import de.intevation.flys.exports.XYChartGenerator;
+import de.intevation.flys.jfree.FLYSAnnotation;
+import de.intevation.flys.jfree.StyledXYSeries;
+
+
+public class SedimentLoadLSGenerator
+extends XYChartGenerator
+implements FacetTypes
+{
+ public enum YAXIS {
+ L(0);
+
+ protected int idx;
+
+ private YAXIS(int c) {
+ idx = c;
+ }
+ }
+ /** The logger that is used in this generator. */
+ private static Logger logger = Logger.getLogger(BedQualityGenerator.class);
+
+ public static final String I18N_CHART_TITLE = "chart.beddifference.epoch.title";
+ public static final String I18N_XAXIS_LABEL = "chart.beddifference.xaxis.label";
+ public static final String I18N_YAXIS_LABEL = "chart.beddifference.yaxis.label.diff";
+ public static final String I18N_SECOND_YAXIS_LABEL = "chart.beddifference.yaxis.label.height";
+
+ public static final String I18N_CHART_TITLE_DEFAULT = "Sohlenhöhen Differenz";
+ public static final String I18N_XAXIS_LABEL_DEFAULT = "Fluss-Km";
+ public static final String I18N_YAXIS_LABEL_DEFAULT = "delta S [m]";
+ public static final String I18N_SECOND_YAXIS_LABEL_DEFAULT = "Höhe [m]";
+
+ @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 void doOut(ArtifactAndFacet bundle, Document attr, boolean visible) {
+ String name = bundle.getFacetName();
+
+ logger.debug("doOut: " + name);
+
+ if (name == null) {
+ logger.error("No facet name for doOut(). No output generated!");
+ return;
+ }
+
+ Facet facet = bundle.getFacet();
+
+ if (facet == null) {
+ return;
+ }
+
+ if (name.equals(SEDIMENT_LOAD_COARSE)) {
+ doSedimentLoadCoarseOut(
+ (SedimentLoadResult) bundle.getData(context),
+ bundle,
+ attr,
+ visible);
+ }
+ else if (name.equals(SEDIMENT_LOAD_SAND)) {
+ doSedimentLoadSandOut(
+ (SedimentLoadResult) bundle.getData(context),
+ bundle,
+ attr,
+ visible);
+ }
+ else if (name.equals(SEDIMENT_LOAD_FINEMIDDLE)) {
+ doSedimentLoadFineMiddleOut(
+ (SedimentLoadResult) bundle.getData(context),
+ bundle,
+ attr,
+ visible);
+ }
+ else if (name.equals(SEDIMENT_LOAD_SUSP_SAND)) {
+ doSedimentLoadSandOut(
+ (SedimentLoadResult) bundle.getData(context),
+ bundle,
+ attr,
+ visible);
+ }
+ else if (name.equals(SEDIMENT_LOAD_SUSP_SAND_BED)) {
+ doSedimentLoadSuspSandBedOut(
+ (SedimentLoadResult) bundle.getData(context),
+ bundle,
+ attr,
+ visible);
+ }
+ else if (name.equals(SEDIMENT_LOAD_SUSP_SEDIMENT)) {
+ doSedimentLoadSuspSedimentOut(
+ (SedimentLoadResult) bundle.getData(context),
+ bundle,
+ attr,
+ visible);
+ }
+ else if (name.equals(SEDIMENT_LOAD_TOTAL)) {
+ doSedimentLoadTotalOut(
+ (SedimentLoadResult) bundle.getData(context),
+ bundle,
+ attr,
+ visible);
+ }
+ else if (name.equals(LONGITUDINAL_ANNOTATION)) {
+ doAnnotations(
+ (FLYSAnnotation) bundle.getData(context),
+ bundle,
+ attr,
+ visible);
+ }
+ }
+
+ @Override
+ protected String getDefaultChartTitle() {
+ return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT);
+ }
+
+ @Override
+ protected String getDefaultXAxisLabel() {
+ return msg(I18N_XAXIS_LABEL, I18N_XAXIS_LABEL_DEFAULT);
+ }
+
+ @Override
+ protected String getDefaultYAxisLabel(int pos) {
+ String label = "default";
+ if (pos == YAXIS.L.idx) {
+ label = msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT);
+ }
+ return label;
+ }
+
+ protected void doSedimentLoadCoarseOut(SedimentLoadResult data,
+ ArtifactAndFacet aandf, Document theme, boolean visible) {
+
+ XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
+ StyledSeriesBuilder.addPoints(series, data.getCoarseData(), true);
+
+ addAxisSeries(series, YAXIS.L.idx, visible);
+ }
+
+ protected void doSedimentLoadSandOut(SedimentLoadResult data,
+ ArtifactAndFacet aandf, Document theme, boolean visible) {
+
+ XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
+ StyledSeriesBuilder.addPoints(series, data.getSandData(), true);
+
+ addAxisSeries(series, YAXIS.L.idx, visible);
+ }
+
+ protected void doSedimentLoadFineMiddleOut(SedimentLoadResult data,
+ ArtifactAndFacet aandf, Document theme, boolean visible) {
+
+ XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
+ StyledSeriesBuilder.addPoints(series, data.getFineMiddleData(), true);
+
+ addAxisSeries(series, YAXIS.L.idx, visible);
+ }
+
+ protected void doSedimentLoadSuspSandOut(SedimentLoadResult data,
+ ArtifactAndFacet aandf, Document theme, boolean visible) {
+
+ XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
+ StyledSeriesBuilder.addPoints(series, data.getSuspSandData(), true);
+
+ addAxisSeries(series, YAXIS.L.idx, visible);
+ }
+
+ protected void doSedimentLoadSuspSandBedOut(SedimentLoadResult data,
+ ArtifactAndFacet aandf, Document theme, boolean visible) {
+
+ XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
+ StyledSeriesBuilder.addPoints(series, data.getSuspSandBedData(), true);
+
+ addAxisSeries(series, YAXIS.L.idx, visible);
+ }
+
+ protected void doSedimentLoadSuspSedimentOut(SedimentLoadResult data,
+ ArtifactAndFacet aandf, Document theme, boolean visible) {
+
+ XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
+ StyledSeriesBuilder.addPoints(series, data.getSuspSedimentData(), true);
+
+ addAxisSeries(series, YAXIS.L.idx, visible);
+ }
+
+ protected void doSedimentLoadTotalOut(SedimentLoadResult data,
+ ArtifactAndFacet aandf, Document theme, boolean visible) {
+
+ XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
+ StyledSeriesBuilder.addPoints(series, data.getTotalData(), true);
+
+ addAxisSeries(series, YAXIS.L.idx, visible);
+ }
+
+}
diff -r 1fb224bb2c6b -r e596b2cc9f38 flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/SedimentLoadLSInfoGenerator.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/SedimentLoadLSInfoGenerator.java Fri Nov 02 14:58:51 2012 +0100
@@ -0,0 +1,12 @@
+package de.intevation.flys.exports.minfo;
+
+import de.intevation.flys.exports.ChartInfoGenerator;
+
+
+public class SedimentLoadLSInfoGenerator
+extends ChartInfoGenerator
+{
+ public SedimentLoadLSInfoGenerator() {
+ super(new SedimentLoadLSGenerator());
+ }
+}
More information about the Dive4elements-commits
mailing list