Mercurial > dive4elements > river
changeset 7092:6563262052ab generator-refactoring
Add DiagramGenerator doOut function
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Mon, 23 Sep 2013 10:23:21 +0200 |
parents | c7d8adb91576 |
children | cdae0ff8960b |
files | artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffYearProcessor.java |
diffstat | 1 files changed, 33 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffYearProcessor.java Mon Sep 23 10:22:52 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffYearProcessor.java Mon Sep 23 10:23:21 2013 +0200 @@ -17,6 +17,7 @@ import org.dive4elements.river.artifacts.model.minfo.BedDiffYearResult; import org.dive4elements.river.exports.StyledSeriesBuilder; import org.dive4elements.river.exports.XYChartGenerator; +import org.dive4elements.river.exports.DiagramGenerator; import org.dive4elements.river.jfree.StyledXYSeries; import org.dive4elements.river.themes.ThemeDocument; @@ -31,6 +32,38 @@ @Override public void doOut( + DiagramGenerator generator, + ArtifactAndFacet bundle, + ThemeDocument theme, + boolean visible) { + CallContext context = generator.getCallContext(); + Object data = bundle.getData(context); + if (data instanceof BedDiffYearResult) { + String facetType = bundle.getFacetName(); + BedDiffYearResult bData = (BedDiffYearResult) data; + + double[][] points; + if (BED_DIFFERENCE_YEAR_HEIGHT1.equals(facetType)) { + points = bData.getHeights1Data(); + } else { + points = bData.getHeights2Data(); + } + XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme); + StyledSeriesBuilder.addPointsFactorY(series, + points, + false, + GAP_TOLERANCE, + 100d); + + generator.addAxisSeries(series, axisName, visible); + + return; + } + logger.error("Can't process " + data.getClass().getName() + " objects"); + } + + @Override + public void doOut( XYChartGenerator generator, ArtifactAndFacet bundle, ThemeDocument theme,