Mercurial > dive4elements > river
changeset 1627:d1b20d0e9eb4
Let WDifferencesCurveGenerator process LONGITUDINAL_W facets.
flys-artifacts/trunk@2802 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 21 Sep 2011 13:53:09 +0000 |
parents | b9b47af71564 |
children | 16c74ca3586e |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java |
diffstat | 2 files changed, 62 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Wed Sep 21 13:49:50 2011 +0000 +++ b/flys-artifacts/ChangeLog Wed Sep 21 13:53:09 2011 +0000 @@ -1,3 +1,10 @@ +2011-09-21 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + Added WaterlevelOut-processing ability to WDifferencesCurveGenerator. + + * src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java: + Process LONGITUDINAL_W facets. + 2011-09-21 Felix Wolfsteller <felix.wolfsteller@intevation.de> Improved WDifferenceState in preparation to be able to deal with multiple
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java Wed Sep 21 13:49:50 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java Wed Sep 21 13:53:09 2011 +0000 @@ -18,6 +18,16 @@ import de.intevation.flys.artifacts.model.WKms; import de.intevation.flys.utils.DataUtil; +import de.intevation.flys.model.DischargeTable; +import de.intevation.flys.model.Gauge; +import de.intevation.flys.model.River; +import de.intevation.flys.model.TimeInterval; + +import de.intevation.flys.artifacts.WINFOArtifact; + +import de.intevation.flys.artifacts.model.WQKms; +import de.intevation.flys.utils.FLYSUtils; + /** @@ -80,13 +90,57 @@ if (name.equals(W_DIFFERENCES)) { doWDifferencesOut((WKms) f.getData(artifact, context), f.getDescription(), attr); } - else { + else if (name.equals(LONGITUDINAL_W)) { + WINFOArtifact flysArtifact = (WINFOArtifact) artifact; + facet = flysArtifact.getNativeFacet(facet); + + doWaterlevelOut((WQKms) facet.getData(artifact, context), f.getDescription(), attr, flysArtifact); + + } + else { logger.warn("Unknown facet name: " + name); return; } } + public void doWaterlevelOut(WQKms wqkms, + String description, + Document theme, + WINFOArtifact flysArtifact) { + String gaugeName = wqkms.getName(); + + River river = FLYSUtils.getRiver(flysArtifact); + + if (river == null) { + logger.debug("no river found"); + return; + } + + Gauge gauge = river.determineGaugeByName(gaugeName); + + if (gauge == null) { + logger.debug("no gauge found"); + return; + } + + String seriesName = "(tbd)Source for Diff."; + //getSeriesName(gauge); + + double [][] values = new double [][] { + wqkms.getQs(), wqkms.getWs() }; + + int size = values != null ? values[0].length : 0; + + XYSeries series = new StyledXYSeries(seriesName, theme); + + for (int i = 0; i < size; i++) { + series.add(values[0][i], values[1][i]); + } + + addSecondAxisSeries(series); + } + /** * Add items to dataseries which describes the differences. */