Mercurial > dive4elements > river
changeset 1695:0c9f7cc2cc11
In WDifferenceCurveGenerator use slightly modified doWOut-implementation of LongitudinalSectionGenerator.
flys-artifacts/trunk@2922 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Mon, 10 Oct 2011 10:27:45 +0000 |
parents | 2b9f0ca1449b |
children | 56953439dcae |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java |
diffstat | 2 files changed, 29 insertions(+), 52 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Mon Oct 10 10:12:51 2011 +0000 +++ b/flys-artifacts/ChangeLog Mon Oct 10 10:27:45 2011 +0000 @@ -1,3 +1,9 @@ +2011-10-10 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + * src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java: + Use slightly modified doWOut-implementation from + LongitudinalSectionGenerator (here need to add Ws to different axis). + 2011-10-10 Felix Wolfsteller <felix.wolfsteller@intevation.de> * src/main/java/de/intevation/flys/artifacts/states/WaterlevelPairSelectState.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java Mon Oct 10 10:12:51 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java Mon Oct 10 10:27:45 2011 +0000 @@ -19,12 +19,8 @@ import de.intevation.flys.artifacts.model.WKms; import de.intevation.flys.utils.DataUtil; -import de.intevation.flys.model.River; - -import de.intevation.flys.artifacts.WINFOArtifact; import de.intevation.flys.artifacts.model.WQKms; -import de.intevation.flys.utils.FLYSUtils; @@ -45,6 +41,9 @@ public static final String I18N_CHART_SUBTITLE = "chart.w_differences.subtitle"; + public static final String I18N_YAXIS_LABEL = + "chart.w_differences.yaxis.label"; + public static final String I18N_2YAXIS_LABEL = "chart.w_differences.yaxis.second.label"; @@ -100,18 +99,9 @@ visible); } else if (name.equals(LONGITUDINAL_W)) { - WINFOArtifact flysArtifact = (WINFOArtifact) artifact; - facet = flysArtifact.getNativeFacet(facet); - - doWaterlevelOut( - (WQKms) facet.getData(artifact, context), - f.getDescription(), - attr, - flysArtifact, - visible); - + doWOut((WQKms) f.getData(artifact, context), attr, visible); } - else { + else { logger.warn("Unknown facet name: " + name); return; } @@ -121,51 +111,32 @@ /** * Add the waterlevel-curves (the "absolutes" from which * differences were calculated). + * * @param wqkms The wqkms to add to the diagram. + * @param theme The theme that contains styling information. */ - public void doWaterlevelOut(WQKms wqkms, - String description, - Document theme, - WINFOArtifact flysArtifact, - boolean visible - ) { - String wqkmsName = wqkms.getName(); + @Override + protected void doWOut(WQKms wqkms, Document theme, boolean visible) { + logger.debug("WDifferencesCurveGenerator.doWOut"); - River river = FLYSUtils.getRiver(flysArtifact); + XYSeries series = new StyledXYSeries(getSeriesName(wqkms, "W"), theme); - if (river == null) { - logger.warn("no river found"); - return; + int size = wqkms.size(); + + for (int i = 0; i < size; i++) { + series.add(wqkms.getKm(i), wqkms.getW(i)); } - logger.debug("WDifferencesCurveGenerator.doWaterlevelOut, gauge: " + - wqkmsName); - /* - Gauge gauge = river.determineGaugeByName(wqkmsName); - - if (gauge == null) { - logger.warn("no gauge found"); - return; - } - */ - + // Note: the only difference in the super-implementation + // (in LongitudinalSectionGenerator) is here (adds with + // addFirstAxisSeries() . + addSecondAxisSeries(series, visible); - double [][] values = new double [][] { - wqkms.getKms(), wqkms.getWs() }; - - int size = values != null ? values[0].length : 0; - - String seriesName = wqkmsName; - //getSeriesName(gauge); + if (needInvertAxis(wqkms)) { + setInverted(true); + } + } - XYSeries series = new StyledXYSeries(seriesName, theme); - - for (int i = 0; i < size; i++) { - series.add(values[0][i], values[1][i]); - } - - addSecondAxisSeries(series, visible); - } /** * Add items to dataseries which describes the differences.