Mercurial > dive4elements > river
changeset 7523:ce90d2f4ee46
issue1664: Add new Processors to old axis and map them in longitudinal-diagram-defaults.
Sorry for simultaneous formatting changes.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 06 Nov 2013 12:03:38 +0100 (2013-11-06) |
parents | f062802c9a4a |
children | 25d890e3eb69 |
files | artifacts/doc/conf/longitudinal-diagram-defaults.xml artifacts/src/main/java/org/dive4elements/river/exports/process/FixDeltaWAProcessor.java artifacts/src/main/java/org/dive4elements/river/exports/process/FixDeltaWProcessor.java |
diffstat | 3 files changed, 182 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/doc/conf/longitudinal-diagram-defaults.xml Wed Nov 06 11:57:35 2013 +0100 +++ b/artifacts/doc/conf/longitudinal-diagram-defaults.xml Wed Nov 06 12:03:38 2013 +0100 @@ -26,20 +26,22 @@ <processor class="org.dive4elements.river.exports.process.AnnotationProcessor" axis="none"/> <processor class="org.dive4elements.river.exports.process.AreaProcessor" axis="none"/> <processor class="org.dive4elements.river.exports.process.WDiffProcessor" axis="diffW"/> - <processor class="org.dive4elements.river.exports.process.WOutProcessor" axis="W"/> - <processor class="org.dive4elements.river.exports.process.QOutProcessor" axis="Q"/> - <processor class="org.dive4elements.river.exports.process.BedHeightSoundingProcessor" axis="SoundingWidth"/> - <processor class="org.dive4elements.river.exports.process.BedWidthProcessor" axis="Width"/> - <processor class="org.dive4elements.river.exports.process.BedDiffYearProcessor" axis="diffBed"/> - <processor class="org.dive4elements.river.exports.process.BedDiffHeightYearProcessor" axis="diffBed/Y"/> - <processor class="org.dive4elements.river.exports.process.MiddleBedHeightProcessor" axis="BedHeight"/> + <processor class="org.dive4elements.river.exports.process.WOutProcessor" axis="W"/> + <processor class="org.dive4elements.river.exports.process.QOutProcessor" axis="Q"/> + <processor class="org.dive4elements.river.exports.process.BedHeightSoundingProcessor" axis="SoundingWidth"/> + <processor class="org.dive4elements.river.exports.process.BedWidthProcessor" axis="Width"/> + <processor class="org.dive4elements.river.exports.process.FixDeltaWProcessor" axis="diffBed"/> + <processor class="org.dive4elements.river.exports.process.BedDiffYearProcessor" axis="diffBed"/> + <processor class="org.dive4elements.river.exports.process.FixDeltaWAProcessor" axis="diffBed/Y"/> + <processor class="org.dive4elements.river.exports.process.BedDiffHeightYearProcessor" axis="diffBed/Y"/> + <processor class="org.dive4elements.river.exports.process.MiddleBedHeightProcessor" axis="BedHeight"/> <processor class="org.dive4elements.river.exports.process.BedQualityDiameterProcessor" axis="Diameter"/> <processor class="org.dive4elements.river.exports.process.BedQualityPorosityProcessor" axis="Porosity"/> - <processor class="org.dive4elements.river.exports.process.BedQualityDensityProcessor" axis="Density"/> - <processor class="org.dive4elements.river.exports.process.SedimentLoadTAProcessor" axis="SedimentLoadTA"/> - <processor class="org.dive4elements.river.exports.process.SedimentLoadM3AProcessor" axis="SedimentLoadM3A"/> - <processor class="org.dive4elements.river.exports.process.FlowVelocityProcessor" axis="Velocity"/> - <processor class="org.dive4elements.river.exports.process.ShearStressProcessor" axis="Tau"/> - <processor class="org.dive4elements.river.exports.process.SedimentDensityProcessor" axis="Density"/> - <processor class="org.dive4elements.river.exports.process.BedHeightProcessor" axis="Height"/> + <processor class="org.dive4elements.river.exports.process.BedQualityDensityProcessor" axis="Density"/> + <processor class="org.dive4elements.river.exports.process.SedimentLoadTAProcessor" axis="SedimentLoadTA"/> + <processor class="org.dive4elements.river.exports.process.SedimentLoadM3AProcessor" axis="SedimentLoadM3A"/> + <processor class="org.dive4elements.river.exports.process.FlowVelocityProcessor" axis="Velocity"/> + <processor class="org.dive4elements.river.exports.process.ShearStressProcessor" axis="Tau"/> + <processor class="org.dive4elements.river.exports.process.SedimentDensityProcessor" axis="Density"/> + <processor class="org.dive4elements.river.exports.process.BedHeightProcessor" axis="Height"/> </longitudinal-defaults>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/FixDeltaWAProcessor.java Wed Nov 06 12:03:38 2013 +0100 @@ -0,0 +1,83 @@ +/* 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.artifacts.model.WKms; +import org.dive4elements.river.exports.StyledSeriesBuilder; +import org.dive4elements.river.exports.DiagramGenerator; +import org.dive4elements.river.jfree.StyledAreaSeriesCollection; +import org.dive4elements.river.jfree.StyledXYSeries; +import org.dive4elements.river.themes.ThemeDocument; + + +public class FixDeltaWAProcessor +extends DefaultProcessor implements FacetTypes { + + private final static Logger logger = + Logger.getLogger(FixDeltaWAProcessor.class); + + public static final String I18N_AXIS_LABEL = + "chart.beddifference.height.yaxis.label"; + public static final String I18N_AXIS_LABEL_DEFAULT = + "delta S [cm / Jahr]"; + + @Override + public void doOut( + DiagramGenerator generator, + ArtifactAndFacet bundle, + ThemeDocument theme, + boolean visible) { + CallContext context = generator.getCallContext(); + Object data = bundle.getData(context); + + XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme); + + // Handle WKms data. + WKms wkms = (WKms) data; + + StyledSeriesBuilder.addPoints(series, wkms); + generator.addAxisSeries(series, axisName, visible); + + // If a "band around the curve shall be drawn, add according area. + double bandWidth = theme.parseBandWidth(); + if (bandWidth > 0 ) { + XYSeries seriesDown = new StyledXYSeries( + "band " + bundle.getFacetDescription(), false, theme); + XYSeries seriesUp = new StyledXYSeries( + bundle.getFacetDescription()+"+/-"+bandWidth, false, theme); + StyledSeriesBuilder.addUpperBand(seriesUp, wkms, bandWidth); + StyledSeriesBuilder.addLowerBand(seriesDown, wkms, bandWidth); + + StyledAreaSeriesCollection area = new StyledAreaSeriesCollection(theme); + area.addSeries(seriesUp); + area.addSeries(seriesDown); + area.setMode(StyledAreaSeriesCollection.FILL_MODE.BETWEEN); + generator.addAreaSeries(area, axisName, visible); + } + } + + @Override + public boolean canHandle(String facetType) { + return STATIC_DELTA_W_CMA.equals(facetType); + } + + @Override + public String getAxisLabel(DiagramGenerator generator) { + return generator.msg( + I18N_AXIS_LABEL, + I18N_AXIS_LABEL_DEFAULT); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/FixDeltaWProcessor.java Wed Nov 06 12:03:38 2013 +0100 @@ -0,0 +1,83 @@ +/* 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.WKms; +import org.dive4elements.river.artifacts.model.FacetTypes; +import org.dive4elements.river.exports.StyledSeriesBuilder; +import org.dive4elements.river.exports.DiagramGenerator; +import org.dive4elements.river.jfree.StyledAreaSeriesCollection; +import org.dive4elements.river.jfree.StyledXYSeries; +import org.dive4elements.river.themes.ThemeDocument; + + +public class FixDeltaWProcessor +extends DefaultProcessor implements FacetTypes { + + private final static Logger logger = + Logger.getLogger(FixDeltaWProcessor.class); + + public static final String I18N_AXIS_LABEL = + "chart.beddifference.yaxis.label.diff"; + public static final String I18N_AXIS_LABEL_DEFAULT = + "delta S [cm]"; + + @Override + public void doOut( + DiagramGenerator generator, + ArtifactAndFacet bundle, + ThemeDocument theme, + boolean visible) { + CallContext context = generator.getCallContext(); + Object data = bundle.getData(context); + + XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme); + + // Handle WKms data. + WKms wkms = (WKms) data; + + StyledSeriesBuilder.addPoints(series, wkms); + generator.addAxisSeries(series, axisName, visible); + + // If a "band around the curve shall be drawn, add according area. + double bandWidth = theme.parseBandWidth(); + if (bandWidth > 0 ) { + XYSeries seriesDown = new StyledXYSeries( + "band " + bundle.getFacetDescription(), false, theme); + XYSeries seriesUp = new StyledXYSeries( + bundle.getFacetDescription()+"+/-"+bandWidth, false, theme); + StyledSeriesBuilder.addUpperBand(seriesUp, wkms, bandWidth); + StyledSeriesBuilder.addLowerBand(seriesDown, wkms, bandWidth); + + StyledAreaSeriesCollection area = new StyledAreaSeriesCollection(theme); + area.addSeries(seriesUp); + area.addSeries(seriesDown); + area.setMode(StyledAreaSeriesCollection.FILL_MODE.BETWEEN); + generator.addAreaSeries(area, axisName, visible); + } + } + + @Override + public boolean canHandle(String facetType) { + return STATIC_DELTA_W.equals(facetType); + } + + @Override + public String getAxisLabel(DiagramGenerator generator) { + return generator.msg( + I18N_AXIS_LABEL, + I18N_AXIS_LABEL_DEFAULT); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :