Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationInfrastructureFacet.java @ 9612:f8308db94634
#20 UI, Diagramme
author | dnt_bjoernsen <d.tironi@bjoernsen.de> |
---|---|
date | Wed, 09 Oct 2019 16:17:16 +0200 |
parents | f318359b81a2 |
children |
rev | line source |
---|---|
9259
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
1 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
2 * Software engineering by |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
3 * Björnsen Beratende Ingenieure GmbH |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
5 * |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
6 * This file is Free Software under the GNU AGPL (>=v3) |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
8 * documentation coming with Dive4Elements River for details. |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
9 */ |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
10 |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
11 package org.dive4elements.river.artifacts.sinfo.flood_duration; |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
12 |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
13 import java.util.List; |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
14 |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
15 import org.apache.log4j.Logger; |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
16 import org.dive4elements.artifactdatabase.state.DefaultFacet; |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
17 import org.dive4elements.artifacts.Artifact; |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
18 import org.dive4elements.artifacts.CallContext; |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
19 import org.dive4elements.river.artifacts.D4EArtifact; |
9612 | 20 import org.dive4elements.river.artifacts.model.Calculation; |
9259
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
21 import org.dive4elements.river.artifacts.model.CalculationResult; |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
22 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; |
9269
83ebeb620b5a
Station specific main value annotations in S-Info flood duration curve, corrected infrastructure flood duration calculation
mschaefer
parents:
9266
diff
changeset
|
23 import org.dive4elements.river.exports.fixings.FixChartGenerator; |
9259
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
24 import org.dive4elements.river.jfree.RiverAnnotation; |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
25 import org.dive4elements.river.jfree.StickyAxisAnnotation; |
9376
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9269
diff
changeset
|
26 import org.dive4elements.river.model.Attribute.AttributeKey; |
9259
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
27 |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
28 /** |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
29 * Facet to show W and Q annotation lines of an infrastructure height. |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
30 */ |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
31 public class FloodDurationInfrastructureFacet extends DefaultFacet { |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
32 |
9612 | 33 private static final long serialVersionUID = 1L; |
34 | |
9259
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
35 /** Own log. */ |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
36 private static Logger log = Logger.getLogger(FloodDurationInfrastructureFacet.class); |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
37 |
9376
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9269
diff
changeset
|
38 private final boolean isW; |
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9269
diff
changeset
|
39 |
9612 | 40 private final int m_resultIndex; |
41 | |
42 private final AttributeKey m_riverside; | |
43 | |
44 public FloodDurationInfrastructureFacet(final String name, final boolean isW, final int resultIndex, final AttributeKey attributeKey, final int facetIndex, | |
45 final String description) { | |
9259
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
46 this.description = description; |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
47 this.name = name; |
9612 | 48 this.index = facetIndex; |
49 this.m_riverside = attributeKey; | |
9376
f318359b81a2
S-Info flood duration theme rename, and more infrastructure themes in the duration curve
mschaefer
parents:
9269
diff
changeset
|
50 this.isW = isW; |
9612 | 51 this.m_resultIndex = resultIndex; |
9259
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
52 } |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
53 |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
54 /** |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
55 * Returns the data this facet requires. |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
56 */ |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
57 @Override |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
58 public Object getData(final Artifact artifact, final CallContext context) { |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
59 |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
60 log.debug("Get data for flood duration curve infrastructure"); |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
61 |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
62 final D4EArtifact flys = (D4EArtifact) artifact; |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
63 |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
64 final CalculationResult res = (CalculationResult) flys.compute(context, ComputeType.ADVANCE, false); |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
65 |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
66 final FloodDurationCalculationResults data = (FloodDurationCalculationResults) res.getData(); |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
67 |
9612 | 68 final FloodDurationCalculationResult result = data.getResults().get(this.m_resultIndex); |
69 | |
9269
83ebeb620b5a
Station specific main value annotations in S-Info flood duration curve, corrected infrastructure flood duration calculation
mschaefer
parents:
9266
diff
changeset
|
70 final double currentKm = FixChartGenerator.getCurrentKm(context); |
9266
465347d12990
Station specific calculation of flood duration curve and infrastructure annotations
mschaefer
parents:
9259
diff
changeset
|
71 |
9612 | 72 final Calculation problems = new Calculation(); |
73 | |
74 final FacetCalculator calculator = new FacetCalculator(context); | |
75 final List<StickyAxisAnnotation> annotations = calculator.calcInfrastructureAnnotations(problems, currentKm, this.isW, result, this.m_riverside); | |
9259
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
76 |
9269
83ebeb620b5a
Station specific main value annotations in S-Info flood duration curve, corrected infrastructure flood duration calculation
mschaefer
parents:
9266
diff
changeset
|
77 return new RiverAnnotation(this.description, annotations); |
9266
465347d12990
Station specific calculation of flood duration curve and infrastructure annotations
mschaefer
parents:
9259
diff
changeset
|
78 } |
465347d12990
Station specific calculation of flood duration curve and infrastructure annotations
mschaefer
parents:
9259
diff
changeset
|
79 |
9259
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
80 /** |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
81 * Create a deep copy of this Facet. |
9612 | 82 * |
9259
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
83 * @return a deep copy. |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
84 */ |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
85 @Override |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
86 public FloodDurationInfrastructureFacet deepCopy() { |
9612 | 87 final FloodDurationInfrastructureFacet copy = new FloodDurationInfrastructureFacet(this.name, this.isW, this.m_resultIndex, this.m_riverside, |
88 this.index, this.description); | |
9259
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
89 copy.set(this); |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
90 return copy; |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
91 } |
66b003701546
Added infrastructure height and Q annotation to S-Info flood duration curve chart
mschaefer
parents:
diff
changeset
|
92 } |