Mercurial > dive4elements > river
changeset 1692:5201173c3db5
Bugfixes: #150 #345 Corrected the determination to invert the x axis in longitudinal section charts.
flys-artifacts/trunk@2916 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 10 Oct 2011 08:35:30 +0000 |
parents | 17648043429f |
children | 5f1156d61e9e |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java |
diffstat | 2 files changed, 45 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Mon Oct 10 07:47:30 2011 +0000 +++ b/flys-artifacts/ChangeLog Mon Oct 10 08:35:30 2011 +0000 @@ -1,3 +1,13 @@ +2011-10-10 Ingo Weinzierl <ingo@intevation.de> + + flys/issue150 (Diagramm: Anzeige von W bergauf) + flys/issue345 (W-INFO / Wasserspiegellagenberechnung, Diagrammausgabe) + + * src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java: + Corrected the determination to invert the x axis, so that waterlines + will start with their highest value at the left and end with their + lowest values at the right. + 2011-10-10 Felix Wolfsteller <felix.wolfsteller@intevation.de> * src/main/java/de/intevation/flys/artifacts/math/DifferenceCurveFacet.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java Mon Oct 10 07:47:30 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java Mon Oct 10 08:35:30 2011 +0000 @@ -173,7 +173,7 @@ protected void invertXAxis(ValueAxis xaxis) { if (inverted) { - logger.debug("Invert X-Axis."); + logger.debug("X-Axis.setInverted(true)"); xaxis.setInverted(true); } } @@ -245,29 +245,13 @@ int size = wqkms.size(); - boolean wsUp = wqkms.guessWaterIncreasing(); - boolean kmUp = DataUtil.guessWaterIncreasing(wqkms.allKms()); - boolean inv = !(kmUp && !wsUp); - - if (logger.isDebugEnabled()) { - logger.debug("Generate series: " + series.getKey()); - logger.debug("Values : " + size); - if (size > 0) { - logger.debug("Start km: " + wqkms.getKm(0)); - logger.debug("End km: " + wqkms.getKm(size-1)); - } - logger.debug("wsUp: " + wsUp); - logger.debug("kmUp: " + kmUp); - logger.debug("inv: " + inv); - } - for (int i = 0; i < size; i++) { series.add(wqkms.getKm(i), wqkms.getW(i)); } addFirstAxisSeries(series, visible); - if (inv) { + if (needInvertAxis(wqkms)) { setInverted(true); } } @@ -286,24 +270,45 @@ int size = wqkms.size(); - if (logger.isDebugEnabled()) { - if (wqkms.size() > 0) { - logger.debug("Generate series: " + series.getKey()); - logger.debug("Start km: " + wqkms.getKm(0)); - logger.debug("End km: " + wqkms.getKm(size-1)); - logger.debug("Values : " + size); - } - } - for (int i = 0; i < size; i++) { series.add(wqkms.getKm(i), wqkms.getQ(i)); } addSecondAxisSeries(series, visible); - //if (wqkms.guessWaterIncreasing()) { - // setInverted(true); - //} + if (needInvertAxis(wqkms)) { + setInverted(true); + } + } + + + /** + * This method determines - taking JFreeCharts auto x value ordering into + * account - if the x axis need to be inverted. Waterlines in these charts + * should decrease. + * + * @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()); + boolean inv = (wsUp && kmUp) || (!wsUp && !kmUp); + + int size = wqkms.size(); + + if (logger.isDebugEnabled()) { + logger.debug("Values : " + size); + if (size > 0) { + logger.debug("Start km: " + wqkms.getKm(0)); + logger.debug("End km: " + wqkms.getKm(size-1)); + } + logger.debug("wsUp: " + wsUp); + logger.debug("kmUp: " + kmUp); + logger.debug("inv: " + inv); + } + + return inv; }