Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java @ 2020:4f7f781e4481
Improved area rendering workflow.
flys-artifacts/trunk@3475 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 20 Dec 2011 06:47:08 +0000 |
parents | 5aecebcc4698 |
children | 76cedac30d35 |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java Tue Dec 20 06:39:20 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java Tue Dec 20 06:47:08 2011 +0000 @@ -148,7 +148,7 @@ attr, visible); } - else if (name.equals(AREA)) { + else if (FacetTypes.IS.AREA(name)) { doArea(artifactFacet.getData(context), artifactFacet.getFacetDescription(), attr, @@ -160,6 +160,7 @@ } } + /** * Do Area out. */ @@ -170,16 +171,43 @@ boolean visible ) { logger.debug("CrossSectionGenerator.doArea"); + StyledAreaSeriesCollection area = new StyledAreaSeriesCollection(theme); // TODO make this more stable. Object[] doubles = (Object[]) o; - XYSeries up = new StyledXYSeries("up", false, theme); - XYSeries down = new StyledXYSeries("down", false, theme); - StyledSeriesBuilder.addPoints(up, (double [][]) doubles[0]); - StyledSeriesBuilder.addPoints(down, (double [][]) doubles[1]); - addAreaSeries(up, down, 0, visible); + XYSeries up = null; + XYSeries down = null; + + if (doubles[1] != null) { + up = new StyledXYSeries(seriesName, false, theme); + StyledSeriesBuilder.addPoints(up, (double [][]) doubles[1]); + } + + if (doubles[0] != null) { + // TODO: Sort this out: when the two series have the same name, + // the renderer (or anything in between) will not work correctly. + down = new StyledXYSeries(seriesName + " ", false, theme); + StyledSeriesBuilder.addPoints(down, (double [][]) doubles[0]); + } + + if (up == null && down != null) { + area.setMode(StyledAreaSeriesCollection.FILL_MODE.ABOVE); + down.setKey(seriesName); + area.addSeries(down); + } + else if (up != null && down == null) { + area.setMode(StyledAreaSeriesCollection.FILL_MODE.UNDER); + area.addSeries(up); + } + else if (up != null && down != null) { + area.setMode(StyledAreaSeriesCollection.FILL_MODE.BETWEEN); + area.addSeries(up); + area.addSeries(down); + } + addAreaSeries(area, 0, visible); } + /** * Do cross sections waterline out. *