9252
|
1 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde |
|
2 * Software engineering by |
|
3 * Björnsen Beratende Ingenieure GmbH |
|
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt |
|
5 * |
|
6 * This file is Free Software under the GNU AGPL (>=v3) |
|
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
|
8 * documentation coming with Dive4Elements River for details. |
|
9 */ |
|
10 |
|
11 package org.dive4elements.river.artifacts.sinfo.flood_duration; |
|
12 |
|
13 import java.util.HashSet; |
|
14 import java.util.Set; |
|
15 |
|
16 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; |
|
17 import org.dive4elements.artifactdatabase.state.Facet; |
|
18 import org.dive4elements.artifacts.CallContext; |
|
19 import org.dive4elements.river.artifacts.common.AbstractCalculationResult; |
|
20 import org.dive4elements.river.exports.DiagramGenerator; |
|
21 import org.dive4elements.river.exports.DurationCurveGenerator; |
|
22 import org.dive4elements.river.exports.XYChartGenerator; |
|
23 import org.dive4elements.river.exports.process.DefaultProcessor; |
|
24 import org.dive4elements.river.themes.ThemeDocument; |
|
25 |
|
26 /** |
|
27 * Processor to generate the facet and data series of a flood duration curve |
|
28 * |
|
29 * @author Matthias Schäfer |
|
30 * |
|
31 */ |
|
32 public final class FloodDurationCurveProcessor extends DefaultProcessor { |
|
33 |
|
34 private static final String FACET_FLOOD_DURATION_W = "duration_curve.w"; |
|
35 |
|
36 private static final String FACET_FLOOD_DURATION_Q = "duration_curve.q"; |
|
37 |
|
38 private static final Set<String> HANDLED_FACET_TYPES = new HashSet<>(); |
|
39 |
|
40 static { |
|
41 HANDLED_FACET_TYPES.add(FACET_FLOOD_DURATION_W); |
|
42 HANDLED_FACET_TYPES.add(FACET_FLOOD_DURATION_Q); |
|
43 } |
|
44 |
|
45 public static Facet createFloodDurationWCurveFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, |
|
46 final int facetIndex, final int resultIndex, final String description) { |
|
47 |
|
48 return new FloodDurationCurveFacet(FACET_FLOOD_DURATION_W, description); |
|
49 } |
|
50 |
|
51 public static Facet createFloodDurationQCurveFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, |
|
52 final int facetIndex, final int resultIndex, final String description) { |
|
53 |
|
54 return new FloodDurationCurveFacet(FACET_FLOOD_DURATION_Q, description); |
|
55 } |
|
56 |
|
57 /** |
|
58 * Processes data to generate a chart. |
|
59 */ |
|
60 @Override |
|
61 public void doOut(final XYChartGenerator generator, final ArtifactAndFacet bundle, final ThemeDocument theme, final boolean visible, final int index) { |
|
62 |
|
63 } |
|
64 |
|
65 @Override |
|
66 public final String getAxisLabel(final DiagramGenerator generator) { |
|
67 return generator.msg(DurationCurveGenerator.I18N_YAXIS_LABEL_W); |
|
68 } |
|
69 |
|
70 @Override |
|
71 public final boolean canHandle(final String facettype) { |
|
72 return HANDLED_FACET_TYPES.contains(facettype); |
|
73 } |
|
74 } |