Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/utils/Formatter.java @ 9573:b9c87bbff6a4
mean bed height -> mean bed LEVEL
author | gernotbelger |
---|---|
date | Tue, 06 Nov 2018 10:56:22 +0100 |
parents | 83e6acdf8fc6 |
children | f8308db94634 |
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 |
3402
0336132ec9db
Adjusted Delta W(t) CSV exporter to customers wishes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3397
diff
changeset
|
11 import java.text.DateFormat; |
8951 | 12 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
|
13 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
|
14 import java.text.SimpleDateFormat; |
3771 | 15 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
|
16 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5639
diff
changeset
|
17 import org.dive4elements.artifacts.CallContext; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5639
diff
changeset
|
18 import org.dive4elements.artifacts.CallMeta; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5639
diff
changeset
|
19 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
|
20 |
5639
db4e7ff0b987
Doc and whitespaces.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3771
diff
changeset
|
21 /** 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
|
22 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
|
23 |
2290
6f4a1f513e89
Calculation error report: i18n the km of the error report.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2258
diff
changeset
|
24 // 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
|
25 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
|
26 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
|
27 |
445
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 // 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
|
29 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
|
30 public static final int WATERLEVEL_KM_MAX_DIGITS = 3; |
8996 | 31 public static final int WATERLEVEL_W_MIN_DIGITS = 0; |
32 public static final int WATERLEVEL_W_MAX_DIGITS = 2; | |
33 public static final int WATERLEVEL_Q_MIN_DIGITS = 0; | |
34 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
|
35 |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 // COMPUTED DISCHARGE CURVE FORMATTER CONSTANTS |
8996 | 37 public static final int COMPUTED_DISCHARGE_W_MIN_DIGITS = 2; |
38 public static final int COMPUTED_DISCHARGE_W_MAX_DIGITS = 2; | |
39 public static final int COMPUTED_DISCHARGE_Q_MIN_DIGITS = 0; | |
40 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
|
41 |
2258
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
42 // HISTORICAL DISCHARGE CURVE FORMATTER CONSTANTS |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
43 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
|
44 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
|
45 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
|
46 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
|
47 |
445
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 // 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
|
49 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
|
50 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
|
51 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
|
52 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
|
53 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
|
54 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
|
55 |
2702
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2588
diff
changeset
|
56 // FLOW VELOCITY FORMATTER CONSTANTS |
8996 | 57 public static final int FLOW_VELOCITY_KM_MIN_DIGITS = 3; |
58 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
|
59 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
|
60 public static final int FLOW_VELOCITY_VALUES_MAX_DIGITS = 2; |
8996 | 61 public static final int FLOW_VELOCITY_Q_MIN_DIGITS = 0; |
62 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
|
63 |
9573 | 64 // MEAN BED LEVEL FORMATTER CONSTANTS |
8996 | 65 public static final int MIDDLE_BED_HEIGHT_KM_MIN_DIGITS = 3; |
66 public static final int MIDDLE_BED_HEIGHT_KM_MAX_DIGITS = 3; | |
67 public static final int MIDDLE_BED_HEIGHT_HEIGHT_MIN_DIGITS = 3; | |
68 public static final int MIDDLE_BED_HEIGHT_HEIGHT_MAX_DIGITS = 3; | |
69 public static final int MIDDLE_BED_HEIGHT_UNCERT_MIN_DIGITS = 3; | |
70 public static final int MIDDLE_BED_HEIGHT_UNCERT_MAX_DIGITS = 3; | |
71 public static final int MIDDLE_BED_HEIGHT_DATAGAP_MIN_DIGITS = 2; | |
72 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
|
73 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
|
74 public static final int MIDDLE_BED_HEIGHT_SOUNDING_WIDTH_MAX_DIGITS = 0; |
8996 | 75 public static final int MIDDLE_BED_HEIGHT_WIDTH_MIN_DIGITS = 3; |
76 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
|
77 |
2787
e63969c173e9
FixA: Added CSV export for Delta W/t values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2714
diff
changeset
|
78 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
|
79 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
|
80 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
|
81 public static final int FIX_DELTA_W_DELTA_W_MAX_DIGITS = 3; |
8996 | 82 public static final int FIX_DELTA_W_DELTA_Q_MIN_DIGITS = 0; |
83 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
|
84 |
6207
a82a724356f0
Updade sq relation pdf export as specified in issue1071
Andre Heinecke <aheinecke@intevation.de>
parents:
6172
diff
changeset
|
85 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
|
86 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
|
87 |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
88 // SQ Relation |
6322
8c976bb0362f
Add SQ Relation KM formatter and use it fopr issue 1071
Andre Heinecke <aheinecke@intevation.de>
parents:
6207
diff
changeset
|
89 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
|
90 public static final int SQ_RELATION_KM_MAX_DIGITS = 2; |
8996 | 91 public static final int SQ_RELATION_A_MAX_DIGITS = 2; |
92 public static final int SQ_RELATION_A_MIN_DIGITS = 2; | |
93 public static final int SQ_RELATION_B_MAX_DIGITS = 3; | |
94 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
|
95 |
7047
b5e9b8b5c8d6
issue1493: Use other numberformat for csv data from diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7020
diff
changeset
|
96 // OTHER |
8996 | 97 public static final int CSV_DIAGRAM_DATA_MAX_DIGITS = 3; |
98 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
|
99 |
9335
7dc238bd062c
Fixed: calculation of flow depth and tkh with rounding to cm, calculator return differentiated
mschaefer
parents:
9145
diff
changeset
|
100 // S-INFO |
7dc238bd062c
Fixed: calculation of flow depth and tkh with rounding to cm, calculator return differentiated
mschaefer
parents:
9145
diff
changeset
|
101 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
|
102 |
3017
296b067e17e6
i18n and format for line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2787
diff
changeset
|
103 /** |
3771 | 104 * Creates a localized NumberFormatter with given range of decimal digits. |
9006 | 105 * |
8996 | 106 * @param m |
107 * CallMeta to find the locale. | |
108 * @param min | |
109 * minimum number of decimal ("fraction") digits. | |
110 * @param max | |
111 * maximum number of decimal ("fraction") digits. | |
3017
296b067e17e6
i18n and format for line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2787
diff
changeset
|
112 * @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
|
113 * of NUMBER. |
296b067e17e6
i18n and format for line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2787
diff
changeset
|
114 */ |
8996 | 115 public static NumberFormat getFormatter(final CallMeta m, final int min, final int max) { |
116 final Locale locale = Resources.getLocale(m); | |
117 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
|
118 |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
119 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
|
120 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
|
121 |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
122 return nf; |
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 |
8996 | 125 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
|
126 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
|
127 } |
6f4a1f513e89
Calculation error report: i18n the km of the error report.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2258
diff
changeset
|
128 |
445
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
129 /** |
2087
bda04ae1154f
#196 Localized the WQ labels in CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1683
diff
changeset
|
130 * 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
|
131 * |
8996 | 132 * @param c |
133 * The CallContext. | |
2087
bda04ae1154f
#196 Localized the WQ labels in CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1683
diff
changeset
|
134 * |
bda04ae1154f
#196 Localized the WQ labels in CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1683
diff
changeset
|
135 * @return a number formatter. |
bda04ae1154f
#196 Localized the WQ labels in CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1683
diff
changeset
|
136 */ |
8951 | 137 public static NumberFormat getRawFormatter(final CallContext c) { |
138 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
|
139 return NumberFormat.getInstance(locale); |
bda04ae1154f
#196 Localized the WQ labels in CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1683
diff
changeset
|
140 } |
bda04ae1154f
#196 Localized the WQ labels in CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1683
diff
changeset
|
141 |
6172
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
142 /** |
6683
c6c3a2a26a33
Use full stop in doc. This fixes my syntax highlight :) .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6322
diff
changeset
|
143 * Returns a formatter in engineering notation. |
6172
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
144 */ |
8951 | 145 public static NumberFormat getEngFormatter(final CallContext c) { |
146 final NumberFormat nf = getRawFormatter(c); | |
6172
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
147 if (nf instanceof DecimalFormat) { |
8996 | 148 final DecimalFormat df = (DecimalFormat) nf; |
6172
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
149 df.applyPattern("##0.#####E0"); |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
150 } |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
151 return nf; |
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 |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
154 /** |
6683
c6c3a2a26a33
Use full stop in doc. This fixes my syntax highlight :) .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6322
diff
changeset
|
155 * 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
|
156 */ |
8996 | 157 public static NumberFormat getScientificFormater(final CallContext c, final int min, final int max) { |
8951 | 158 final NumberFormat nf = getRawFormatter(c); |
6172
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
159 if (nf instanceof DecimalFormat) { |
8996 | 160 final DecimalFormat df = (DecimalFormat) nf; |
6172
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
161 df.applyPattern("0.0E0"); |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
162 df.setMaximumFractionDigits(max); |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
163 df.setMinimumFractionDigits(min); |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
164 } |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
165 return nf; |
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 |
2087
bda04ae1154f
#196 Localized the WQ labels in CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1683
diff
changeset
|
168 /** |
2258
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
169 * 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
|
170 */ |
8951 | 171 public static DateFormat getShortDateFormat(final CallContext cc) { |
172 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
|
173 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
|
174 } |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
175 |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
176 /** |
2588
7dd45896e941
Issue 459.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2305
diff
changeset
|
177 * Returns a date formatter with MEDIUM style. |
7dd45896e941
Issue 459.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2305
diff
changeset
|
178 */ |
8951 | 179 public static DateFormat getMediumDateFormat(final CallContext cc) { |
180 final Locale locale = Resources.getLocale(cc.getMeta()); | |
2588
7dd45896e941
Issue 459.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2305
diff
changeset
|
181 return DateFormat.getDateInstance(DateFormat.MEDIUM, locale); |
7dd45896e941
Issue 459.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2305
diff
changeset
|
182 } |
7dd45896e941
Issue 459.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2305
diff
changeset
|
183 |
7dd45896e941
Issue 459.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2305
diff
changeset
|
184 /** |
445
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
185 * 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
|
186 * |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
187 * @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
|
188 */ |
8951 | 189 public static NumberFormat getWaterlevelKM(final CallContext context) { |
8996 | 190 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
|
191 } |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
192 |
7047
b5e9b8b5c8d6
issue1493: Use other numberformat for csv data from diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7020
diff
changeset
|
193 /** |
b5e9b8b5c8d6
issue1493: Use other numberformat for csv data from diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7020
diff
changeset
|
194 * 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
|
195 * calculation. |
b5e9b8b5c8d6
issue1493: Use other numberformat for csv data from diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7020
diff
changeset
|
196 * |
b5e9b8b5c8d6
issue1493: Use other numberformat for csv data from diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7020
diff
changeset
|
197 * @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
|
198 */ |
8951 | 199 public static NumberFormat getCSVFormatter(final CallContext context) { |
8996 | 200 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
|
201 } |
5639
db4e7ff0b987
Doc and whitespaces.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3771
diff
changeset
|
202 |
8951 | 203 public static NumberFormat getWaterlevelW(final CallMeta meta) { |
8996 | 204 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
|
205 } |
445
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
206 |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
207 /** |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
208 * 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
|
209 * |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
210 * @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
|
211 */ |
8951 | 212 public static NumberFormat getWaterlevelW(final CallContext context) { |
8996 | 213 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
|
214 } |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
215 |
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 * 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
|
218 * |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
219 * @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
|
220 */ |
8951 | 221 public static NumberFormat getWaterlevelQ(final CallContext context) { |
8996 | 222 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
|
223 } |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
224 |
8951 | 225 public static NumberFormat getWaterlevelQ(final CallMeta meta) { |
8996 | 226 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
|
227 } |
445
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
228 |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
229 /** |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
230 * 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
|
231 * discharge curves. |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
232 * |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
233 * @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
|
234 */ |
8951 | 235 public static NumberFormat getComputedDischargeW(final CallContext context) { |
8996 | 236 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
|
237 } |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
238 |
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 * 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
|
241 * discharge curves. |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
242 * |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
243 * @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
|
244 */ |
8951 | 245 public static NumberFormat getComputedDischargeQ(final CallContext context) { |
8996 | 246 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
|
247 } |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
248 |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
249 /** |
2258
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
250 * 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
|
251 * discharge curves. |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
252 * |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
253 * @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
|
254 */ |
8951 | 255 public static NumberFormat getHistoricalDischargeW(final CallContext context) { |
8996 | 256 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
|
257 } |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
258 |
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 * 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
|
261 * discharge curves. |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
262 * |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
263 * @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
|
264 */ |
8951 | 265 public static NumberFormat getHistoricalDischargeQ(final CallContext context) { |
8996 | 266 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
|
267 } |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
268 |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
269 /** |
445
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
270 * 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
|
271 * |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
272 * @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
|
273 */ |
8951 | 274 public static NumberFormat getDurationW(final CallContext context) { |
8996 | 275 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
|
276 } |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
277 |
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 * 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
|
280 * |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
281 * @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
|
282 */ |
8951 | 283 public static NumberFormat getDurationQ(final CallContext context) { |
8996 | 284 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
|
285 } |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
286 |
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 * 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
|
289 * |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
290 * @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
|
291 */ |
8951 | 292 public static NumberFormat getDurationD(final CallContext context) { |
8996 | 293 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
|
294 } |
2290
6f4a1f513e89
Calculation error report: i18n the km of the error report.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2258
diff
changeset
|
295 |
8951 | 296 public static NumberFormat getCalculationKm(final CallMeta meta) { |
8996 | 297 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
|
298 } |
2952f6dee5cf
Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2702
diff
changeset
|
299 |
8996 | 300 public static NumberFormat getFlowVelocityKM(final CallContext context) { |
301 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
|
302 } |
2952f6dee5cf
Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2702
diff
changeset
|
303 |
8996 | 304 public static NumberFormat getFlowVelocityValues(final CallContext context) { |
305 return getFormatter(context, FLOW_VELOCITY_VALUES_MIN_DIGITS, FLOW_VELOCITY_VALUES_MAX_DIGITS); | |
306 } | |
307 | |
308 public static NumberFormat getFlowVelocityQ(final CallContext context) { | |
309 return getFormatter(context, FLOW_VELOCITY_Q_MIN_DIGITS, FLOW_VELOCITY_Q_MAX_DIGITS); | |
310 } | |
311 | |
312 public static NumberFormat getMiddleBedHeightKM(final CallContext context) { | |
313 return getFormatter(context, MIDDLE_BED_HEIGHT_KM_MIN_DIGITS, MIDDLE_BED_HEIGHT_KM_MAX_DIGITS); | |
314 } | |
315 | |
316 public static NumberFormat getMiddleBedHeightHeight(final CallContext context) { | |
317 return getFormatter(context, MIDDLE_BED_HEIGHT_HEIGHT_MIN_DIGITS, MIDDLE_BED_HEIGHT_HEIGHT_MAX_DIGITS); | |
318 } | |
2714
2952f6dee5cf
Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2702
diff
changeset
|
319 |
8951 | 320 public static NumberFormat getMiddleBedHeightUncert(final CallContext context) { |
8996 | 321 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
|
322 } |
2952f6dee5cf
Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2702
diff
changeset
|
323 |
8951 | 324 public static NumberFormat getMiddleBedHeightDataGap(final CallContext context) { |
8996 | 325 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
|
326 } |
2952f6dee5cf
Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2702
diff
changeset
|
327 |
8996 | 328 public static NumberFormat getMiddleBedHeightSounding(final CallContext context) { |
329 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
|
330 } |
2952f6dee5cf
Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2702
diff
changeset
|
331 |
8951 | 332 public static NumberFormat getFixDeltaWKM(final CallContext context) { |
8996 | 333 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
|
334 } |
e63969c173e9
FixA: Added CSV export for Delta W/t values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2714
diff
changeset
|
335 |
8951 | 336 public static NumberFormat getFixDeltaWDeltaW(final CallContext context) { |
8996 | 337 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
|
338 } |
3397
6d1740533810
FixA: Added discharge column to DeltaW(t) CSV export.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3162
diff
changeset
|
339 |
8951 | 340 public static NumberFormat getFixDeltaWQ(final CallContext context) { |
8996 | 341 return getFormatter(context, FIX_DELTA_W_DELTA_Q_MIN_DIGITS, FIX_DELTA_W_DELTA_Q_MAX_DIGITS); |
8951 | 342 } |
343 | |
344 public static NumberFormat getFixDeltaWW(final CallContext context) { | |
8996 | 345 return getFormatter(context, FIX_DELTA_W_DELTA_W_MIN_DIGITS, FIX_DELTA_W_DELTA_W_MAX_DIGITS); |
8951 | 346 } |
347 | |
348 public static NumberFormat getVariance(final CallContext context) { | |
8996 | 349 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
|
350 } |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
351 |
8951 | 352 public static NumberFormat getSQRelationA(final CallContext context) { |
8996 | 353 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
|
354 } |
a82a724356f0
Updade sq relation pdf export as specified in issue1071
Andre Heinecke <aheinecke@intevation.de>
parents:
6172
diff
changeset
|
355 |
8951 | 356 public static NumberFormat getSQRelationB(final CallContext context) { |
8996 | 357 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
|
358 } |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
359 |
8951 | 360 public static NumberFormat getSQRelationKM(final CallContext context) { |
8996 | 361 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
|
362 } |
8c976bb0362f
Add SQ Relation KM formatter and use it fopr issue 1071
Andre Heinecke <aheinecke@intevation.de>
parents:
6207
diff
changeset
|
363 |
8951 | 364 public static NumberFormat getMeterFormat(final CallContext context) { |
8996 | 365 return getFormatter(context, 0, 2); |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3017
diff
changeset
|
366 |
3017
296b067e17e6
i18n and format for line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2787
diff
changeset
|
367 } |
3402
0336132ec9db
Adjusted Delta W(t) CSV exporter to customers wishes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3397
diff
changeset
|
368 |
8951 | 369 public static DateFormat getDateFormatter(final CallMeta m, final String pattern) { |
370 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
|
371 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
|
372 } |
8862
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
373 |
8951 | 374 public static NumberFormat getMeanBedHeight(final CallContext context) { |
8862
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
375 return Formatter.getFormatter(context, 2, 2); |
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
376 } |
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
377 |
8951 | 378 public static NumberFormat getTkh(final CallContext context) { |
8862
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
379 return Formatter.getFormatter(context, 1, 1); |
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
380 } |
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
381 |
8951 | 382 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
|
383 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
|
384 } |
7dc238bd062c
Fixed: calculation of flow depth and tkh with rounding to cm, calculator return differentiated
mschaefer
parents:
9145
diff
changeset
|
385 |
8951 | 386 public static NumberFormat getW(final CallContext context) { |
8862
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
387 return Formatter.getFormatter(context, 2, 2); |
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
388 } |
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
389 |
9382
8ae7137b67d7
Fixed: avoiding NaN exception in BigDecimal rounding
mschaefer
parents:
9375
diff
changeset
|
390 /** |
8862
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
391 * Another waterlevel formatter with fixed digits (always 2) |
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
392 */ |
8951 | 393 public static NumberFormat getWaterlevelW2(final CallMeta meta) { |
8996 | 394 return getFormatter(meta, 2, 2); |
8862
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
395 } |
8951 | 396 |
9112
189cc8ededbd
Added datacage select and chart display for river channel sizes loaded from database
mschaefer
parents:
9006
diff
changeset
|
397 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
|
398 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
|
399 } |
189cc8ededbd
Added datacage select and chart display for river channel sizes loaded from database
mschaefer
parents:
9006
diff
changeset
|
400 |
189cc8ededbd
Added datacage select and chart display for river channel sizes loaded from database
mschaefer
parents:
9006
diff
changeset
|
401 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
|
402 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
|
403 } |
189cc8ededbd
Added datacage select and chart display for river channel sizes loaded from database
mschaefer
parents:
9006
diff
changeset
|
404 |
8951 | 405 public static NumberFormat getFlowDepthDevelopmentPerYear(final CallContext context) { |
406 return getFormatter(context.getMeta(), 2, 2); | |
407 } | |
8996 | 408 |
409 public static NumberFormat getSalixLine(final CallContext context) { | |
410 return Formatter.getFormatter(context, 2, 2); | |
411 } | |
9006 | 412 |
413 public static NumberFormat getUeberflutungsdauer(final CallContext context) { | |
414 return Formatter.getFormatter(context, 0, 0); | |
415 } | |
9115
a165cd63099f
Added datacage select and chart display for river infrastructure heights loaded from database
mschaefer
parents:
9112
diff
changeset
|
416 |
a165cd63099f
Added datacage select and chart display for river infrastructure heights loaded from database
mschaefer
parents:
9112
diff
changeset
|
417 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
|
418 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
|
419 } |
9117
623b51bf03d7
Added datacage select and chart display for river bed collision counts loaded from database
mschaefer
parents:
9115
diff
changeset
|
420 |
9145 | 421 public static NumberFormat getIntegerFormatter(final CallContext context) { |
422 return getFormatter(context.getMeta(), 0, 0); | |
423 } | |
424 | |
9117
623b51bf03d7
Added datacage select and chart display for river bed collision counts loaded from database
mschaefer
parents:
9115
diff
changeset
|
425 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
|
426 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
|
427 } |
623b51bf03d7
Added datacage select and chart display for river bed collision counts loaded from database
mschaefer
parents:
9115
diff
changeset
|
428 |
623b51bf03d7
Added datacage select and chart display for river bed collision counts loaded from database
mschaefer
parents:
9115
diff
changeset
|
429 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
|
430 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
|
431 } |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9421
diff
changeset
|
432 |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9421
diff
changeset
|
433 public static NumberFormat getCurrencyFormat(final CallContext context) { |
9451 | 434 final NumberFormat nf = getFormatter(context.getMeta(), 2, 2); |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9421
diff
changeset
|
435 nf.setGroupingUsed(true); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9421
diff
changeset
|
436 return nf; |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9421
diff
changeset
|
437 } |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9421
diff
changeset
|
438 |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9421
diff
changeset
|
439 public static NumberFormat getDensityFormat(final CallContext context) { |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9421
diff
changeset
|
440 return getFormatter(context, 3, 3); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9421
diff
changeset
|
441 } |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9421
diff
changeset
|
442 |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9421
diff
changeset
|
443 public static NumberFormat getMassFormat(final CallContext context) { |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9421
diff
changeset
|
444 return getFormatter(context, 0, 1); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9421
diff
changeset
|
445 } |
8951 | 446 } |