Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/utils/Formatter.java @ 9335:7dc238bd062c
Fixed: calculation of flow depth and tkh with rounding to cm, calculator return differentiated
author | mschaefer |
---|---|
date | Mon, 30 Jul 2018 08:03:46 +0200 |
parents | e6b63b2b41b9 |
children | 2aec052d4088 |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/utils/Formatter.java Mon Jul 30 08:00:24 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/utils/Formatter.java Mon Jul 30 08:03:46 2018 +0200 @@ -97,6 +97,10 @@ public static final int CSV_DIAGRAM_DATA_MAX_DIGITS = 3; public static final int CSV_DIAGRAM_DATA_MIN_DIGITS = 3; + // S-INFO + public static final int FLOWDEPTH_MAX_DIGITS = 2; + private static final double FLOWDEPTH_ROUND_MULT = 100.0; + /** * Creates a localized NumberFormatter with given range of decimal digits. * @@ -377,7 +381,11 @@ } public static NumberFormat getFlowDepth(final CallContext context) { - return Formatter.getFormatter(context, 2, 2); + return Formatter.getFormatter(context, FLOWDEPTH_MAX_DIGITS, FLOWDEPTH_MAX_DIGITS); + } + + public static double roundFlowDepth(final double value) { + return Math.round(value * FLOWDEPTH_ROUND_MULT) / FLOWDEPTH_ROUND_MULT; } public static NumberFormat getW(final CallContext context) {