Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/utils/Formatter.java @ 9421:53e26734e4d2
Fixed NaN handling in salix historical scenarion calculation, added problem report
author | mschaefer |
---|---|
date | Fri, 17 Aug 2018 11:13:31 +0200 |
parents | 8ae7137b67d7 |
children | d194c5b24bf8 |
rev | line source |
---|---|
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
5994
af13ceeba52a
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
5994
af13ceeba52a
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5639
diff
changeset
|
9 package org.dive4elements.river.utils; |
445
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
9375
a0a2e68a1e11
Fixed: cm rounding in S-Info flow depth/tkh and U-Info salix via BigDecimal, half_even mode
mschaefer
parents:
9367
diff
changeset
|
11 import java.math.BigDecimal; |
a0a2e68a1e11
Fixed: cm rounding in S-Info flow depth/tkh and U-Info salix via BigDecimal, half_even mode
mschaefer
parents:
9367
diff
changeset
|
12 import java.math.RoundingMode; |
3402
0336132ec9db
Adjusted Delta W(t) CSV exporter to customers wishes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3397
diff
changeset
|
13 import java.text.DateFormat; |
8951 | 14 import java.text.DecimalFormat; |
3402
0336132ec9db
Adjusted Delta W(t) CSV exporter to customers wishes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3397
diff
changeset
|
15 import java.text.NumberFormat; |
0336132ec9db
Adjusted Delta W(t) CSV exporter to customers wishes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3397
diff
changeset
|
16 import java.text.SimpleDateFormat; |
3771 | 17 import java.util.Locale; |
3402
0336132ec9db
Adjusted Delta W(t) CSV exporter to customers wishes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3397
diff
changeset
|
18 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5639
diff
changeset
|
19 import org.dive4elements.artifacts.CallContext; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5639
diff
changeset
|
20 import org.dive4elements.artifacts.CallMeta; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5639
diff
changeset
|
21 import org.dive4elements.river.artifacts.resources.Resources; |
3402
0336132ec9db
Adjusted Delta W(t) CSV exporter to customers wishes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3397
diff
changeset
|
22 |
5639
db4e7ff0b987
Doc and whitespaces.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3771
diff
changeset
|
23 /** Helper to access static i18n Formatters. */ |
445
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 public final class Formatter { |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 |
2290
6f4a1f513e89
Calculation error report: i18n the km of the error report.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2258
diff
changeset
|
26 // KMS IN ERROR REPORTS. |
2305
ff558d0332e2
Error report: Format kms in error reports at least with one digit after the decimal separator.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2290
diff
changeset
|
27 public static final int CALCULATION_REPORT_KM_MIN_DIGITS = 1; |
2290
6f4a1f513e89
Calculation error report: i18n the km of the error report.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2258
diff
changeset
|
28 public static final int CALCULATION_REPORT_KM_MAX_DIGITS = 3; |
6f4a1f513e89
Calculation error report: i18n the km of the error report.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2258
diff
changeset
|
29 |
445
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 // WATERLEVEL FORMATTER CONSTANTS |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 public static final int WATERLEVEL_KM_MIN_DIGITS = 3; |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 public static final int WATERLEVEL_KM_MAX_DIGITS = 3; |
8996 | 33 public static final int WATERLEVEL_W_MIN_DIGITS = 0; |
34 public static final int WATERLEVEL_W_MAX_DIGITS = 2; | |
35 public static final int WATERLEVEL_Q_MIN_DIGITS = 0; | |
36 public static final int WATERLEVEL_Q_MAX_DIGITS = 2; | |
445
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 // COMPUTED DISCHARGE CURVE FORMATTER CONSTANTS |
8996 | 39 public static final int COMPUTED_DISCHARGE_W_MIN_DIGITS = 2; |
40 public static final int COMPUTED_DISCHARGE_W_MAX_DIGITS = 2; | |
41 public static final int COMPUTED_DISCHARGE_Q_MIN_DIGITS = 0; | |
42 public static final int COMPUTED_DISCHARGE_Q_MAX_DIGITS = 2; | |
445
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 |
2258
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
44 // HISTORICAL DISCHARGE CURVE FORMATTER CONSTANTS |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
45 public static final int HISTORICAL_DISCHARGE_W_MIN_DIGITS = 0; |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
46 public static final int HISTORICAL_DISCHARGE_W_MAX_DIGITS = 2; |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
47 public static final int HISTORICAL_DISCHARGE_Q_MIN_DIGITS = 0; |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
48 public static final int HISTORICAL_DISCHARGE_Q_MAX_DIGITS = 2; |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
49 |
445
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 // DURATION CURVE FORMATTER CONSTANTS |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 public static final int DURATION_W_MIN_DIGITS = 0; |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 public static final int DURATION_W_MAX_DIGITS = 2; |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 public static final int DURATION_Q_MIN_DIGITS = 0; |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 public static final int DURATION_Q_MAX_DIGITS = 1; |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 public static final int DURATION_D_MIN_DIGITS = 0; |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 public static final int DURATION_D_MAX_DIGITS = 0; |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 |
2702
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2588
diff
changeset
|
58 // FLOW VELOCITY FORMATTER CONSTANTS |
8996 | 59 public static final int FLOW_VELOCITY_KM_MIN_DIGITS = 3; |
60 public static final int FLOW_VELOCITY_KM_MAX_DIGITS = 3; | |
2702
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2588
diff
changeset
|
61 public static final int FLOW_VELOCITY_VALUES_MIN_DIGITS = 2; |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2588
diff
changeset
|
62 public static final int FLOW_VELOCITY_VALUES_MAX_DIGITS = 2; |
8996 | 63 public static final int FLOW_VELOCITY_Q_MIN_DIGITS = 0; |
64 public static final int FLOW_VELOCITY_Q_MAX_DIGITS = 2; | |
2702
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2588
diff
changeset
|
65 |
2714
2952f6dee5cf
Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2702
diff
changeset
|
66 // MIDDLE BED HEIGHT FORMATTER CONSTANTS |
8996 | 67 public static final int MIDDLE_BED_HEIGHT_KM_MIN_DIGITS = 3; |
68 public static final int MIDDLE_BED_HEIGHT_KM_MAX_DIGITS = 3; | |
69 public static final int MIDDLE_BED_HEIGHT_HEIGHT_MIN_DIGITS = 3; | |
70 public static final int MIDDLE_BED_HEIGHT_HEIGHT_MAX_DIGITS = 3; | |
71 public static final int MIDDLE_BED_HEIGHT_UNCERT_MIN_DIGITS = 3; | |
72 public static final int MIDDLE_BED_HEIGHT_UNCERT_MAX_DIGITS = 3; | |
73 public static final int MIDDLE_BED_HEIGHT_DATAGAP_MIN_DIGITS = 2; | |
74 public static final int MIDDLE_BED_HEIGHT_DATAGAP_MAX_DIGITS = 2; | |
2714
2952f6dee5cf
Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2702
diff
changeset
|
75 public static final int MIDDLE_BED_HEIGHT_SOUNDING_WIDTH_MIN_DIGITS = 0; |
2952f6dee5cf
Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2702
diff
changeset
|
76 public static final int MIDDLE_BED_HEIGHT_SOUNDING_WIDTH_MAX_DIGITS = 0; |
8996 | 77 public static final int MIDDLE_BED_HEIGHT_WIDTH_MIN_DIGITS = 3; |
78 public static final int MIDDLE_BED_HEIGHT_WIDTH_MAX_DIGITS = 3; | |
2714
2952f6dee5cf
Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2702
diff
changeset
|
79 |
2787
e63969c173e9
FixA: Added CSV export for Delta W/t values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2714
diff
changeset
|
80 public static final int FIX_DELTA_W_KM_MIN_DIGITS = 3; |
e63969c173e9
FixA: Added CSV export for Delta W/t values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2714
diff
changeset
|
81 public static final int FIX_DELTA_W_KM_MAX_DIGITS = 3; |
e63969c173e9
FixA: Added CSV export for Delta W/t values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2714
diff
changeset
|
82 public static final int FIX_DELTA_W_DELTA_W_MIN_DIGITS = 3; |
e63969c173e9
FixA: Added CSV export for Delta W/t values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2714
diff
changeset
|
83 public static final int FIX_DELTA_W_DELTA_W_MAX_DIGITS = 3; |
8996 | 84 public static final int FIX_DELTA_W_DELTA_Q_MIN_DIGITS = 0; |
85 public static final int FIX_DELTA_W_DELTA_Q_MAX_DIGITS = 2; | |
2787
e63969c173e9
FixA: Added CSV export for Delta W/t values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2714
diff
changeset
|
86 |
6207
a82a724356f0
Updade sq relation pdf export as specified in issue1071
Andre Heinecke <aheinecke@intevation.de>
parents:
6172
diff
changeset
|
87 public static final int VARIANCE_MIN_DIGITS = 3; |
a82a724356f0
Updade sq relation pdf export as specified in issue1071
Andre Heinecke <aheinecke@intevation.de>
parents:
6172
diff
changeset
|
88 public static final int VARIANCE_MAX_DIGITS = 3; |
6172
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
89 |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
90 // SQ Relation |
6322
8c976bb0362f
Add SQ Relation KM formatter and use it fopr issue 1071
Andre Heinecke <aheinecke@intevation.de>
parents:
6207
diff
changeset
|
91 public static final int SQ_RELATION_KM_MIN_DIGITS = 2; |
8c976bb0362f
Add SQ Relation KM formatter and use it fopr issue 1071
Andre Heinecke <aheinecke@intevation.de>
parents:
6207
diff
changeset
|
92 public static final int SQ_RELATION_KM_MAX_DIGITS = 2; |
8996 | 93 public static final int SQ_RELATION_A_MAX_DIGITS = 2; |
94 public static final int SQ_RELATION_A_MIN_DIGITS = 2; | |
95 public static final int SQ_RELATION_B_MAX_DIGITS = 3; | |
96 public static final int SQ_RELATION_B_MIN_DIGITS = 3; | |
5639
db4e7ff0b987
Doc and whitespaces.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3771
diff
changeset
|
97 |
7047
b5e9b8b5c8d6
issue1493: Use other numberformat for csv data from diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7020
diff
changeset
|
98 // OTHER |
8996 | 99 public static final int CSV_DIAGRAM_DATA_MAX_DIGITS = 3; |
100 public static final int CSV_DIAGRAM_DATA_MIN_DIGITS = 3; | |
7047
b5e9b8b5c8d6
issue1493: Use other numberformat for csv data from diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7020
diff
changeset
|
101 |
9335
7dc238bd062c
Fixed: calculation of flow depth and tkh with rounding to cm, calculator return differentiated
mschaefer
parents:
9145
diff
changeset
|
102 // S-INFO |
7dc238bd062c
Fixed: calculation of flow depth and tkh with rounding to cm, calculator return differentiated
mschaefer
parents:
9145
diff
changeset
|
103 public static final int FLOWDEPTH_MAX_DIGITS = 2; |
7dc238bd062c
Fixed: calculation of flow depth and tkh with rounding to cm, calculator return differentiated
mschaefer
parents:
9145
diff
changeset
|
104 |
3017
296b067e17e6
i18n and format for line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2787
diff
changeset
|
105 /** |
3771 | 106 * Creates a localized NumberFormatter with given range of decimal digits. |
9006 | 107 * |
8996 | 108 * @param m |
109 * CallMeta to find the locale. | |
110 * @param min | |
111 * minimum number of decimal ("fraction") digits. | |
112 * @param max | |
113 * maximum number of decimal ("fraction") digits. | |
3017
296b067e17e6
i18n and format for line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2787
diff
changeset
|
114 * @return A NumberFormat. Use #format(NUMBER) to get String representation |
296b067e17e6
i18n and format for line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2787
diff
changeset
|
115 * of NUMBER. |
296b067e17e6
i18n and format for line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2787
diff
changeset
|
116 */ |
8996 | 117 public static NumberFormat getFormatter(final CallMeta m, final int min, final int max) { |
118 final Locale locale = Resources.getLocale(m); | |
119 final NumberFormat nf = NumberFormat.getInstance(locale); | |
445
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
120 |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
121 nf.setMaximumFractionDigits(max); |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
122 nf.setMinimumFractionDigits(min); |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
123 |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 return nf; |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
125 } |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
126 |
8996 | 127 public static NumberFormat getFormatter(final CallContext c, final int min, final int max) { |
2290
6f4a1f513e89
Calculation error report: i18n the km of the error report.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2258
diff
changeset
|
128 return getFormatter(c.getMeta(), min, max); |
6f4a1f513e89
Calculation error report: i18n the km of the error report.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2258
diff
changeset
|
129 } |
6f4a1f513e89
Calculation error report: i18n the km of the error report.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2258
diff
changeset
|
130 |
445
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
131 /** |
2087
bda04ae1154f
#196 Localized the WQ labels in CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1683
diff
changeset
|
132 * Returns a number formatter with no max or min digits set. |
bda04ae1154f
#196 Localized the WQ labels in CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1683
diff
changeset
|
133 * |
8996 | 134 * @param c |
135 * The CallContext. | |
2087
bda04ae1154f
#196 Localized the WQ labels in CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1683
diff
changeset
|
136 * |
bda04ae1154f
#196 Localized the WQ labels in CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1683
diff
changeset
|
137 * @return a number formatter. |
bda04ae1154f
#196 Localized the WQ labels in CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1683
diff
changeset
|
138 */ |
8951 | 139 public static NumberFormat getRawFormatter(final CallContext c) { |
140 final Locale locale = Resources.getLocale(c.getMeta()); | |
2087
bda04ae1154f
#196 Localized the WQ labels in CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1683
diff
changeset
|
141 return NumberFormat.getInstance(locale); |
bda04ae1154f
#196 Localized the WQ labels in CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1683
diff
changeset
|
142 } |
bda04ae1154f
#196 Localized the WQ labels in CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1683
diff
changeset
|
143 |
6172
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
144 /** |
6683
c6c3a2a26a33
Use full stop in doc. This fixes my syntax highlight :) .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6322
diff
changeset
|
145 * Returns a formatter in engineering notation. |
6172
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
146 */ |
8951 | 147 public static NumberFormat getEngFormatter(final CallContext c) { |
148 final NumberFormat nf = getRawFormatter(c); | |
6172
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
149 if (nf instanceof DecimalFormat) { |
8996 | 150 final DecimalFormat df = (DecimalFormat) nf; |
6172
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
151 df.applyPattern("##0.#####E0"); |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
152 } |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
153 return nf; |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
154 } |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
155 |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
156 /** |
6683
c6c3a2a26a33
Use full stop in doc. This fixes my syntax highlight :) .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6322
diff
changeset
|
157 * Returns a number formatter that uses an exponent after max digits. |
6172
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
158 */ |
8996 | 159 public static NumberFormat getScientificFormater(final CallContext c, final int min, final int max) { |
8951 | 160 final NumberFormat nf = getRawFormatter(c); |
6172
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
161 if (nf instanceof DecimalFormat) { |
8996 | 162 final DecimalFormat df = (DecimalFormat) nf; |
6172
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
163 df.applyPattern("0.0E0"); |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
164 df.setMaximumFractionDigits(max); |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
165 df.setMinimumFractionDigits(min); |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
166 } |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
167 return nf; |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
168 } |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
169 |
2087
bda04ae1154f
#196 Localized the WQ labels in CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1683
diff
changeset
|
170 /** |
2258
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
171 * Returns a date formatter with SHORT style. |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
172 */ |
8951 | 173 public static DateFormat getShortDateFormat(final CallContext cc) { |
174 final Locale locale = Resources.getLocale(cc.getMeta()); | |
2258
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
175 return DateFormat.getDateInstance(DateFormat.SHORT, locale); |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
176 } |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
177 |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
178 /** |
2588
7dd45896e941
Issue 459.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2305
diff
changeset
|
179 * Returns a date formatter with MEDIUM style. |
7dd45896e941
Issue 459.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2305
diff
changeset
|
180 */ |
8951 | 181 public static DateFormat getMediumDateFormat(final CallContext cc) { |
182 final Locale locale = Resources.getLocale(cc.getMeta()); | |
2588
7dd45896e941
Issue 459.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2305
diff
changeset
|
183 return DateFormat.getDateInstance(DateFormat.MEDIUM, locale); |
7dd45896e941
Issue 459.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2305
diff
changeset
|
184 } |
7dd45896e941
Issue 459.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2305
diff
changeset
|
185 |
7dd45896e941
Issue 459.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2305
diff
changeset
|
186 /** |
445
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
187 * Returns the number formatter for kilometer values in waterlevel exports. |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
188 * |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
189 * @return the number formatter for kilometer values. |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
190 */ |
8951 | 191 public static NumberFormat getWaterlevelKM(final CallContext context) { |
8996 | 192 return getFormatter(context, WATERLEVEL_KM_MIN_DIGITS, WATERLEVEL_KM_MAX_DIGITS); |
445
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
193 } |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
194 |
7047
b5e9b8b5c8d6
issue1493: Use other numberformat for csv data from diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7020
diff
changeset
|
195 /** |
b5e9b8b5c8d6
issue1493: Use other numberformat for csv data from diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7020
diff
changeset
|
196 * Returns the number formatter for data exported from diagram (not from |
b5e9b8b5c8d6
issue1493: Use other numberformat for csv data from diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7020
diff
changeset
|
197 * calculation. |
b5e9b8b5c8d6
issue1493: Use other numberformat for csv data from diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7020
diff
changeset
|
198 * |
b5e9b8b5c8d6
issue1493: Use other numberformat for csv data from diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7020
diff
changeset
|
199 * @return the number formatter for csv data from diagra. |
b5e9b8b5c8d6
issue1493: Use other numberformat for csv data from diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7020
diff
changeset
|
200 */ |
8951 | 201 public static NumberFormat getCSVFormatter(final CallContext context) { |
8996 | 202 return getFormatter(context, CSV_DIAGRAM_DATA_MIN_DIGITS, CSV_DIAGRAM_DATA_MAX_DIGITS); |
7047
b5e9b8b5c8d6
issue1493: Use other numberformat for csv data from diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7020
diff
changeset
|
203 } |
5639
db4e7ff0b987
Doc and whitespaces.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3771
diff
changeset
|
204 |
8951 | 205 public static NumberFormat getWaterlevelW(final CallMeta meta) { |
8996 | 206 return getFormatter(meta, WATERLEVEL_W_MIN_DIGITS, WATERLEVEL_W_MAX_DIGITS); |
3162
0d8146989012
Added labeling for Q/W points FixingsKMChartService.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
207 } |
445
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
208 |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
209 /** |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
210 * Returns the number formatter for W values in waterlevel exports. |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
211 * |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
212 * @return the number formatter for W values. |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
213 */ |
8951 | 214 public static NumberFormat getWaterlevelW(final CallContext context) { |
8996 | 215 return getFormatter(context, WATERLEVEL_W_MIN_DIGITS, WATERLEVEL_W_MAX_DIGITS); |
445
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
216 } |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
217 |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
218 /** |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
219 * Returns the number formatter for Q values in waterlevel exports. |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
220 * |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
221 * @return the number formatter for Q values. |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
222 */ |
8951 | 223 public static NumberFormat getWaterlevelQ(final CallContext context) { |
8996 | 224 return getFormatter(context, WATERLEVEL_Q_MIN_DIGITS, WATERLEVEL_Q_MAX_DIGITS); |
445
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
225 } |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
226 |
8951 | 227 public static NumberFormat getWaterlevelQ(final CallMeta meta) { |
8996 | 228 return getFormatter(meta, WATERLEVEL_Q_MIN_DIGITS, WATERLEVEL_Q_MAX_DIGITS); |
3162
0d8146989012
Added labeling for Q/W points FixingsKMChartService.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
229 } |
445
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
230 |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
231 /** |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
232 * Returns the number formatter for W values in exports of computed |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
233 * discharge curves. |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
234 * |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
235 * @return the number formatter for W values. |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
236 */ |
8951 | 237 public static NumberFormat getComputedDischargeW(final CallContext context) { |
8996 | 238 return getFormatter(context, COMPUTED_DISCHARGE_W_MIN_DIGITS, COMPUTED_DISCHARGE_W_MAX_DIGITS); |
445
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
239 } |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
240 |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
241 /** |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
242 * Returns the number formatter for Q values in exports of computed |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
243 * discharge curves. |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
244 * |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
245 * @return the number formatter for Q values. |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
246 */ |
8951 | 247 public static NumberFormat getComputedDischargeQ(final CallContext context) { |
8996 | 248 return getFormatter(context, COMPUTED_DISCHARGE_Q_MIN_DIGITS, COMPUTED_DISCHARGE_Q_MAX_DIGITS); |
445
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
249 } |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
250 |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
251 /** |
2258
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
252 * Returns the number formatter for W values in exports of historical |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
253 * discharge curves. |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
254 * |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
255 * @return the number formatter for W values. |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
256 */ |
8951 | 257 public static NumberFormat getHistoricalDischargeW(final CallContext context) { |
8996 | 258 return getFormatter(context, HISTORICAL_DISCHARGE_W_MIN_DIGITS, HISTORICAL_DISCHARGE_W_MAX_DIGITS); |
2258
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
259 } |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
260 |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
261 /** |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
262 * Returns the number formatter for Q values in exports of historical |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
263 * discharge curves. |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
264 * |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
265 * @return the number formatter for Q values. |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
266 */ |
8951 | 267 public static NumberFormat getHistoricalDischargeQ(final CallContext context) { |
8996 | 268 return getFormatter(context, HISTORICAL_DISCHARGE_Q_MIN_DIGITS, HISTORICAL_DISCHARGE_Q_MAX_DIGITS); |
2258
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
269 } |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
270 |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
271 /** |
445
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
272 * Returns the number formatter for W values in duration curve exports. |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
273 * |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
274 * @return the number formatter for W values. |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
275 */ |
8951 | 276 public static NumberFormat getDurationW(final CallContext context) { |
8996 | 277 return getFormatter(context, DURATION_W_MIN_DIGITS, DURATION_W_MAX_DIGITS); |
445
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
278 } |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
279 |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
280 /** |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
281 * Returns the number formatter for Q values in duration curve exports. |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
282 * |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
283 * @return the number formatter for W values. |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
284 */ |
8951 | 285 public static NumberFormat getDurationQ(final CallContext context) { |
8996 | 286 return getFormatter(context, DURATION_Q_MIN_DIGITS, DURATION_Q_MAX_DIGITS); |
445
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
287 } |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
288 |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
289 /** |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
290 * Returns the number formatter for D values in duration curve exports. |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
291 * |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
292 * @return the number formatter for W values. |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
293 */ |
8951 | 294 public static NumberFormat getDurationD(final CallContext context) { |
8996 | 295 return getFormatter(context, DURATION_D_MIN_DIGITS, DURATION_D_MAX_DIGITS); |
445
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
296 } |
2290
6f4a1f513e89
Calculation error report: i18n the km of the error report.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2258
diff
changeset
|
297 |
8951 | 298 public static NumberFormat getCalculationKm(final CallMeta meta) { |
8996 | 299 return getFormatter(meta, CALCULATION_REPORT_KM_MIN_DIGITS, CALCULATION_REPORT_KM_MAX_DIGITS); |
2714
2952f6dee5cf
Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2702
diff
changeset
|
300 } |
2952f6dee5cf
Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2702
diff
changeset
|
301 |
8996 | 302 public static NumberFormat getFlowVelocityKM(final CallContext context) { |
303 return getFormatter(context, FLOW_VELOCITY_KM_MIN_DIGITS, FLOW_VELOCITY_KM_MAX_DIGITS); | |
2714
2952f6dee5cf
Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2702
diff
changeset
|
304 } |
2952f6dee5cf
Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2702
diff
changeset
|
305 |
8996 | 306 public static NumberFormat getFlowVelocityValues(final CallContext context) { |
307 return getFormatter(context, FLOW_VELOCITY_VALUES_MIN_DIGITS, FLOW_VELOCITY_VALUES_MAX_DIGITS); | |
308 } | |
309 | |
310 public static NumberFormat getFlowVelocityQ(final CallContext context) { | |
311 return getFormatter(context, FLOW_VELOCITY_Q_MIN_DIGITS, FLOW_VELOCITY_Q_MAX_DIGITS); | |
312 } | |
313 | |
314 public static NumberFormat getMiddleBedHeightKM(final CallContext context) { | |
315 return getFormatter(context, MIDDLE_BED_HEIGHT_KM_MIN_DIGITS, MIDDLE_BED_HEIGHT_KM_MAX_DIGITS); | |
316 } | |
317 | |
318 public static NumberFormat getMiddleBedHeightHeight(final CallContext context) { | |
319 return getFormatter(context, MIDDLE_BED_HEIGHT_HEIGHT_MIN_DIGITS, MIDDLE_BED_HEIGHT_HEIGHT_MAX_DIGITS); | |
320 } | |
2714
2952f6dee5cf
Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2702
diff
changeset
|
321 |
8951 | 322 public static NumberFormat getMiddleBedHeightUncert(final CallContext context) { |
8996 | 323 return getFormatter(context, MIDDLE_BED_HEIGHT_UNCERT_MIN_DIGITS, MIDDLE_BED_HEIGHT_UNCERT_MAX_DIGITS); |
2714
2952f6dee5cf
Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2702
diff
changeset
|
324 } |
2952f6dee5cf
Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2702
diff
changeset
|
325 |
8951 | 326 public static NumberFormat getMiddleBedHeightDataGap(final CallContext context) { |
8996 | 327 return getFormatter(context, MIDDLE_BED_HEIGHT_DATAGAP_MIN_DIGITS, MIDDLE_BED_HEIGHT_DATAGAP_MAX_DIGITS); |
2714
2952f6dee5cf
Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2702
diff
changeset
|
328 } |
2952f6dee5cf
Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2702
diff
changeset
|
329 |
8996 | 330 public static NumberFormat getMiddleBedHeightSounding(final CallContext context) { |
331 return getFormatter(context, MIDDLE_BED_HEIGHT_SOUNDING_WIDTH_MIN_DIGITS, MIDDLE_BED_HEIGHT_SOUNDING_WIDTH_MAX_DIGITS); | |
2714
2952f6dee5cf
Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2702
diff
changeset
|
332 } |
2952f6dee5cf
Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2702
diff
changeset
|
333 |
8951 | 334 public static NumberFormat getFixDeltaWKM(final CallContext context) { |
8996 | 335 return getFormatter(context, FIX_DELTA_W_KM_MIN_DIGITS, FIX_DELTA_W_KM_MAX_DIGITS); |
2787
e63969c173e9
FixA: Added CSV export for Delta W/t values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2714
diff
changeset
|
336 } |
e63969c173e9
FixA: Added CSV export for Delta W/t values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2714
diff
changeset
|
337 |
8951 | 338 public static NumberFormat getFixDeltaWDeltaW(final CallContext context) { |
8996 | 339 return getFormatter(context, FIX_DELTA_W_DELTA_W_MIN_DIGITS, FIX_DELTA_W_DELTA_W_MAX_DIGITS); |
3402
0336132ec9db
Adjusted Delta W(t) CSV exporter to customers wishes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3397
diff
changeset
|
340 } |
3397
6d1740533810
FixA: Added discharge column to DeltaW(t) CSV export.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3162
diff
changeset
|
341 |
8951 | 342 public static NumberFormat getFixDeltaWQ(final CallContext context) { |
8996 | 343 return getFormatter(context, FIX_DELTA_W_DELTA_Q_MIN_DIGITS, FIX_DELTA_W_DELTA_Q_MAX_DIGITS); |
8951 | 344 } |
345 | |
346 public static NumberFormat getFixDeltaWW(final CallContext context) { | |
8996 | 347 return getFormatter(context, FIX_DELTA_W_DELTA_W_MIN_DIGITS, FIX_DELTA_W_DELTA_W_MAX_DIGITS); |
8951 | 348 } |
349 | |
350 public static NumberFormat getVariance(final CallContext context) { | |
8996 | 351 return getFormatter(context, VARIANCE_MIN_DIGITS, VARIANCE_MAX_DIGITS); |
6172
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
352 } |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
353 |
8951 | 354 public static NumberFormat getSQRelationA(final CallContext context) { |
8996 | 355 return getScientificFormater(context, SQ_RELATION_A_MIN_DIGITS, SQ_RELATION_A_MAX_DIGITS); |
6207
a82a724356f0
Updade sq relation pdf export as specified in issue1071
Andre Heinecke <aheinecke@intevation.de>
parents:
6172
diff
changeset
|
356 } |
a82a724356f0
Updade sq relation pdf export as specified in issue1071
Andre Heinecke <aheinecke@intevation.de>
parents:
6172
diff
changeset
|
357 |
8951 | 358 public static NumberFormat getSQRelationB(final CallContext context) { |
8996 | 359 return getFormatter(context, SQ_RELATION_B_MIN_DIGITS, SQ_RELATION_B_MAX_DIGITS); |
6172
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
360 } |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
361 |
8951 | 362 public static NumberFormat getSQRelationKM(final CallContext context) { |
8996 | 363 return getFormatter(context, SQ_RELATION_KM_MIN_DIGITS, SQ_RELATION_KM_MAX_DIGITS); |
6322
8c976bb0362f
Add SQ Relation KM formatter and use it fopr issue 1071
Andre Heinecke <aheinecke@intevation.de>
parents:
6207
diff
changeset
|
364 } |
8c976bb0362f
Add SQ Relation KM formatter and use it fopr issue 1071
Andre Heinecke <aheinecke@intevation.de>
parents:
6207
diff
changeset
|
365 |
8951 | 366 public static NumberFormat getMeterFormat(final CallContext context) { |
8996 | 367 return getFormatter(context, 0, 2); |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3017
diff
changeset
|
368 |
3017
296b067e17e6
i18n and format for line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2787
diff
changeset
|
369 } |
3402
0336132ec9db
Adjusted Delta W(t) CSV exporter to customers wishes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3397
diff
changeset
|
370 |
8951 | 371 public static DateFormat getDateFormatter(final CallMeta m, final String pattern) { |
372 final Locale locale = Resources.getLocale(m); | |
3402
0336132ec9db
Adjusted Delta W(t) CSV exporter to customers wishes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3397
diff
changeset
|
373 return new SimpleDateFormat(pattern, locale); |
0336132ec9db
Adjusted Delta W(t) CSV exporter to customers wishes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3397
diff
changeset
|
374 } |
8862
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
375 |
8951 | 376 public static NumberFormat getMeanBedHeight(final CallContext context) { |
8862
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
377 return Formatter.getFormatter(context, 2, 2); |
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
378 } |
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
379 |
8951 | 380 public static NumberFormat getTkh(final CallContext context) { |
8862
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
381 return Formatter.getFormatter(context, 1, 1); |
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
382 } |
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
383 |
8951 | 384 public static NumberFormat getFlowDepth(final CallContext context) { |
9335
7dc238bd062c
Fixed: calculation of flow depth and tkh with rounding to cm, calculator return differentiated
mschaefer
parents:
9145
diff
changeset
|
385 return Formatter.getFormatter(context, FLOWDEPTH_MAX_DIGITS, FLOWDEPTH_MAX_DIGITS); |
7dc238bd062c
Fixed: calculation of flow depth and tkh with rounding to cm, calculator return differentiated
mschaefer
parents:
9145
diff
changeset
|
386 } |
7dc238bd062c
Fixed: calculation of flow depth and tkh with rounding to cm, calculator return differentiated
mschaefer
parents:
9145
diff
changeset
|
387 |
9382
8ae7137b67d7
Fixed: avoiding NaN exception in BigDecimal rounding
mschaefer
parents:
9375
diff
changeset
|
388 /** |
8ae7137b67d7
Fixed: avoiding NaN exception in BigDecimal rounding
mschaefer
parents:
9375
diff
changeset
|
389 * Decimal half even rounding of a flow depth value |
9421
53e26734e4d2
Fixed NaN handling in salix historical scenarion calculation, added problem report
mschaefer
parents:
9382
diff
changeset
|
390 * (ATTENTION: throws an exception for NaN or Infinity!) |
9382
8ae7137b67d7
Fixed: avoiding NaN exception in BigDecimal rounding
mschaefer
parents:
9375
diff
changeset
|
391 */ |
9375
a0a2e68a1e11
Fixed: cm rounding in S-Info flow depth/tkh and U-Info salix via BigDecimal, half_even mode
mschaefer
parents:
9367
diff
changeset
|
392 public static BigDecimal roundFlowDepth(final double value) { |
a0a2e68a1e11
Fixed: cm rounding in S-Info flow depth/tkh and U-Info salix via BigDecimal, half_even mode
mschaefer
parents:
9367
diff
changeset
|
393 return BigDecimal.valueOf(value).setScale(FLOWDEPTH_MAX_DIGITS, RoundingMode.HALF_EVEN); |
8862
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
394 } |
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
395 |
8951 | 396 public static NumberFormat getW(final CallContext context) { |
8862
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
397 return Formatter.getFormatter(context, 2, 2); |
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
398 } |
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
399 |
9382
8ae7137b67d7
Fixed: avoiding NaN exception in BigDecimal rounding
mschaefer
parents:
9375
diff
changeset
|
400 /** |
8ae7137b67d7
Fixed: avoiding NaN exception in BigDecimal rounding
mschaefer
parents:
9375
diff
changeset
|
401 * Decimal half even rounding of a W value |
9421
53e26734e4d2
Fixed NaN handling in salix historical scenarion calculation, added problem report
mschaefer
parents:
9382
diff
changeset
|
402 * (ATTENTION: throws an exception for NaN or Infinity!) |
9382
8ae7137b67d7
Fixed: avoiding NaN exception in BigDecimal rounding
mschaefer
parents:
9375
diff
changeset
|
403 */ |
9375
a0a2e68a1e11
Fixed: cm rounding in S-Info flow depth/tkh and U-Info salix via BigDecimal, half_even mode
mschaefer
parents:
9367
diff
changeset
|
404 public static BigDecimal roundW(final double value) { |
a0a2e68a1e11
Fixed: cm rounding in S-Info flow depth/tkh and U-Info salix via BigDecimal, half_even mode
mschaefer
parents:
9367
diff
changeset
|
405 return BigDecimal.valueOf(value).setScale(WATERLEVEL_W_MAX_DIGITS, RoundingMode.HALF_EVEN); |
9361
2aec052d4088
Refactoring on SalixLineCalculationResult etc., calculation using MQ etc., scenario (regional+supra) csv columns and meta data added
mschaefer
parents:
9335
diff
changeset
|
406 } |
2aec052d4088
Refactoring on SalixLineCalculationResult etc., calculation using MQ etc., scenario (regional+supra) csv columns and meta data added
mschaefer
parents:
9335
diff
changeset
|
407 |
8862
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
408 /** |
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
409 * Another waterlevel formatter with fixed digits (always 2) |
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
410 */ |
8951 | 411 public static NumberFormat getWaterlevelW2(final CallMeta meta) { |
8996 | 412 return getFormatter(meta, 2, 2); |
8862
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
413 } |
8951 | 414 |
9112
189cc8ededbd
Added datacage select and chart display for river channel sizes loaded from database
mschaefer
parents:
9006
diff
changeset
|
415 public static NumberFormat getChannelWidth(final CallContext context) { |
189cc8ededbd
Added datacage select and chart display for river channel sizes loaded from database
mschaefer
parents:
9006
diff
changeset
|
416 return getFormatter(context.getMeta(), 2, 2); |
189cc8ededbd
Added datacage select and chart display for river channel sizes loaded from database
mschaefer
parents:
9006
diff
changeset
|
417 } |
189cc8ededbd
Added datacage select and chart display for river channel sizes loaded from database
mschaefer
parents:
9006
diff
changeset
|
418 |
189cc8ededbd
Added datacage select and chart display for river channel sizes loaded from database
mschaefer
parents:
9006
diff
changeset
|
419 public static NumberFormat getChannelDepth(final CallContext context) { |
189cc8ededbd
Added datacage select and chart display for river channel sizes loaded from database
mschaefer
parents:
9006
diff
changeset
|
420 return getFormatter(context.getMeta(), 2, 2); |
189cc8ededbd
Added datacage select and chart display for river channel sizes loaded from database
mschaefer
parents:
9006
diff
changeset
|
421 } |
189cc8ededbd
Added datacage select and chart display for river channel sizes loaded from database
mschaefer
parents:
9006
diff
changeset
|
422 |
8951 | 423 public static NumberFormat getFlowDepthDevelopmentPerYear(final CallContext context) { |
424 return getFormatter(context.getMeta(), 2, 2); | |
425 } | |
8996 | 426 |
427 public static NumberFormat getSalixLine(final CallContext context) { | |
428 return Formatter.getFormatter(context, 2, 2); | |
429 } | |
9006 | 430 |
431 public static NumberFormat getUeberflutungsdauer(final CallContext context) { | |
432 return Formatter.getFormatter(context, 0, 0); | |
433 } | |
9115
a165cd63099f
Added datacage select and chart display for river infrastructure heights loaded from database
mschaefer
parents:
9112
diff
changeset
|
434 |
a165cd63099f
Added datacage select and chart display for river infrastructure heights loaded from database
mschaefer
parents:
9112
diff
changeset
|
435 public static NumberFormat getInfrastructureHeight(final CallContext context) { |
a165cd63099f
Added datacage select and chart display for river infrastructure heights loaded from database
mschaefer
parents:
9112
diff
changeset
|
436 return getFormatter(context.getMeta(), 2, 2); |
a165cd63099f
Added datacage select and chart display for river infrastructure heights loaded from database
mschaefer
parents:
9112
diff
changeset
|
437 } |
9117
623b51bf03d7
Added datacage select and chart display for river bed collision counts loaded from database
mschaefer
parents:
9115
diff
changeset
|
438 |
9145 | 439 public static NumberFormat getIntegerFormatter(final CallContext context) { |
440 return getFormatter(context.getMeta(), 0, 0); | |
441 } | |
442 | |
9117
623b51bf03d7
Added datacage select and chart display for river bed collision counts loaded from database
mschaefer
parents:
9115
diff
changeset
|
443 public static NumberFormat getCollisionCount(final CallContext context) { |
623b51bf03d7
Added datacage select and chart display for river bed collision counts loaded from database
mschaefer
parents:
9115
diff
changeset
|
444 return getFormatter(context.getMeta(), 0, 0); |
623b51bf03d7
Added datacage select and chart display for river bed collision counts loaded from database
mschaefer
parents:
9115
diff
changeset
|
445 } |
623b51bf03d7
Added datacage select and chart display for river bed collision counts loaded from database
mschaefer
parents:
9115
diff
changeset
|
446 |
623b51bf03d7
Added datacage select and chart display for river bed collision counts loaded from database
mschaefer
parents:
9115
diff
changeset
|
447 public static NumberFormat getCollisionGaugeW(final CallContext context) { |
623b51bf03d7
Added datacage select and chart display for river bed collision counts loaded from database
mschaefer
parents:
9115
diff
changeset
|
448 return getFormatter(context.getMeta(), 0, 2); // cm |
623b51bf03d7
Added datacage select and chart display for river bed collision counts loaded from database
mschaefer
parents:
9115
diff
changeset
|
449 } |
8951 | 450 } |