Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculator.java @ 9312:740d65e4aa14
Q [m³/s] one message
author | gernotbelger |
---|---|
date | Thu, 26 Jul 2018 15:54:20 +0200 |
parents | 9055afc19ec6 |
children | 7b2b086e45f0 |
comparison
equal
deleted
inserted
replaced
9311:7c7f73e5e01e | 9312:740d65e4aa14 |
---|---|
259 * Calculates the Q annotation lines of an infrastructure | 259 * Calculates the Q annotation lines of an infrastructure |
260 */ | 260 */ |
261 private StickyAxisAnnotation calcInfrastructureQAnnotation(final ResultRow row) { | 261 private StickyAxisAnnotation calcInfrastructureQAnnotation(final ResultRow row) { |
262 final String label = Resources.getMsg(this.context.getMeta(), "sinfo.chart.flood_duration.curve.infrastructure", | 262 final String label = Resources.getMsg(this.context.getMeta(), "sinfo.chart.flood_duration.curve.infrastructure", |
263 "sinfo.chart.flood_duration.curve.infrastructure", | 263 "sinfo.chart.flood_duration.curve.infrastructure", |
264 SInfoResultType.infrastructuretype.exportValue(this.context, row.getValue(SInfoResultType.infrastructuretype)) | 264 SInfoResultType.infrastructuretype.exportValue(this.context, row.getValue(SInfoResultType.infrastructuretype)) + ", " |
265 + ", " + SInfoResultType.riverside.exportValue(this.context, row.getValue(SInfoResultType.riverside))); | 265 + SInfoResultType.riverside.exportValue(this.context, row.getValue(SInfoResultType.riverside))); |
266 final StickyAxisAnnotation annotation = new StickyAxisAnnotation(label, (float) row.getDoubleValue(SInfoResultType.floodDischarge), | 266 final StickyAxisAnnotation annotation = new StickyAxisAnnotation(label, (float) row.getDoubleValue(SInfoResultType.floodDischarge), SimpleAxis.Y_AXIS, |
267 SimpleAxis.Y_AXIS, FloodDurationCurveGenerator.YAXIS.Q.idx); | 267 FloodDurationCurveGenerator.YAXIS.Q.idx); |
268 annotation.setHitPoint((float) row.getDoubleValue(SInfoResultType.floodDuration)); | 268 annotation.setHitPoint((float) row.getDoubleValue(SInfoResultType.floodDuration)); |
269 return annotation; | 269 return annotation; |
270 } | 270 } |
271 | 271 |
272 /** | 272 /** |
273 * Calculates the W annotation lines of an infrastructure | 273 * Calculates the W annotation lines of an infrastructure |
274 */ | 274 */ |
275 private StickyAxisAnnotation calcInfrastructureWAnnotation(final ResultRow row) { | 275 private StickyAxisAnnotation calcInfrastructureWAnnotation(final ResultRow row) { |
276 final String label = Resources.getMsg(this.context.getMeta(), "sinfo.chart.flood_duration.curve.infrastructure", | 276 final String label = Resources.getMsg(this.context.getMeta(), "sinfo.chart.flood_duration.curve.infrastructure", |
277 "sinfo.chart.flood_duration.curve.infrastructure", | 277 "sinfo.chart.flood_duration.curve.infrastructure", |
278 SInfoResultType.infrastructuretype.exportValue(this.context, row.getValue(SInfoResultType.infrastructuretype)) | 278 SInfoResultType.infrastructuretype.exportValue(this.context, row.getValue(SInfoResultType.infrastructuretype)) + ", " |
279 + ", " + SInfoResultType.riverside.exportValue(this.context, row.getValue(SInfoResultType.riverside))); | 279 + SInfoResultType.riverside.exportValue(this.context, row.getValue(SInfoResultType.riverside))); |
280 final StickyAxisAnnotation annotation = new StickyAxisAnnotation(label, (float) row.getDoubleValue(SInfoResultType.infrastructureHeight), | 280 final StickyAxisAnnotation annotation = new StickyAxisAnnotation(label, (float) row.getDoubleValue(SInfoResultType.infrastructureHeight), |
281 SimpleAxis.Y_AXIS, FloodDurationCurveGenerator.YAXIS.W.idx); | 281 SimpleAxis.Y_AXIS, FloodDurationCurveGenerator.YAXIS.W.idx); |
282 annotation.setHitPoint((float) row.getDoubleValue(SInfoResultType.floodDuration)); | 282 annotation.setHitPoint((float) row.getDoubleValue(SInfoResultType.floodDuration)); |
283 return annotation; | 283 return annotation; |
284 } | 284 } |
376 if (!description.isEmpty() && Character.isDigit(description.charAt(0))) { | 376 if (!description.isEmpty() && Character.isDigit(description.charAt(0))) { |
377 if (winfo.isQ()) | 377 if (winfo.isQ()) |
378 return "Q=" + description; | 378 return "Q=" + description; |
379 else | 379 else |
380 return "W=" + description; | 380 return "W=" + description; |
381 } | 381 } else |
382 else | |
383 return description; | 382 return description; |
384 } | 383 } |
385 | 384 |
386 /** | 385 /** |
387 * Calculates the flood durations of the Qs of the waterlevels/discharge states for a map of gauges | 386 * Calculates the flood durations of the Qs of the waterlevels/discharge states for a map of gauges |
406 } | 405 } |
407 | 406 |
408 /** | 407 /** |
409 * Create a result row for a station and its gauge, and add w-q-values as selected | 408 * Create a result row for a station and its gauge, and add w-q-values as selected |
410 */ | 409 */ |
411 private ResultRow createRow(final Double station, final Gauge gauge, final Gauge firstGauge, final WQKms[] wqkmsArray, | 410 private ResultRow createRow(final Double station, final Gauge gauge, final Gauge firstGauge, final WQKms[] wqkmsArray, final List<Double> gaugeDurations, |
412 final List<Double> gaugeDurations, final int kmIndex) { | 411 final int kmIndex) { |
413 | 412 |
414 final ResultRow row = ResultRow.create(); | 413 final ResultRow row = ResultRow.create(); |
415 row.putValue(GeneralResultType.station, station); | 414 row.putValue(GeneralResultType.station, station); |
416 row.putValue(SInfoResultType.infrastructuretype, null); // is replaced later for an infrastructure | 415 row.putValue(SInfoResultType.infrastructuretype, null); // is replaced later for an infrastructure |
417 row.putValue(SInfoResultType.floodDuration, Double.NaN); // is replaced later for an infrastructure | 416 row.putValue(SInfoResultType.floodDuration, Double.NaN); // is replaced later for an infrastructure |
418 | 417 |
419 final String gaugeLabel = this.riverInfoProvider.findGauge(station, (gauge == firstGauge)); | 418 final String gaugeLabel = this.riverInfoProvider.findGauge(station, (gauge == firstGauge)); |
420 row.putValue(SInfoResultType.gaugeLabel, gaugeLabel); | 419 row.putValue(SInfoResultType.gaugeLabel, gaugeLabel); |
421 | 420 |
422 final String location = this.riverInfoProvider.getLocation(station); | 421 final String location = this.riverInfoProvider.getLocation(station); |
423 row.putValue(SInfoResultType.location, location); | 422 row.putValue(GeneralResultType.location, location); |
424 | 423 |
425 final List<DurationWaterlevel> wsts = new ArrayList<>(wqkmsArray.length); | 424 final List<DurationWaterlevel> wsts = new ArrayList<>(wqkmsArray.length); |
426 | 425 |
427 for (int i = 0; i <= wqkmsArray.length - 1; i++) { | 426 for (int i = 0; i <= wqkmsArray.length - 1; i++) { |
428 assert (wqkmsArray[i].getKm(kmIndex) == station.doubleValue()); | 427 assert (wqkmsArray[i].getKm(kmIndex) == station.doubleValue()); |