Mercurial > dive4elements > river
changeset 6567:e8de5e135bf3
Moved BedDiffYearProcessor to BedDiffHeightYearProcessor.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Mon, 15 Jul 2013 12:31:01 +0200 |
parents | 88b9b666872e |
children | ae00ab7025ec |
files | artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDiffHeightYearGenerator.java artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffHeightYearProcessor.java artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffYearProcessor.java |
diffstat | 3 files changed, 74 insertions(+), 73 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDiffHeightYearGenerator.java Mon Jul 15 12:24:25 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDiffHeightYearGenerator.java Mon Jul 15 12:31:01 2013 +0200 @@ -19,7 +19,7 @@ import org.dive4elements.river.artifacts.model.minfo.BedDifferencesResult; import org.dive4elements.river.exports.StyledSeriesBuilder; import org.dive4elements.river.exports.fixings.FixChartGenerator; -import org.dive4elements.river.exports.process.BedDiffYearProcessor; +import org.dive4elements.river.exports.process.BedDiffHeightYearProcessor; import org.dive4elements.river.exports.process.KMIndexProcessor; import org.dive4elements.river.exports.process.Processor; import org.dive4elements.river.jfree.Bounds; @@ -96,7 +96,7 @@ } Processor processor = new KMIndexProcessor(); - Processor bdyProcessor = new BedDiffYearProcessor(); + Processor bdyProcessor = new BedDiffHeightYearProcessor(); if (name.equals(LONGITUDINAL_ANNOTATION)) { doAnnotations( (RiverAnnotation) bundle.getData(context),
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffHeightYearProcessor.java Mon Jul 15 12:31:01 2013 +0200 @@ -0,0 +1,72 @@ +/* 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 java.util.List; + +import org.apache.log4j.Logger; +import org.jfree.data.xy.XYSeries; +import org.w3c.dom.Document; + +import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; +import org.dive4elements.artifacts.CallContext; +import org.dive4elements.river.artifacts.model.FacetTypes; +import org.dive4elements.river.artifacts.model.minfo.BedHeightSingle; +import org.dive4elements.river.artifacts.model.minfo.BedDiffYearResult; +import org.dive4elements.river.exports.StyledSeriesBuilder; +import org.dive4elements.river.exports.XYChartGenerator; +import org.dive4elements.river.jfree.StyledXYSeries; +import org.dive4elements.river.model.BedHeightSingleValue; + + +public class BedDiffHeightYearProcessor implements Processor, FacetTypes { + + private final static Logger logger = + Logger.getLogger(BedDiffHeightYearProcessor.class); + + @Override + public void doOut( + XYChartGenerator generator, + ArtifactAndFacet aandf, + Document theme, + boolean visible, + int index + ) { + CallContext context = generator.getCallContext(); + Object data = aandf.getData(context); + if (data instanceof BedDiffYearResult) { + doBedDifferenceYearOut( + generator, + (BedDiffYearResult) data, + aandf, theme, visible, index); + return; + } + logger.error("Can't process " + data.getClass().getName() + " objects"); + } + + @Override + public boolean canHandle(String facetType) { + return BED_DIFFERENCE_HEIGHT_YEAR.equals(facetType) + || BED_DIFFERENCE_HEIGHT_YEAR_FILTERED.equals(facetType); + } + + protected void doBedDifferenceYearOut(XYChartGenerator generator, + BedDiffYearResult data, + ArtifactAndFacet aandf, + Document theme, + boolean visible, + int axidx) { + + XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); + StyledSeriesBuilder.addPoints(series, data.getHeightPerYearData(), true); + + generator.addAxisSeries(series, axidx, visible); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffYearProcessor.java Mon Jul 15 12:24:25 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/* 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 java.util.List; - -import org.apache.log4j.Logger; -import org.jfree.data.xy.XYSeries; -import org.w3c.dom.Document; - -import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; -import org.dive4elements.artifacts.CallContext; -import org.dive4elements.river.artifacts.model.FacetTypes; -import org.dive4elements.river.artifacts.model.minfo.BedHeightSingle; -import org.dive4elements.river.artifacts.model.minfo.BedDiffYearResult; -import org.dive4elements.river.exports.StyledSeriesBuilder; -import org.dive4elements.river.exports.XYChartGenerator; -import org.dive4elements.river.jfree.StyledXYSeries; -import org.dive4elements.river.model.BedHeightSingleValue; - - -public class BedDiffYearProcessor implements Processor, FacetTypes { - - private final static Logger logger = - Logger.getLogger(BedDiffYearProcessor.class); - - @Override - public void doOut( - XYChartGenerator generator, - ArtifactAndFacet aandf, - Document theme, - boolean visible, - int index - ) { - CallContext context = generator.getCallContext(); - Object data = aandf.getData(context); - if (data instanceof BedDiffYearResult) { - doBedDifferenceYearOut( - generator, - (BedDiffYearResult) data, - aandf, theme, visible, index); - return; - } - logger.error("Can't process " + data.getClass().getName() + " objects"); - } - - @Override - public boolean canHandle(String facetType) { - return BED_DIFFERENCE_HEIGHT_YEAR.equals(facetType) - || BED_DIFFERENCE_HEIGHT_YEAR_FILTERED.equals(facetType); - } - - protected void doBedDifferenceYearOut(XYChartGenerator generator, - BedDiffYearResult data, - ArtifactAndFacet aandf, - Document theme, - boolean visible, - int axidx) { - - XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); - StyledSeriesBuilder.addPoints(series, data.getHeightPerYearData(), true); - - generator.addAxisSeries(series, axidx, visible); - } -}