Mercurial > dive4elements > river
changeset 7126:05d442db4ca6
Add MiddleBedHeightProcessor
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Wed, 25 Sep 2013 10:25:10 +0200 |
parents | 2237bb25a8f2 |
children | 1106f580420c |
files | artifacts/src/main/java/org/dive4elements/river/exports/process/MiddleBedHeightProcessor.java |
diffstat | 1 files changed, 79 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/MiddleBedHeightProcessor.java Wed Sep 25 10:25:10 2013 +0200 @@ -0,0 +1,79 @@ +/* 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.MiddleBedHeightData; +import org.dive4elements.river.artifacts.D4EArtifact; +import org.dive4elements.river.artifacts.model.FacetTypes; +import org.dive4elements.river.themes.ThemeDocument; +import org.dive4elements.river.exports.DiagramGenerator; +import org.dive4elements.river.exports.StyledSeriesBuilder; +import org.dive4elements.river.utils.RiverUtils; +import org.dive4elements.river.jfree.StyledXYSeries; + +public class MiddleBedHeightProcessor extends DefaultProcessor { + + /** Private logger. */ + private static final Logger logger = + Logger.getLogger(WOutProcessor.class); + + public static final String I18N_AXIS_LABEL = + "chart.bedheight_middle.section.yaxis.label"; + + public static final String I18N_AXIS_LABEL_DEFAULT = + "mittlere Sohlhöhen [müNN]"; + + @Override + public void doOut( + DiagramGenerator generator, + ArtifactAndFacet bundle, + ThemeDocument theme, + boolean visible) { + CallContext context = generator.getCallContext(); + logger.debug("Processing: " + bundle.getFacetName()); + MiddleBedHeightData data = + (MiddleBedHeightData) bundle.getData(context); + + XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), + theme); + + StyledSeriesBuilder.addPoints(series, data.getMiddleHeightsPoints(), + false, 0.110d); + + generator.addAxisSeries(series, axisName, visible); + } + + @Override + public String getAxisLabel(DiagramGenerator generator) { + D4EArtifact flys = (D4EArtifact) generator.getMaster(); + + String unit = RiverUtils.getRiver(flys).getWstUnit().getName(); + + return generator.msg( + I18N_AXIS_LABEL, + I18N_AXIS_LABEL_DEFAULT, + new Object[] { unit }); + } + + @Override + public boolean canHandle(String facetType) { + if (facetType == null) { + return false; + } + return facetType.equals(FacetTypes.MIDDLE_BED_HEIGHT_EPOCH) || + facetType.equals(FacetTypes.MIDDLE_BED_HEIGHT_SINGLE); + } +}