changeset 6938:4c0222d94055

issue1436: Exploit validity-rule of sedimentdensities.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 28 Aug 2013 12:02:56 +0200
parents 0a3dd5be6f81
children 765cf5fe26c3
files artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentDensity.java
diffstat 1 files changed, 2 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentDensity.java	Wed Aug 28 11:55:14 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentDensity.java	Wed Aug 28 12:02:56 2013 +0200
@@ -80,14 +80,10 @@
             for (int i = 0; i < years.size() -1; i++) {
                 int y1 = years.get(i);
                 int y2 = years.get(i + 1);
-                int mid = Math.round((y1 + y2) / 2);
-                if (year < mid) {
+                if (year >= y1 && year < y2) {
                     return getDensityAtKm(densities.get(y1), km);
                 }
-                else if (i == years.size() -1) {
-                    continue;
-                }
-                else {
+                else if (year >= y2 && i == years.size() -1) {
                     return getDensityAtKm(densities.get(y2), km);
                 }
             }

http://dive4elements.wald.intevation.org