diff artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffCalculation.java @ 8544:76113b975829

(Issue1754) Make BedDifference calculation range dependent.
author Andre Heinecke <andre.heinecke@intevation.de>
date Fri, 13 Feb 2015 16:17:46 +0100
parents 706668b19b04
children 078b07a94023
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffCalculation.java	Fri Feb 13 14:59:16 2015 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffCalculation.java	Fri Feb 13 16:17:46 2015 +0100
@@ -37,10 +37,12 @@
 
         this.river     = access.getRiverName();
         this.heightIds = access.extractHeightIds(context);
+        double fromKm  = access.getFrom();
+        double toKm    = access.getTo();
 
         BedDiffYearResult [] results = new BedDiffYearResult[heightIds.length];
         for (int i = 0; i < heightIds.length; i++) {
-            BedHeightSingleData [] pair = getHeightPair(heightIds[i]);
+            BedHeightSingleData [] pair = getHeightPair(heightIds[i], fromKm, toKm);
             if (pair[0].getYear() == null || pair[1].getYear() == null) {
                 addProblem("beddiff.missing.year");
             }
@@ -51,10 +53,10 @@
     }
 
     /** Get two BedHeights from factory. */
-    private static BedHeightSingleData [] getHeightPair(int [] ids) {
+    private static BedHeightSingleData [] getHeightPair(int [] ids, double from, double to) {
         return new BedHeightSingleData [] {
-            (BedHeightSingleData)BedHeightFactory.getHeight("single", ids[0]),
-            (BedHeightSingleData)BedHeightFactory.getHeight("single", ids[1])
+            (BedHeightSingleData)BedHeightFactory.getHeight("single", ids[0], from, to),
+            (BedHeightSingleData)BedHeightFactory.getHeight("single", ids[1], from, to)
         };
     }
 

http://dive4elements.wald.intevation.org