Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculation.java @ 8886:cc86b0f9b3c3
SINFO-FlowDepth - work on tkh themes
author | gernotbelger |
---|---|
date | Wed, 14 Feb 2018 18:10:53 +0100 |
parents | 7a8c12706834 |
children | f431aec10d2c |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculation.java Wed Feb 14 18:10:28 2018 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculation.java Wed Feb 14 18:10:53 2018 +0100 @@ -155,6 +155,8 @@ final List<BedHeightValue> sortedValues = new ArrayList<>(values); Collections.sort(sortedValues, new BedHeightStationComparator()); + SoilKind lastKind = SoilKind.mobil; + for (final BedHeightValue bedHeightValue : sortedValues) { final Double station = bedHeightValue.getStation(); @@ -179,8 +181,46 @@ final double discharge = Double.NaN; // FIXME: calculate tkh - final double tkh = 0; - final double flowDepthTkh = flowDepth - tkh; + + // REMARK: bissl spielerei zum testen damit die sohlart nicht zu schnell wechselt + final boolean changeKind = Math.random() > 0.95; + SoilKind kind; + if (changeKind) { + switch (lastKind) { + case starr: + kind = SoilKind.mobil; + break; + + case mobil: + default: + kind = SoilKind.starr; + break; + + } + } else + kind = lastKind; + lastKind = kind; + + final double tkh = 100 + 10 * (Math.random() - 0.5); + + final double flowDepthTkh; + final double tkhUp; + final double tkhDown; + switch (kind) { + case starr: + flowDepthTkh = wst - (meanBedHeight + tkh / 100); + tkhUp = tkh; + tkhDown = 0; + break; + + case mobil: + default: + flowDepthTkh = wst - (meanBedHeight + tkh / 200); + tkhUp = tkh / 2; + tkhDown = -tkh / 2; + break; + } + // REMARK: access the location once only during calculation final String location = LocationProvider.getLocation(river.getName(), km); @@ -190,7 +230,8 @@ final String gaugeLabel = gauge == null ? notinrange : gauge.getName(); - resultData.addRow(km, flowDepth, flowDepthTkh, tkh, wst, discharge, wstLabel, gaugeLabel, meanBedHeight, bedHeightLabel, location); + resultData.addRow(km, flowDepth, flowDepthTkh, kind, tkh, tkhUp, tkhDown, wst, discharge, wstLabel, gaugeLabel, meanBedHeight, bedHeightLabel, + location); } catch (final FunctionEvaluationException e) { /* should only happen if out of range */