Mercurial > dive4elements > river
changeset 2420:65ff8ff20be4
Fix flys/issue150 ('water increasing').
flys-artifacts/trunk@4056 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 16 Feb 2012 11:54:10 +0000 |
parents | 98a350bb91a9 |
children | 59047dfed8be 75146a1261c4 |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WKms.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WKmsImpl.java flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java |
diffstat | 4 files changed, 43 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Thu Feb 16 06:47:46 2012 +0000 +++ b/flys-artifacts/ChangeLog Thu Feb 16 11:54:10 2012 +0000 @@ -1,3 +1,17 @@ +2012-02-16 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + Fix flys/issue150 (exposure of gravitational anomalies) + + * src/main/java/de/intevation/flys/artifacts/model/WKmsImpl.java, + src/main/java/de/intevation/flys/artifacts/model/WKms.java: + (guessWaterIncreasing): In analogy to W->WQ->WQKms defined and + implemented. + + * src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java: + (needInvertAxis): Changed Parameter type to WKms (was WQKms). + (doW): Use in this case weaker wkms cast to find out whether axis + has to be inverted. + 2012-02-15 Ingo Weinzierl <ingo@intevation.de> * src/main/java/de/intevation/flys/artifacts/model/HYKFactory.java: Fixed
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WKms.java Thu Feb 16 06:47:46 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WKms.java Thu Feb 16 11:54:10 2012 +0000 @@ -14,5 +14,9 @@ TDoubleArrayList allKms(); TDoubleArrayList allWs(); + + public boolean guessWaterIncreasing(); + + public boolean guessWaterIncreasing(float factor); } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WKmsImpl.java Thu Feb 16 06:47:46 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WKmsImpl.java Thu Feb 16 11:54:10 2012 +0000 @@ -2,6 +2,9 @@ import gnu.trove.TDoubleArrayList; +import de.intevation.flys.utils.DataUtil; + + public class WKmsImpl extends NamedObjectImpl implements WKms @@ -69,6 +72,15 @@ return kms.getQuick(index); } + @Override + public boolean guessWaterIncreasing() { + return guessWaterIncreasing(0.05f); + } + + @Override + public boolean guessWaterIncreasing(float factor) { + return DataUtil.guessWaterIncreasing(ws, factor); + } @Override public int size() {
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java Thu Feb 16 06:47:46 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java Thu Feb 16 11:54:10 2012 +0000 @@ -431,10 +431,8 @@ addAxisSeries(series, YAXIS.W.idx, visible); - if (wkms instanceof WQKms) { - if (needInvertAxis((WQKms) wkms)) { - setInverted(true); - } + if (needInvertAxis(wkms)) { + setInverted(true); } } @@ -504,7 +502,6 @@ } } - /** * This method determines - taking JFreeCharts auto x value ordering into * account - if the x axis need to be inverted. Waterlines in these charts @@ -513,18 +510,18 @@ * @param wqkms The data object that stores the x and y values used for this * chart. */ - public boolean needInvertAxis(WQKms wqkms) { - boolean wsUp = wqkms.guessWaterIncreasing(); - boolean kmUp = DataUtil.guessWaterIncreasing(wqkms.allKms()); + public boolean needInvertAxis(WKms wkms) { + boolean wsUp = wkms.guessWaterIncreasing(); + boolean kmUp = DataUtil.guessWaterIncreasing(wkms.allKms()); boolean inv = (wsUp && kmUp) || (!wsUp && !kmUp); - int size = wqkms.size(); + int size = wkms.size(); if (logger.isDebugEnabled()) { - logger.debug("Values : " + size); + logger.debug("(Wkms)Values : " + size); if (size > 0) { - logger.debug("Start km: " + wqkms.getKm(0)); - logger.debug("End km: " + wqkms.getKm(size-1)); + logger.debug("Start km: " + wkms.getKm(0)); + logger.debug("End km: " + wkms.getKm(size-1)); } logger.debug("wsUp: " + wsUp); logger.debug("kmUp: " + kmUp); @@ -566,6 +563,8 @@ /** * Do Area out. + * @param theme styling information. + * @param visible whether or not visible. */ protected void doArea( Object o, @@ -602,6 +601,8 @@ } } + // TODO Depending on style, the area (e.g. 20m^2) should be added as annotation. + if (data.getLowerData() != null) { // TODO: Sort this out: when the two series have the same name, // the renderer (or anything in between) will not work correctly.