diff artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstCalculation.java @ 9330:0a0937f33bb5

bundu.bezugswst first result for missing volume added
author gernotbelger
date Fri, 27 Jul 2018 17:19:27 +0200
parents 86d2cbfe7f7f
children 127638669052
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstCalculation.java	Fri Jul 27 16:19:09 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstCalculation.java	Fri Jul 27 17:19:27 2018 +0200
@@ -13,6 +13,7 @@
 import java.util.List;
 
 import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.artifacts.CallMeta;
 import org.dive4elements.river.artifacts.bundu.BUNDUArtifact;
 import org.dive4elements.river.artifacts.bundu.BunduResultType;
 import org.dive4elements.river.artifacts.common.GeneralResultType;
@@ -38,13 +39,13 @@
     public CalculationResult calculate(final BUNDUArtifact bunduartifact) {
 
         final String user = CalculationUtils.findArtifactUser(this.context, bunduartifact);
-
+        final CallMeta m = this.context.getMeta();
         /* access input data */
         final BunduAccess access = new BunduAccess(bunduartifact);
 
         final River river = access.getRiver();
         final RiverInfo riverInfo = new RiverInfo(river);
-        final String calcModeLabel = Resources.getMsg(this.context.getMeta(), "bundu_bezugswst");
+        final String calcModeLabel = Resources.getMsg(m, "bundu_bezugswst");
         final BezugswstCalculationResults results = new BezugswstCalculationResults(calcModeLabel, user, riverInfo, access.getRange());
 
         // TODO: get wst, sounding for river
@@ -60,6 +61,7 @@
         final double[] qs = access.getQs();
         final Double missingVolFrom = access.getMissingVolFrom();
         final Double missingVolTo = access.getMissingVolTo();
+
         final List<ResultRow> list = new ArrayList<>();
         final ResultRow row = ResultRow.create();
         row.putValue(GeneralResultType.station, 666.666);
@@ -70,9 +72,39 @@
         row.putValue(GeneralResultType.location, "keine Lage");
         list.add(row);
 
-        final BezugswstCalculationResult result = new BezugswstCalculationResult("label? was fürn label?", list, sounding, wstInfo, function, preprocessing,
-                startYear, endYear, ud, qs, missingVolFrom, missingVolTo);
+        final BezugswstMainCalculationResult result = new BezugswstMainCalculationResult("label? was fürn label?", list, sounding, wstInfo, function,
+                preprocessing, startYear, endYear, ud, qs, missingVolFrom, missingVolTo);
         results.addResult(result, null);
+
+        // missing volume calculation
+        if (access.getMissingVolFrom() != null) {
+
+            final List<ResultRow> listResult1 = new ArrayList<>();
+            final ResultRow rowResult1 = ResultRow.create();
+            rowResult1.putValue(BunduResultType.bezugswst, 45.15);
+            rowResult1.putValue(GeneralResultType.dischargeQwithUnit, 890);
+            rowResult1.putValue(GeneralResultType.waterlevelLabel, "GLQ");
+            rowResult1.putValue(GeneralResultType.gaugeLabel, "Bonn");
+
+            rowResult1.putValue(BunduResultType.sounding, "NIEDERRHEIN_QP-2002");
+            rowResult1.putValue(BunduResultType.channelLowerEdge, 42.65);
+            rowResult1.putValue(BunduResultType.channelMinDepth, 2.5);
+            rowResult1.putValue(BunduResultType.hasMissingDepth, Resources.getMsg(m, "true"));
+            rowResult1.putValue(BunduResultType.missVolume, 2250);
+            rowResult1.putValue(BunduResultType.missMass, 3897);
+            rowResult1.putValue(BunduResultType.excavationVolume, 2475);
+            rowResult1.putValue(BunduResultType.excavationCosts, 999.99);
+            rowResult1.putValue(BunduResultType.channelWidth, 150);
+            rowResult1.putValue(BunduResultType.density, 1732);
+
+            rowResult1.putValue(GeneralResultType.location, "Spitzenlage");
+            listResult1.add(rowResult1);
+
+            final BezugswstMissVolCalculationResult1 r1 = new BezugswstMissVolCalculationResult1(
+                    Resources.getMsg(m, "bundu.export.csv.title.bezugswst.result1"), listResult1);
+            results.addResult(r1, null);
+        }
+
         return new CalculationResult(results, null);// problems);
     }
 

http://dive4elements.wald.intevation.org