Mercurial > dive4elements > river
changeset 8207:de280599dd2f
Added new processor for fix derived curve.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Fri, 05 Sep 2014 16:54:45 +0200 (2014-09-05) |
parents | 436512d9bd94 |
children | 2badb2ca5f89 |
files | artifacts/doc/conf/generators/discharge-diagram-defaults.xml artifacts/src/main/java/org/dive4elements/river/exports/process/FixDerivedProcessor.java |
diffstat | 2 files changed, 59 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/doc/conf/generators/discharge-diagram-defaults.xml Fri Sep 05 15:57:39 2014 +0200 +++ b/artifacts/doc/conf/generators/discharge-diagram-defaults.xml Fri Sep 05 16:54:45 2014 +0200 @@ -11,4 +11,5 @@ <processor class="org.dive4elements.river.exports.process.ComputedDischargeProcessor" axis="W"/> <processor class="org.dive4elements.river.exports.process.HistoricalDischargeProcessor" axis="W"/> <processor class="org.dive4elements.river.exports.process.FixWQProcessor" axis="W"/> + <processor class="org.dive4elements.river.exports.process.FixDerivedProcessor" axis="W"/> </discharge-defaults>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/FixDerivedProcessor.java Fri Sep 05 16:54:45 2014 +0200 @@ -0,0 +1,58 @@ +package org.dive4elements.river.exports.process; + +import org.apache.log4j.Logger; +import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; +import org.dive4elements.river.artifacts.model.FacetTypes; +import org.dive4elements.river.artifacts.model.fixings.FixDerivateFacet; +import org.dive4elements.river.artifacts.model.fixings.FixFunction; +import org.dive4elements.river.exports.DiagramGenerator; +import org.dive4elements.river.jfree.JFreeUtil; +import org.dive4elements.river.jfree.StyledXYSeries; +import org.dive4elements.river.themes.ThemeDocument; + + +public class FixDerivedProcessor +extends DefaultProcessor +implements FacetTypes +{ + + private static Logger log = Logger.getLogger(FixDerivedProcessor.class); + + public FixDerivedProcessor() { + } + + @Override + public void doOut( + DiagramGenerator generator, + ArtifactAndFacet bundle, + ThemeDocument theme, + boolean visible + ) { + FixDerivateFacet facet = (FixDerivateFacet)bundle.getFacet(); + FixFunction func = (FixFunction)facet.getData( + bundle.getArtifact(), generator.getCallContext()); + + if (func == null) { + log.warn("doOut: Facet does not contain FixFunction"); + return; + } + + double maxQ = func.getMaxQ(); + + if (maxQ > 0) { + StyledXYSeries series = JFreeUtil.sampleFunction2D( + func.getFunction(), + theme, + bundle.getFacetDescription(), + 500, // number of samples + 0.0 , // start + maxQ); // end + generator.addAxisSeries(series, axisName, visible); + } + } + + @Override + public boolean canHandle(String facettype) { + return FIX_DERIVATE_CURVE.equals(facettype); + } +}