Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/SInfoResultType.java @ 9202:b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
author | mschaefer |
---|---|
date | Mon, 02 Jul 2018 07:33:53 +0200 |
parents | 1614cb14308f |
children | 3dae6b78e1da |
comparison
equal
deleted
inserted
replaced
9201:491e1a434457 | 9202:b4402594213b |
---|---|
85 protected NumberFormat createFormatter(final CallContext context) { | 85 protected NumberFormat createFormatter(final CallContext context) { |
86 return Formatter.getIntegerFormatter(context); | 86 return Formatter.getIntegerFormatter(context); |
87 } | 87 } |
88 }; | 88 }; |
89 | 89 |
90 public static final SInfoResultType mainValue1Duration = new SInfoResultType(null, "sinfo.export.main_value_1_duration.csv.header.duration", | 90 public static final SInfoResultType mainValue1Duration = new SInfoResultType(null, "sinfo.flood_duration.header.mainvalue.1.duration", |
91 "sinfo.export.main_value_1_duration.pdf.header.duration") { | 91 "sinfo.flood_duration.header.pdf.mainvalue.1.duration") { |
92 private static final long serialVersionUID = 1L; | |
93 | |
94 @Override | |
95 public String exportValue(final CallContext context, final Object value) { | |
96 final double doubleValue = asDouble(value); | |
97 return exportDoubleValue(context, doubleValue); | |
98 } | |
99 | |
100 @Override | |
101 protected NumberFormat createFormatter(final CallContext context) { | |
102 return Formatter.getIntegerFormatter(context); | |
103 } | |
104 }; | |
105 | |
106 public static final SInfoResultType mainValue2Duration = new SInfoResultType(null, "sinfo.flood_duration.header.mainvalue.2.duration", | |
107 "sinfo.flood_duration.header.pdf.mainvalue.2.duration") { | |
108 private static final long serialVersionUID = 1L; | |
109 | |
110 @Override | |
111 public String exportValue(final CallContext context, final Object value) { | |
112 final double doubleValue = asDouble(value); | |
113 return exportDoubleValue(context, doubleValue); | |
114 } | |
115 | |
116 @Override | |
117 protected NumberFormat createFormatter(final CallContext context) { | |
118 return Formatter.getIntegerFormatter(context); | |
119 } | |
120 }; | |
121 | |
122 public static final SInfoResultType mainValue3Duration = new SInfoResultType(null, "sinfo.flood_duration.header.mainvalue.3.duration", | |
123 "sinfo.flood_duration.header.pdf.mainvalue.3.duration") { | |
92 private static final long serialVersionUID = 1L; | 124 private static final long serialVersionUID = 1L; |
93 | 125 |
94 @Override | 126 @Override |
95 public String exportValue(final CallContext context, final Object value) { | 127 public String exportValue(final CallContext context, final Object value) { |
96 final double doubleValue = asDouble(value); | 128 final double doubleValue = asDouble(value); |
119 // digits. | 151 // digits. |
120 return Formatter.getFlowDepth(context); | 152 return Formatter.getFlowDepth(context); |
121 } | 153 } |
122 }; | 154 }; |
123 | 155 |
156 public static final SInfoResultType waterlevel1 = new SInfoResultType(null, "sinfo.flood_duration.header.mainvalue.1.w", | |
157 "sinfo.flood_duration.header.pdf.mainvalue.1.w") { | |
158 private static final long serialVersionUID = 1L; | |
159 | |
160 @Override | |
161 public String exportValue(final CallContext context, final Object value) { | |
162 final double doubleValue = asDouble(value); | |
163 return exportDoubleValue(context, doubleValue); | |
164 } | |
165 | |
166 @Override | |
167 protected NumberFormat createFormatter(final CallContext context) { | |
168 return Formatter.getFlowDepth(context); | |
169 } | |
170 }; | |
171 | |
172 public static final SInfoResultType waterlevel2 = new SInfoResultType(null, "sinfo.flood_duration.header.mainvalue.2.w", | |
173 "sinfo.flood_duration.header.pdf.mainvalue.2.w") { | |
174 private static final long serialVersionUID = 1L; | |
175 | |
176 @Override | |
177 public String exportValue(final CallContext context, final Object value) { | |
178 final double doubleValue = asDouble(value); | |
179 return exportDoubleValue(context, doubleValue); | |
180 } | |
181 | |
182 @Override | |
183 protected NumberFormat createFormatter(final CallContext context) { | |
184 return Formatter.getFlowDepth(context); | |
185 } | |
186 }; | |
187 | |
188 public static final SInfoResultType waterlevel3 = new SInfoResultType(null, "sinfo.flood_duration.header.mainvalue.3.w", | |
189 "sinfo.flood_duration.header.pdf.mainvalue.3.w") { | |
190 private static final long serialVersionUID = 1L; | |
191 | |
192 @Override | |
193 public String exportValue(final CallContext context, final Object value) { | |
194 final double doubleValue = asDouble(value); | |
195 return exportDoubleValue(context, doubleValue); | |
196 } | |
197 | |
198 @Override | |
199 protected NumberFormat createFormatter(final CallContext context) { | |
200 return Formatter.getFlowDepth(context); | |
201 } | |
202 }; | |
203 | |
124 public static final SInfoResultType waterlevelLabel = new SInfoResultType(I18NStrings.UNIT_NONE, SInfoI18NStrings.CSV_LABEL_HEADER) { | 204 public static final SInfoResultType waterlevelLabel = new SInfoResultType(I18NStrings.UNIT_NONE, SInfoI18NStrings.CSV_LABEL_HEADER) { |
125 private static final long serialVersionUID = 1L; | 205 private static final long serialVersionUID = 1L; |
126 | 206 |
127 @Override | 207 @Override |
128 public String exportValue(final CallContext context, final Object value) { | 208 public String exportValue(final CallContext context, final Object value) { |
164 protected NumberFormat createFormatter(final CallContext context) { | 244 protected NumberFormat createFormatter(final CallContext context) { |
165 return Formatter.getWaterlevelQ(context); | 245 return Formatter.getWaterlevelQ(context); |
166 } | 246 } |
167 }; | 247 }; |
168 | 248 |
249 public static final SInfoResultType discharge1 = new SInfoResultType(I18NStrings.UNIT_CUBIC_M, "sinfo.flood_duration.header.mainvalue.1.q", | |
250 "sinfo.flood_duration.header.pdf.mainvalue.1.q") { | |
251 private static final long serialVersionUID = 1L; | |
252 | |
253 @Override | |
254 public String exportValue(final CallContext context, final Object value) { | |
255 final double doubleValue = asDouble(value); | |
256 final double roundedDischarge = RiverUtils.roundQ(doubleValue); | |
257 return exportDoubleValue(context, roundedDischarge); | |
258 } | |
259 | |
260 @Override | |
261 protected NumberFormat createFormatter(final CallContext context) { | |
262 return Formatter.getWaterlevelQ(context); | |
263 } | |
264 }; | |
265 | |
266 public static final SInfoResultType discharge2 = new SInfoResultType(I18NStrings.UNIT_CUBIC_M, "sinfo.flood_duration.header.mainvalue.2.q", | |
267 "sinfo.flood_duration.header.pdf.mainvalue.2.q") { | |
268 private static final long serialVersionUID = 1L; | |
269 | |
270 @Override | |
271 public String exportValue(final CallContext context, final Object value) { | |
272 final double doubleValue = asDouble(value); | |
273 final double roundedDischarge = RiverUtils.roundQ(doubleValue); | |
274 return exportDoubleValue(context, roundedDischarge); | |
275 } | |
276 | |
277 @Override | |
278 protected NumberFormat createFormatter(final CallContext context) { | |
279 return Formatter.getWaterlevelQ(context); | |
280 } | |
281 }; | |
282 | |
283 public static final SInfoResultType discharge3 = new SInfoResultType(I18NStrings.UNIT_CUBIC_M, "sinfo.flood_duration.header.mainvalue.3.q", | |
284 "sinfo.flood_duration.header.pdf.mainvalue.3.q") { | |
285 private static final long serialVersionUID = 1L; | |
286 | |
287 @Override | |
288 public String exportValue(final CallContext context, final Object value) { | |
289 final double doubleValue = asDouble(value); | |
290 final double roundedDischarge = RiverUtils.roundQ(doubleValue); | |
291 return exportDoubleValue(context, roundedDischarge); | |
292 } | |
293 | |
294 @Override | |
295 protected NumberFormat createFormatter(final CallContext context) { | |
296 return Formatter.getWaterlevelQ(context); | |
297 } | |
298 }; | |
299 | |
169 public static final SInfoResultType meanBedHeight = new SInfoResultType(null, SInfoI18NStrings.CSV_MEAN_BED_HEIGHT_HEADER, | 300 public static final SInfoResultType meanBedHeight = new SInfoResultType(null, SInfoI18NStrings.CSV_MEAN_BED_HEIGHT_HEADER, |
170 SInfoI18NStrings.CSV_MEAN_BED_HEIGHT_HEADER_SHORT) { | 301 SInfoI18NStrings.CSV_MEAN_BED_HEIGHT_HEADER_SHORT) { |
171 private static final long serialVersionUID = 1L; | 302 private static final long serialVersionUID = 1L; |
172 | 303 |
173 @Override | 304 @Override |
543 protected NumberFormat createFormatter(final CallContext context) { | 674 protected NumberFormat createFormatter(final CallContext context) { |
544 return Formatter.getFlowDepth(context); | 675 return Formatter.getFlowDepth(context); |
545 } | 676 } |
546 }; | 677 }; |
547 | 678 |
548 public static final SInfoResultType infrastructureHeightFloodDur = new SInfoResultType(I18NStrings.UNIT_M, | 679 public static final SInfoResultType infrastructureHeight = new SInfoResultType(I18NStrings.UNIT_M, SInfoI18NStrings.CSV_INFRASTRUCTURE_HEIGHT_HEADER, |
549 "sinfo.export.flood_duration.csv.header.infrastructure.height", "sinfo.export.flood_duration.pdf.header.infrastructure.height") { | 680 SInfoI18NStrings.PDF_INFRASTRUCTURE_HEIGHT_HEADER) { |
550 private static final long serialVersionUID = 1L; | 681 private static final long serialVersionUID = 1L; |
551 | 682 |
552 @Override | 683 @Override |
553 public String exportValue(final CallContext context, final Object value) { | 684 public String exportValue(final CallContext context, final Object value) { |
554 final double doubleValue = asDouble(value); | 685 final double doubleValue = asDouble(value); |
559 protected NumberFormat createFormatter(final CallContext context) { | 690 protected NumberFormat createFormatter(final CallContext context) { |
560 return Formatter.getInfrastructureHeight(context); | 691 return Formatter.getInfrastructureHeight(context); |
561 } | 692 } |
562 }; | 693 }; |
563 | 694 |
564 public static final SInfoResultType infrastructureHeight = new SInfoResultType(I18NStrings.UNIT_M, SInfoI18NStrings.CSV_INFRASTRUCTURE_HEIGHT_HEADER) { | |
565 private static final long serialVersionUID = 1L; | |
566 | |
567 @Override | |
568 public String exportValue(final CallContext context, final Object value) { | |
569 final double doubleValue = asDouble(value); | |
570 return exportDoubleValue(context, doubleValue); | |
571 } | |
572 | |
573 @Override | |
574 protected NumberFormat createFormatter(final CallContext context) { | |
575 return Formatter.getInfrastructureHeight(context); | |
576 } | |
577 }; | |
578 | |
579 public static final SInfoResultType collisionCount = new SInfoResultType(I18NStrings.UNIT_NONE, SInfoI18NStrings.CSV_COLLISION_COUNT_HEADER) { | 695 public static final SInfoResultType collisionCount = new SInfoResultType(I18NStrings.UNIT_NONE, SInfoI18NStrings.CSV_COLLISION_COUNT_HEADER) { |
580 private static final long serialVersionUID = 1L; | 696 private static final long serialVersionUID = 1L; |
581 | 697 |
582 @Override | 698 @Override |
583 public String exportValue(final CallContext context, final Object value) { | 699 public String exportValue(final CallContext context, final Object value) { |