Mercurial > dive4elements > river
view artifacts/src/main/java/org/dive4elements/river/exports/process/BedWidthProcessor.java @ 7289:015e12aac2dc
issue1512: Adjusted Q and WOutProcessors to handle data
coming from FlowVelocityMeasurementArtifacts.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 11 Oct 2013 12:12:52 +0200 |
parents | 1508ee33f85f |
children | 4374a8d26706 |
line wrap: on
line source
/* 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.dive4elements.artifactdatabase.state.ArtifactAndFacet; import org.dive4elements.artifacts.CallContext; import org.dive4elements.river.artifacts.model.FacetTypes; import org.dive4elements.river.exports.DiagramGenerator; import org.dive4elements.river.exports.StyledSeriesBuilder; import org.dive4elements.river.jfree.StyledXYSeries; import org.dive4elements.river.themes.ThemeDocument; import org.dive4elements.river.artifacts.model.minfo.BedDiffYearResult; import org.dive4elements.river.artifacts.model.minfo.MorphologicWidth; public class BedWidthProcessor extends DefaultProcessor { private final static Logger logger = Logger.getLogger(BedWidthProcessor.class); public static final String I18N_AXIS_LABEL_DEFAULT = "Breite [m]"; public static final String I18N_AXIS_LABEL = "chart.beddifference.yaxis.label.morph"; @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); if (data instanceof BedDiffYearResult) { BedDiffYearResult bData = (BedDiffYearResult) data; StyledSeriesBuilder.addPoints(series, bData.getMorphWidthData(), true); } else if (data instanceof MorphologicWidth) { MorphologicWidth bData = (MorphologicWidth) data; StyledSeriesBuilder.addPoints(series, bData.getAsArray(), true); } else { logger.error("Unknown data for facet: " + bundle.getFacetName()); } generator.addAxisSeries(series, axisName, visible); } @Override public boolean canHandle(String facettype) { return facettype.equals(FacetTypes.BED_DIFFERENCE_MORPH_WIDTH) || facettype.equals(FacetTypes.MORPHOLOGIC_WIDTH); } @Override public String getAxisLabel(DiagramGenerator generator) { return generator.msg( I18N_AXIS_LABEL, I18N_AXIS_LABEL_DEFAULT); } }