diff artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstCalculation.java @ 9480:7228bd10a8cc

Fixed bundu bzws bedheightfinder todos, added types for excavation volume and costs total
author mschaefer
date Mon, 10 Sep 2018 17:06:23 +0200
parents 2b83d3a96703
children bb278c927b66
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstCalculation.java	Mon Sep 10 15:31:55 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstCalculation.java	Mon Sep 10 17:06:23 2018 +0200
@@ -102,8 +102,9 @@
         final WstInfo wstInfo = new WstInfo(wqkms.getName(), 0, riverInfoProvider.getReferenceGauge(), true);
 
         // Fetch the bed heights of the selected sounding
-        final Integer bedHeightId = access.getBedHeightID(); // TODO: REMOVE BEDHEIGHTFINDER FROM CALCULATION - HOW?
-        final BedHeightsFinder bedHeightsFinder = bedHeightId == null ? null : BedHeightsFinder.forId(problems, bedHeightId, access.getRange());
+        final Integer bedHeightId = access.getBedHeightID();
+        final BedHeightsFinder bedHeightsFinder = (bedHeightId != null) ? BedHeightsFinder.forId(problems, bedHeightId, access.getRange())
+                : BedHeightsFinder.NullFinder();
 
         // Fetch the river channel data
         final ChannelFinder channelFinder = ChannelFinder.loadValues(problems, river, access.getBezugsJahr());
@@ -112,13 +113,12 @@
 
         // Compute the result rows
         for (int i = 0; i <= wqkms.size() - 1; i++) {
-            // TODO: REMOVE BEDHEIGHTFINDER FROM CALCULATION - HOW?
             this.rows.add(createRow(wqkms.getKm(i), wqkms.getW(i), wqkms.getQ(i), bedHeightsFinder, channelFinder, riverInfoProvider, wstInfo));
         }
 
         // Compute the missing volumes
         if (access.isCalculateMissingValue()) {
-            if (bedHeightsFinder == null)
+            if ((bedHeightsFinder == null) || bedHeightsFinder.isNull())
                 return new CalculationResult(results, problems);
             computeMissingVolumes(problems);
             final BedQualityCalculator bqCalculator = computeDensities(problems, bunduartifact, access, river);
@@ -188,11 +188,12 @@
         row.putValue(GeneralResultType.waterlevelLabel, wstInfo.getLabel());
         row.putValue(GeneralResultType.gaugeLabel, riverInfoProv.findGauge(station));
         row.putValue(GeneralResultType.location, riverInfoProv.getLocation(station));
-        row.putValue(BunduResultType.sounding, bedHeightsFinder.getInfo().getDescription());
+        if (bedHeightsFinder.getInfo() != null)
+            row.putValue(BunduResultType.sounding, bedHeightsFinder.getInfo().getDescription());
+        else
+            row.putValue(BunduResultType.sounding, "");
 
         // Set bed and channel bottom height
-
-        // TODO: REMOVE BEDHEIGHTFINDER FROM CALCULATION - HOW?
         final double msh = bedHeightsFinder.getMeanBedHeight(station);
         row.putValue(SInfoResultType.meanBedHeight, msh);
         if (!Double.isNaN(w) && !Double.isNaN(msh))
@@ -467,8 +468,8 @@
         sumRow.putValue(BunduResultType.missStationRangeTo, Double.valueOf(this.missKmTo));
         sumRow.putValue(BunduResultType.missVolumeTotal, vTotal);
         sumRow.putValue(BunduResultType.missMassTotal, mTotal);
-        // TODO sumRow.putValue(BunduResultType.excavationVolumeTotal, eTotal);
-        // TODO sumRow.putValue(BunduResultType.excavationCostsTotal, cTotal);
+        sumRow.putValue(BunduResultType.excavationVolumeTotal, eTotal);
+        sumRow.putValue(BunduResultType.excavationCostsTotal, cTotal);
         return sumRow;
     }
 

http://dive4elements.wald.intevation.org