diff artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesCrossSectionProcessor.java @ 9527:7c8d62867876

Cleanup of MainWstValue code. Cache qPositions once determined.
author gernotbelger
date Tue, 02 Oct 2018 13:25:52 +0200
parents ee6508687e3f
children d9fda7af24ca
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesCrossSectionProcessor.java	Mon Oct 01 18:08:31 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesCrossSectionProcessor.java	Tue Oct 02 13:25:52 2018 +0200
@@ -23,7 +23,7 @@
 import org.dive4elements.river.artifacts.D4EArtifact;
 import org.dive4elements.river.artifacts.access.RiverAccess;
 import org.dive4elements.river.artifacts.model.CrossSectionFacetUtils;
-import org.dive4elements.river.artifacts.model.river.MainWstValuesCalculator;
+import org.dive4elements.river.artifacts.model.river.MainWstValues;
 import org.dive4elements.river.artifacts.resources.Resources;
 import org.dive4elements.river.exports.CrossSectionGenerator;
 import org.dive4elements.river.jfree.StripedAreaDataset;
@@ -87,8 +87,8 @@
 
         for (final VegetationZoneServerClientXChange zone : zones) {
 
-            final double lower = uefdToHeight(context, river, currentStation, zone.getLowerFromTo());
-            final double upper = uefdToHeight(context, river, currentStation, zone.getUpperFromTo());
+            final double lower = uefdToHeight(river, currentStation, zone.getLowerFromTo());
+            final double upper = uefdToHeight(river, currentStation, zone.getUpperFromTo());
 
             final Color color = Color.decode(zone.getHexColor());
             final String label = String.format("%s (%dd-%dd)", zone.getZoneName(), zone.getLowerFromTo(), zone.getUpperFromTo());
@@ -116,12 +116,10 @@
         throw new UnsupportedOperationException();
     }
 
-    private static double uefdToHeight(final CallContext context, final River river, final double station, final int uefd) {
+    private static double uefdToHeight(final River river, final double station, final int uefd) {
 
-        // FIXME: cache me
-        final MainWstValuesCalculator mainWstValues = MainWstValuesCalculator.forRiver(context, river, null, MAIN_VALUE_MQ);
-
-        final double mw = mainWstValues.interpolateW(station, MAIN_VALUE_MQ);
+        final MainWstValues mainWstValues = MainWstValues.forRiver(river);
+        final double mw = mainWstValues.getW(river, MAIN_VALUE_MQ, station);
 
         // Üfd = -70,559 ∗ ln((DGM - MW) + 0,5) + 80,711
         final double f1 = -70.559;

http://dive4elements.wald.intevation.org