Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCurveProcessor.java @ 9376:f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
author | mschaefer |
---|---|
date | Fri, 03 Aug 2018 17:02:38 +0200 |
parents | 66b003701546 |
children | f8308db94634 |
rev | line source |
---|---|
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.Facet; | |
17 import org.dive4elements.artifacts.CallContext; | |
18 import org.dive4elements.river.artifacts.common.AbstractCalculationResult; | |
9259
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
9257
diff
changeset
|
19 import org.dive4elements.river.artifacts.model.FacetTypes; |
9252 | 20 import org.dive4elements.river.exports.DiagramGenerator; |
21 import org.dive4elements.river.exports.DurationCurveGenerator; | |
22 import org.dive4elements.river.exports.process.DefaultProcessor; | |
9376
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9259
diff
changeset
|
23 import org.dive4elements.river.model.Attribute.AttributeKey; |
9252 | 24 |
25 /** | |
26 * Processor to generate the facet and data series of a flood duration curve | |
27 * | |
28 * @author Matthias Schäfer | |
29 * | |
30 */ | |
31 public final class FloodDurationCurveProcessor extends DefaultProcessor { | |
32 | |
9259
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
9257
diff
changeset
|
33 private static final String FACET_FLOOD_DURATION_W = FacetTypes.DURATION_W; // "duration_curve.w"; |
9252 | 34 |
9259
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
9257
diff
changeset
|
35 private static final String FACET_FLOOD_DURATION_Q = FacetTypes.DURATION_Q; // "duration_curve.q"; |
9252 | 36 |
9259
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
9257
diff
changeset
|
37 public static final String FACET_FLOOD_DURATION_MAINVALUES_W = "sinfo.mainvalues.w"; |
9257
ef7b65576d4b
Added W and Q main values to S-Info flood duration curve chart
mschaefer
parents:
9252
diff
changeset
|
38 |
9259
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
9257
diff
changeset
|
39 public static final String FACET_FLOOD_DURATION_MAINVALUES_Q = "sinfo.mainvalues.q"; |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
9257
diff
changeset
|
40 |
9376
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9259
diff
changeset
|
41 public static final String FACET_FLOOD_DURATION_INFRASTRUCTURE_W_LEFT = "infrastructure.w.left"; |
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9259
diff
changeset
|
42 |
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9259
diff
changeset
|
43 public static final String FACET_FLOOD_DURATION_INFRASTRUCTURE_W_RIGHT = "infrastructure.w.right"; |
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9259
diff
changeset
|
44 |
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9259
diff
changeset
|
45 public static final String FACET_FLOOD_DURATION_INFRASTRUCTURE_Q_LEFT = "infrastructure.q.left"; |
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9259
diff
changeset
|
46 |
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9259
diff
changeset
|
47 public static final String FACET_FLOOD_DURATION_INFRASTRUCTURE_Q_RIGHT = "infrastructure.q.right"; |
9257
ef7b65576d4b
Added W and Q main values to S-Info flood duration curve chart
mschaefer
parents:
9252
diff
changeset
|
48 |
9252 | 49 private static final Set<String> HANDLED_FACET_TYPES = new HashSet<>(); |
50 | |
51 static { | |
52 HANDLED_FACET_TYPES.add(FACET_FLOOD_DURATION_W); | |
53 HANDLED_FACET_TYPES.add(FACET_FLOOD_DURATION_Q); | |
9257
ef7b65576d4b
Added W and Q main values to S-Info flood duration curve chart
mschaefer
parents:
9252
diff
changeset
|
54 HANDLED_FACET_TYPES.add(FACET_FLOOD_DURATION_MAINVALUES_W); |
ef7b65576d4b
Added W and Q main values to S-Info flood duration curve chart
mschaefer
parents:
9252
diff
changeset
|
55 HANDLED_FACET_TYPES.add(FACET_FLOOD_DURATION_MAINVALUES_Q); |
9376
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9259
diff
changeset
|
56 HANDLED_FACET_TYPES.add(FACET_FLOOD_DURATION_INFRASTRUCTURE_W_LEFT); |
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9259
diff
changeset
|
57 HANDLED_FACET_TYPES.add(FACET_FLOOD_DURATION_INFRASTRUCTURE_W_RIGHT); |
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9259
diff
changeset
|
58 HANDLED_FACET_TYPES.add(FACET_FLOOD_DURATION_INFRASTRUCTURE_Q_LEFT); |
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9259
diff
changeset
|
59 HANDLED_FACET_TYPES.add(FACET_FLOOD_DURATION_INFRASTRUCTURE_Q_RIGHT); |
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9259
diff
changeset
|
60 } |
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9259
diff
changeset
|
61 |
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9259
diff
changeset
|
62 public static boolean isInfrastructureFacet(final String name) { |
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9259
diff
changeset
|
63 return name.equals(FACET_FLOOD_DURATION_INFRASTRUCTURE_W_LEFT) || name.equals(FACET_FLOOD_DURATION_INFRASTRUCTURE_W_RIGHT) |
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9259
diff
changeset
|
64 || name.equals(FACET_FLOOD_DURATION_INFRASTRUCTURE_Q_LEFT) || name.equals(FACET_FLOOD_DURATION_INFRASTRUCTURE_Q_RIGHT); |
9252 | 65 } |
66 | |
67 public static Facet createFloodDurationWCurveFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, | |
68 final int facetIndex, final int resultIndex, final String description) { | |
69 | |
70 return new FloodDurationCurveFacet(FACET_FLOOD_DURATION_W, description); | |
71 } | |
72 | |
73 public static Facet createFloodDurationQCurveFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, | |
74 final int facetIndex, final int resultIndex, final String description) { | |
75 | |
76 return new FloodDurationCurveFacet(FACET_FLOOD_DURATION_Q, description); | |
77 } | |
78 | |
9257
ef7b65576d4b
Added W and Q main values to S-Info flood duration curve chart
mschaefer
parents:
9252
diff
changeset
|
79 public static Facet createMainValuesWFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, |
ef7b65576d4b
Added W and Q main values to S-Info flood duration curve chart
mschaefer
parents:
9252
diff
changeset
|
80 final int facetIndex, final int resultIndex, final String description) { |
ef7b65576d4b
Added W and Q main values to S-Info flood duration curve chart
mschaefer
parents:
9252
diff
changeset
|
81 |
ef7b65576d4b
Added W and Q main values to S-Info flood duration curve chart
mschaefer
parents:
9252
diff
changeset
|
82 return new FloodDurationMainValuesWFacet(FACET_FLOOD_DURATION_MAINVALUES_W, description); |
ef7b65576d4b
Added W and Q main values to S-Info flood duration curve chart
mschaefer
parents:
9252
diff
changeset
|
83 } |
ef7b65576d4b
Added W and Q main values to S-Info flood duration curve chart
mschaefer
parents:
9252
diff
changeset
|
84 |
ef7b65576d4b
Added W and Q main values to S-Info flood duration curve chart
mschaefer
parents:
9252
diff
changeset
|
85 public static Facet createMainValuesQFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, |
ef7b65576d4b
Added W and Q main values to S-Info flood duration curve chart
mschaefer
parents:
9252
diff
changeset
|
86 final int facetIndex, final int resultIndex, final String description) { |
ef7b65576d4b
Added W and Q main values to S-Info flood duration curve chart
mschaefer
parents:
9252
diff
changeset
|
87 |
ef7b65576d4b
Added W and Q main values to S-Info flood duration curve chart
mschaefer
parents:
9252
diff
changeset
|
88 return new FloodDurationMainValuesQFacet(FACET_FLOOD_DURATION_MAINVALUES_Q, description); |
ef7b65576d4b
Added W and Q main values to S-Info flood duration curve chart
mschaefer
parents:
9252
diff
changeset
|
89 } |
ef7b65576d4b
Added W and Q main values to S-Info flood duration curve chart
mschaefer
parents:
9252
diff
changeset
|
90 |
9376
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9259
diff
changeset
|
91 public static Facet createInfrastructureFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, |
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9259
diff
changeset
|
92 final int facetIndex, final int resultIndex, final String description, final AttributeKey riverside, final boolean isW) { |
9252 | 93 |
9376
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9259
diff
changeset
|
94 if (riverside == AttributeKey.LEFT) { |
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9259
diff
changeset
|
95 if (isW) |
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9259
diff
changeset
|
96 return new FloodDurationInfrastructureFacet(FACET_FLOOD_DURATION_INFRASTRUCTURE_W_LEFT, description, riverside, isW); |
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9259
diff
changeset
|
97 else |
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9259
diff
changeset
|
98 return new FloodDurationInfrastructureFacet(FACET_FLOOD_DURATION_INFRASTRUCTURE_Q_LEFT, description, riverside, isW); |
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9259
diff
changeset
|
99 } |
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9259
diff
changeset
|
100 else { |
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9259
diff
changeset
|
101 if (isW) |
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9259
diff
changeset
|
102 return new FloodDurationInfrastructureFacet(FACET_FLOOD_DURATION_INFRASTRUCTURE_W_RIGHT, description, riverside, isW); |
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9259
diff
changeset
|
103 else |
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9259
diff
changeset
|
104 return new FloodDurationInfrastructureFacet(FACET_FLOOD_DURATION_INFRASTRUCTURE_Q_RIGHT, description, riverside, isW); |
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9259
diff
changeset
|
105 } |
9252 | 106 } |
107 | |
108 @Override | |
109 public final String getAxisLabel(final DiagramGenerator generator) { | |
110 return generator.msg(DurationCurveGenerator.I18N_YAXIS_LABEL_W); | |
111 } | |
112 | |
113 @Override | |
114 public final boolean canHandle(final String facettype) { | |
115 return HANDLED_FACET_TYPES.contains(facettype); | |
116 } | |
117 } |