Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/utils/Formatter.java @ 9612:f8308db94634
#20 UI, Diagramme
author | dnt_bjoernsen <d.tironi@bjoernsen.de> |
---|---|
date | Wed, 09 Oct 2019 16:17:16 +0200 |
parents | b9c87bbff6a4 |
children |
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 /** |
9612 | 104 * Creates a NumberFormatter to format numbers with 3 significant figures. |
105 * | |
106 * not used as real string output, only used to 'trim' numbers | |
107 * | |
108 */ | |
109 | |
110 public static final NumberFormat SIGINIFICANT_FORMATTER_3 = new DecimalFormat("##.#E0"); | |
111 | |
112 /** | |
3771 | 113 * Creates a localized NumberFormatter with given range of decimal digits. |
9006 | 114 * |
8996 | 115 * @param m |
116 * CallMeta to find the locale. | |
117 * @param min | |
118 * minimum number of decimal ("fraction") digits. | |
119 * @param max | |
120 * maximum number of decimal ("fraction") digits. | |
3017
296b067e17e6
i18n and format for line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2787
diff
changeset
|
121 * @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
|
122 * of NUMBER. |
296b067e17e6
i18n and format for line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2787
diff
changeset
|
123 */ |
8996 | 124 public static NumberFormat getFormatter(final CallMeta m, final int min, final int max) { |
125 final Locale locale = Resources.getLocale(m); | |
126 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
|
127 |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
128 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
|
129 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
|
130 |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
131 return nf; |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
132 } |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
133 |
8996 | 134 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
|
135 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
|
136 } |
6f4a1f513e89
Calculation error report: i18n the km of the error report.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2258
diff
changeset
|
137 |
445
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
138 /** |
2087
bda04ae1154f
#196 Localized the WQ labels in CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1683
diff
changeset
|
139 * 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
|
140 * |
8996 | 141 * @param c |
142 * The CallContext. | |
2087
bda04ae1154f
#196 Localized the WQ labels in CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1683
diff
changeset
|
143 * |
bda04ae1154f
#196 Localized the WQ labels in CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1683
diff
changeset
|
144 * @return a number formatter. |
bda04ae1154f
#196 Localized the WQ labels in CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1683
diff
changeset
|
145 */ |
8951 | 146 public static NumberFormat getRawFormatter(final CallContext c) { |
147 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
|
148 return NumberFormat.getInstance(locale); |
bda04ae1154f
#196 Localized the WQ labels in CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1683
diff
changeset
|
149 } |
bda04ae1154f
#196 Localized the WQ labels in CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1683
diff
changeset
|
150 |
6172
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
151 /** |
6683
c6c3a2a26a33
Use full stop in doc. This fixes my syntax highlight :) .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6322
diff
changeset
|
152 * Returns a formatter in engineering notation. |
6172
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
153 */ |
8951 | 154 public static NumberFormat getEngFormatter(final CallContext c) { |
155 final NumberFormat nf = getRawFormatter(c); | |
6172
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
156 if (nf instanceof DecimalFormat) { |
8996 | 157 final DecimalFormat df = (DecimalFormat) nf; |
6172
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
158 df.applyPattern("##0.#####E0"); |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
159 } |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
160 return nf; |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
161 } |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
162 |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
163 /** |
6683
c6c3a2a26a33
Use full stop in doc. This fixes my syntax highlight :) .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6322
diff
changeset
|
164 * 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
|
165 */ |
8996 | 166 public static NumberFormat getScientificFormater(final CallContext c, final int min, final int max) { |
8951 | 167 final NumberFormat nf = getRawFormatter(c); |
6172
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
168 if (nf instanceof DecimalFormat) { |
8996 | 169 final DecimalFormat df = (DecimalFormat) nf; |
6172
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
170 df.applyPattern("0.0E0"); |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
171 df.setMaximumFractionDigits(max); |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
172 df.setMinimumFractionDigits(min); |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
173 } |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
174 return nf; |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
175 } |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
176 |
2087
bda04ae1154f
#196 Localized the WQ labels in CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1683
diff
changeset
|
177 /** |
2258
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
178 * 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
|
179 */ |
8951 | 180 public static DateFormat getShortDateFormat(final CallContext cc) { |
181 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
|
182 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
|
183 } |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
184 |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
185 /** |
2588
7dd45896e941
Issue 459.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2305
diff
changeset
|
186 * Returns a date formatter with MEDIUM style. |
7dd45896e941
Issue 459.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2305
diff
changeset
|
187 */ |
8951 | 188 public static DateFormat getMediumDateFormat(final CallContext cc) { |
189 final Locale locale = Resources.getLocale(cc.getMeta()); | |
2588
7dd45896e941
Issue 459.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2305
diff
changeset
|
190 return DateFormat.getDateInstance(DateFormat.MEDIUM, locale); |
7dd45896e941
Issue 459.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2305
diff
changeset
|
191 } |
7dd45896e941
Issue 459.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2305
diff
changeset
|
192 |
7dd45896e941
Issue 459.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2305
diff
changeset
|
193 /** |
445
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
194 * 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
|
195 * |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
196 * @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
|
197 */ |
8951 | 198 public static NumberFormat getWaterlevelKM(final CallContext context) { |
8996 | 199 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
|
200 } |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
201 |
7047
b5e9b8b5c8d6
issue1493: Use other numberformat for csv data from diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7020
diff
changeset
|
202 /** |
b5e9b8b5c8d6
issue1493: Use other numberformat for csv data from diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7020
diff
changeset
|
203 * 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
|
204 * calculation. |
b5e9b8b5c8d6
issue1493: Use other numberformat for csv data from diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7020
diff
changeset
|
205 * |
b5e9b8b5c8d6
issue1493: Use other numberformat for csv data from diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7020
diff
changeset
|
206 * @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
|
207 */ |
8951 | 208 public static NumberFormat getCSVFormatter(final CallContext context) { |
8996 | 209 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
|
210 } |
5639
db4e7ff0b987
Doc and whitespaces.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3771
diff
changeset
|
211 |
8951 | 212 public static NumberFormat getWaterlevelW(final CallMeta meta) { |
8996 | 213 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
|
214 } |
445
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 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
|
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 W 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 getWaterlevelW(final CallContext context) { |
8996 | 222 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
|
223 } |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
224 |
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 * 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
|
227 * |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
228 * @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
|
229 */ |
8951 | 230 public static NumberFormat getWaterlevelQ(final CallContext context) { |
8996 | 231 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
|
232 } |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
233 |
8951 | 234 public static NumberFormat getWaterlevelQ(final CallMeta meta) { |
8996 | 235 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
|
236 } |
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 * 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
|
240 * discharge curves. |
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 * @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
|
243 */ |
8951 | 244 public static NumberFormat getComputedDischargeW(final CallContext context) { |
8996 | 245 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
|
246 } |
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 * 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
|
250 * discharge curves. |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
251 * |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
252 * @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
|
253 */ |
8951 | 254 public static NumberFormat getComputedDischargeQ(final CallContext context) { |
8996 | 255 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
|
256 } |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
257 |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
258 /** |
2258
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
259 * 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
|
260 * discharge curves. |
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 * @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
|
263 */ |
8951 | 264 public static NumberFormat getHistoricalDischargeW(final CallContext context) { |
8996 | 265 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
|
266 } |
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 * 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
|
270 * discharge curves. |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
271 * |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
272 * @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
|
273 */ |
8951 | 274 public static NumberFormat getHistoricalDischargeQ(final CallContext context) { |
8996 | 275 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
|
276 } |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
277 |
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2087
diff
changeset
|
278 /** |
445
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 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
|
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 getDurationW(final CallContext context) { |
8996 | 284 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
|
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 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
|
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 getDurationQ(final CallContext context) { |
8996 | 293 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
|
294 } |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
295 |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
296 /** |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
297 * 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
|
298 * |
a7947972fdeb
Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
299 * @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
|
300 */ |
8951 | 301 public static NumberFormat getDurationD(final CallContext context) { |
8996 | 302 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
|
303 } |
2290
6f4a1f513e89
Calculation error report: i18n the km of the error report.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2258
diff
changeset
|
304 |
8951 | 305 public static NumberFormat getCalculationKm(final CallMeta meta) { |
8996 | 306 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
|
307 } |
2952f6dee5cf
Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2702
diff
changeset
|
308 |
8996 | 309 public static NumberFormat getFlowVelocityKM(final CallContext context) { |
310 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
|
311 } |
2952f6dee5cf
Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2702
diff
changeset
|
312 |
8996 | 313 public static NumberFormat getFlowVelocityValues(final CallContext context) { |
314 return getFormatter(context, FLOW_VELOCITY_VALUES_MIN_DIGITS, FLOW_VELOCITY_VALUES_MAX_DIGITS); | |
315 } | |
316 | |
317 public static NumberFormat getFlowVelocityQ(final CallContext context) { | |
318 return getFormatter(context, FLOW_VELOCITY_Q_MIN_DIGITS, FLOW_VELOCITY_Q_MAX_DIGITS); | |
319 } | |
320 | |
321 public static NumberFormat getMiddleBedHeightKM(final CallContext context) { | |
322 return getFormatter(context, MIDDLE_BED_HEIGHT_KM_MIN_DIGITS, MIDDLE_BED_HEIGHT_KM_MAX_DIGITS); | |
323 } | |
324 | |
325 public static NumberFormat getMiddleBedHeightHeight(final CallContext context) { | |
326 return getFormatter(context, MIDDLE_BED_HEIGHT_HEIGHT_MIN_DIGITS, MIDDLE_BED_HEIGHT_HEIGHT_MAX_DIGITS); | |
327 } | |
2714
2952f6dee5cf
Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2702
diff
changeset
|
328 |
8951 | 329 public static NumberFormat getMiddleBedHeightUncert(final CallContext context) { |
8996 | 330 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
|
331 } |
2952f6dee5cf
Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2702
diff
changeset
|
332 |
8951 | 333 public static NumberFormat getMiddleBedHeightDataGap(final CallContext context) { |
8996 | 334 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
|
335 } |
2952f6dee5cf
Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2702
diff
changeset
|
336 |
8996 | 337 public static NumberFormat getMiddleBedHeightSounding(final CallContext context) { |
338 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
|
339 } |
2952f6dee5cf
Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2702
diff
changeset
|
340 |
8951 | 341 public static NumberFormat getFixDeltaWKM(final CallContext context) { |
8996 | 342 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
|
343 } |
e63969c173e9
FixA: Added CSV export for Delta W/t values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2714
diff
changeset
|
344 |
8951 | 345 public static NumberFormat getFixDeltaWDeltaW(final CallContext context) { |
8996 | 346 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
|
347 } |
3397
6d1740533810
FixA: Added discharge column to DeltaW(t) CSV export.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3162
diff
changeset
|
348 |
8951 | 349 public static NumberFormat getFixDeltaWQ(final CallContext context) { |
8996 | 350 return getFormatter(context, FIX_DELTA_W_DELTA_Q_MIN_DIGITS, FIX_DELTA_W_DELTA_Q_MAX_DIGITS); |
8951 | 351 } |
352 | |
353 public static NumberFormat getFixDeltaWW(final CallContext context) { | |
8996 | 354 return getFormatter(context, FIX_DELTA_W_DELTA_W_MIN_DIGITS, FIX_DELTA_W_DELTA_W_MAX_DIGITS); |
8951 | 355 } |
356 | |
357 public static NumberFormat getVariance(final CallContext context) { | |
8996 | 358 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
|
359 } |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
360 |
8951 | 361 public static NumberFormat getSQRelationA(final CallContext context) { |
8996 | 362 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
|
363 } |
a82a724356f0
Updade sq relation pdf export as specified in issue1071
Andre Heinecke <aheinecke@intevation.de>
parents:
6172
diff
changeset
|
364 |
8951 | 365 public static NumberFormat getSQRelationB(final CallContext context) { |
8996 | 366 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
|
367 } |
58a613798386
Implement PDF export for SQ Relation
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
368 |
8951 | 369 public static NumberFormat getSQRelationKM(final CallContext context) { |
8996 | 370 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
|
371 } |
8c976bb0362f
Add SQ Relation KM formatter and use it fopr issue 1071
Andre Heinecke <aheinecke@intevation.de>
parents:
6207
diff
changeset
|
372 |
8951 | 373 public static NumberFormat getMeterFormat(final CallContext context) { |
8996 | 374 return getFormatter(context, 0, 2); |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3017
diff
changeset
|
375 |
3017
296b067e17e6
i18n and format for line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2787
diff
changeset
|
376 } |
3402
0336132ec9db
Adjusted Delta W(t) CSV exporter to customers wishes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3397
diff
changeset
|
377 |
8951 | 378 public static DateFormat getDateFormatter(final CallMeta m, final String pattern) { |
379 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
|
380 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
|
381 } |
8862
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
382 |
8951 | 383 public static NumberFormat getMeanBedHeight(final CallContext context) { |
8862
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
384 return Formatter.getFormatter(context, 2, 2); |
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
385 } |
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
386 |
8951 | 387 public static NumberFormat getTkh(final CallContext context) { |
8862
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
388 return Formatter.getFormatter(context, 1, 1); |
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
389 } |
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
390 |
8951 | 391 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
|
392 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
|
393 } |
7dc238bd062c
Fixed: calculation of flow depth and tkh with rounding to cm, calculator return differentiated
mschaefer
parents:
9145
diff
changeset
|
394 |
8951 | 395 public static NumberFormat getW(final CallContext context) { |
8862
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
396 return Formatter.getFormatter(context, 2, 2); |
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
397 } |
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
398 |
9382
8ae7137b67d7
Fixed: avoiding NaN exception in BigDecimal rounding
mschaefer
parents:
9375
diff
changeset
|
399 /** |
8862
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
400 * Another waterlevel formatter with fixed digits (always 2) |
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
401 */ |
8951 | 402 public static NumberFormat getWaterlevelW2(final CallMeta meta) { |
8996 | 403 return getFormatter(meta, 2, 2); |
8862
5b5bdce5a216
Introduced new number formats for some new data types
gernotbelger
parents:
8856
diff
changeset
|
404 } |
8951 | 405 |
9112
189cc8ededbd
Added datacage select and chart display for river channel sizes loaded from database
mschaefer
parents:
9006
diff
changeset
|
406 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
|
407 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
|
408 } |
189cc8ededbd
Added datacage select and chart display for river channel sizes loaded from database
mschaefer
parents:
9006
diff
changeset
|
409 |
189cc8ededbd
Added datacage select and chart display for river channel sizes loaded from database
mschaefer
parents:
9006
diff
changeset
|
410 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
|
411 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
|
412 } |
189cc8ededbd
Added datacage select and chart display for river channel sizes loaded from database
mschaefer
parents:
9006
diff
changeset
|
413 |
8951 | 414 public static NumberFormat getFlowDepthDevelopmentPerYear(final CallContext context) { |
415 return getFormatter(context.getMeta(), 2, 2); | |
416 } | |
8996 | 417 |
418 public static NumberFormat getSalixLine(final CallContext context) { | |
419 return Formatter.getFormatter(context, 2, 2); | |
420 } | |
9006 | 421 |
422 public static NumberFormat getUeberflutungsdauer(final CallContext context) { | |
423 return Formatter.getFormatter(context, 0, 0); | |
424 } | |
9115
a165cd63099f
Added datacage select and chart display for river infrastructure heights loaded from database
mschaefer
parents:
9112
diff
changeset
|
425 |
a165cd63099f
Added datacage select and chart display for river infrastructure heights loaded from database
mschaefer
parents:
9112
diff
changeset
|
426 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
|
427 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
|
428 } |
9117
623b51bf03d7
Added datacage select and chart display for river bed collision counts loaded from database
mschaefer
parents:
9115
diff
changeset
|
429 |
9145 | 430 public static NumberFormat getIntegerFormatter(final CallContext context) { |
431 return getFormatter(context.getMeta(), 0, 0); | |
432 } | |
433 | |
9117
623b51bf03d7
Added datacage select and chart display for river bed collision counts loaded from database
mschaefer
parents:
9115
diff
changeset
|
434 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
|
435 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
|
436 } |
623b51bf03d7
Added datacage select and chart display for river bed collision counts loaded from database
mschaefer
parents:
9115
diff
changeset
|
437 |
623b51bf03d7
Added datacage select and chart display for river bed collision counts loaded from database
mschaefer
parents:
9115
diff
changeset
|
438 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
|
439 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
|
440 } |
9432
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 public static NumberFormat getCurrencyFormat(final CallContext context) { |
9451 | 443 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
|
444 nf.setGroupingUsed(true); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9421
diff
changeset
|
445 return nf; |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9421
diff
changeset
|
446 } |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9421
diff
changeset
|
447 |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9421
diff
changeset
|
448 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
|
449 return getFormatter(context, 3, 3); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9421
diff
changeset
|
450 } |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9421
diff
changeset
|
451 |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9421
diff
changeset
|
452 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
|
453 return getFormatter(context, 0, 1); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9421
diff
changeset
|
454 } |
8951 | 455 } |