Mercurial > dive4elements > river
changeset 8647:5f60bd7c4b42
(issue1754) Simplify code to handle a>b cases.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 30 Mar 2015 19:28:41 +0200 |
parents | 8e5c026216fd |
children | cd5e0662f75c |
files | artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffCalculation.java artifacts/src/main/java/org/dive4elements/river/artifacts/states/WDifferencesState.java |
diffstat | 2 files changed, 7 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffCalculation.java Mon Mar 30 19:27:11 2015 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffCalculation.java Mon Mar 30 19:28:41 2015 +0200 @@ -37,23 +37,12 @@ this.river = access.getRiverName(); this.heightIds = access.extractHeightIds(context); - double from = access.getFrom(); - double to = access.getTo(); - double start; - double end; - - if ((!Double.isNaN(from) && !Double.isNaN(to)) && from > to) { - log.debug("Reordering range."); - start = to; - end = from; - } else { - start = from; - end = to; - } + double from = access.getFrom(true); + double to = access.getTo(true); BedDiffYearResult [] results = new BedDiffYearResult[heightIds.length]; for (int i = 0; i < heightIds.length; i++) { - BedHeightData [] pair = getHeightPair(heightIds[i], start, end); + BedHeightData [] pair = getHeightPair(heightIds[i], from, to); if (pair[0].getYear() == null || pair[1].getYear() == null) { addProblem("beddiff.missing.year"); }
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/WDifferencesState.java Mon Mar 30 19:27:11 2015 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/WDifferencesState.java Mon Mar 30 19:28:41 2015 +0200 @@ -194,10 +194,8 @@ WINFOArtifact winfo = (WINFOArtifact) artifact; String id = getID(); RangeAccess rangeAccess = new RangeAccess(artifact); - double from = rangeAccess.getFrom(); - double to = rangeAccess.getTo(); - double start; - double end; + double from = rangeAccess.getFrom(true); + double to = rangeAccess.getTo(true); // Load the Artifacts/facets that we want to subtract and display. // Expected format is: // [42537f1e-3522-42ef-8968-635b03d8e9c6;longitudinal_section.w;0]#[1231f2-....] @@ -207,15 +205,6 @@ log.debug("Difference from: " + from + " to: " + to); /* Check if we need to obtain the data in a different order */ - if ((!Double.isNaN(from) && !Double.isNaN(to)) && from > to) { - log.debug("Reordering range."); - start = to; - end = from; - } else { - start = from; - end = to; - } - // Validate the Data-Strings. for (String s: datas) { if (!WaterlevelSelectState.isValueValid(s)) { @@ -233,9 +222,9 @@ // e.g.: // 42537f1e-3522-42ef-8968-635b03d8e9c6;longitudinal_section.w;1 WKms minuendWKms = getWKms(StringUtil.unbracket(datas[i+0]), - context, start, end); + context, from, to); WKms subtrahendWKms = getWKms(StringUtil.unbracket(datas[i+1]), - context, start, end); + context, from, to); String facetName = "diff ()"; String minName = "min";