diff artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/predefinedtkh/PredefinedTkhFacet.java @ 9033:384eee4b4135

Added datacage select and chart display for flow depth evolution series loaded from database, and a correction for the tkh data
author mschaefer
date Fri, 27 Apr 2018 17:41:59 +0200
parents 6e5ff436febe
children a4121ec450d6
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/predefinedtkh/PredefinedTkhFacet.java	Fri Apr 27 17:35:12 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/predefinedtkh/PredefinedTkhFacet.java	Fri Apr 27 17:41:59 2018 +0200
@@ -68,35 +68,21 @@
         SoilKind bedMobility = SoilKind.mobil;
         for (final TkhValue tkhValue : tkhValues) {
             final ResultRow row = ResultRow.create();
-            row.putValue(GeneralResultType.station, tkhValue.getStation().doubleValue());
-            if (soilKindFinder != null)
+            row.putValue(GeneralResultType.station, tkhValue.getStation());
+            if (soilKindFinder != null) {
                 bedMobility = soilKindFinder.findSoilKind(tkhValue.getStation().doubleValue());
-            row.putValue(SInfoResultType.soilkind, bedMobility);
-            final double tkh = tkhValue(tkhValue.getTkheight()) * 100;
-            row.putValue(SInfoResultType.tkh, tkh);
-            switch (bedMobility) {
-            case starr:
-                row.putValue(SInfoResultType.tkhup, tkh);
-                row.putValue(SInfoResultType.tkhdown, 0.0);
-                break;
-            case mobil:
-            default:
-                row.putValue(SInfoResultType.tkhup, tkh / 2);
-                row.putValue(SInfoResultType.tkhdown, -tkh / 2);
-                break;
+                row.putValue(SInfoResultType.soilkind, bedMobility);
             }
+            else
+                row.putValue(SInfoResultType.soilkind, null);
+            row.putValue(SInfoResultType.tkh, tkhValue.getTkhCm());
+            row.putValue(SInfoResultType.tkhup, tkhValue.getTkhUpCm(bedMobility == SoilKind.mobil));
+            row.putValue(SInfoResultType.tkhdown, tkhValue.getTkhDownCm(bedMobility == SoilKind.mobil));
             rows.add(row);
         }
         return new PredefinedTkhQueryCalculationResult(series.getName(), rows);
     }
 
-    private double tkhValue(final Double value) {
-        if (value != null)
-            return value.doubleValue();
-        else
-            return Double.NaN;
-    }
-
     /**
      * Create a deep copy of this Facet.
      *

http://dive4elements.wald.intevation.org