# HG changeset patch # User Felix Wolfsteller # Date 1316613189 0 # Node ID d1b20d0e9eb4a2e1992a585233d00b1d08351ce8 # Parent b9b47af715644b5f7136b44e95fe2eaeed5628e6 Let WDifferencesCurveGenerator process LONGITUDINAL_W facets. flys-artifacts/trunk@2802 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r b9b47af71564 -r d1b20d0e9eb4 flys-artifacts/ChangeLog --- 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 + + Added WaterlevelOut-processing ability to WDifferencesCurveGenerator. + + * src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java: + Process LONGITUDINAL_W facets. + 2011-09-21 Felix Wolfsteller Improved WDifferenceState in preparation to be able to deal with multiple diff -r b9b47af71564 -r d1b20d0e9eb4 flys-artifacts/src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java --- 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. */