Mercurial > dive4elements > river
comparison 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 |
comparison
equal
deleted
inserted
replaced
9611:8ed6c45136fa | 9612:f8308db94634 |
---|---|
15 import org.apache.log4j.Logger; | 15 import org.apache.log4j.Logger; |
16 import org.dive4elements.artifactdatabase.state.DefaultFacet; | 16 import org.dive4elements.artifactdatabase.state.DefaultFacet; |
17 import org.dive4elements.artifacts.Artifact; | 17 import org.dive4elements.artifacts.Artifact; |
18 import org.dive4elements.artifacts.CallContext; | 18 import org.dive4elements.artifacts.CallContext; |
19 import org.dive4elements.river.artifacts.D4EArtifact; | 19 import org.dive4elements.river.artifacts.D4EArtifact; |
20 import org.dive4elements.river.artifacts.model.Calculation; | |
20 import org.dive4elements.river.artifacts.model.CalculationResult; | 21 import org.dive4elements.river.artifacts.model.CalculationResult; |
21 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; | 22 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; |
22 import org.dive4elements.river.exports.fixings.FixChartGenerator; | 23 import org.dive4elements.river.exports.fixings.FixChartGenerator; |
23 import org.dive4elements.river.jfree.RiverAnnotation; | 24 import org.dive4elements.river.jfree.RiverAnnotation; |
24 import org.dive4elements.river.jfree.StickyAxisAnnotation; | 25 import org.dive4elements.river.jfree.StickyAxisAnnotation; |
25 import org.dive4elements.river.model.Attribute.AttributeKey; | 26 import org.dive4elements.river.model.Attribute.AttributeKey; |
26 | 27 |
27 | |
28 /** | 28 /** |
29 * Facet to show W and Q annotation lines of an infrastructure height. | 29 * Facet to show W and Q annotation lines of an infrastructure height. |
30 */ | 30 */ |
31 public class FloodDurationInfrastructureFacet extends DefaultFacet { | 31 public class FloodDurationInfrastructureFacet extends DefaultFacet { |
32 | 32 |
33 private static final long serialVersionUID = 1L; | |
34 | |
33 /** Own log. */ | 35 /** Own log. */ |
34 private static Logger log = Logger.getLogger(FloodDurationInfrastructureFacet.class); | 36 private static Logger log = Logger.getLogger(FloodDurationInfrastructureFacet.class); |
35 | 37 |
36 private final AttributeKey riverBankKey; | |
37 | |
38 private final boolean isW; | 38 private final boolean isW; |
39 | 39 |
40 public FloodDurationInfrastructureFacet(final String name, final String description, final AttributeKey riverside, final boolean isW) { | 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) { | |
41 this.description = description; | 46 this.description = description; |
42 this.name = name; | 47 this.name = name; |
43 this.index = 0; | 48 this.index = facetIndex; |
44 this.riverBankKey = riverside; | 49 this.m_riverside = attributeKey; |
45 this.isW = isW; | 50 this.isW = isW; |
51 this.m_resultIndex = resultIndex; | |
46 } | 52 } |
47 | |
48 | 53 |
49 /** | 54 /** |
50 * Returns the data this facet requires. | 55 * Returns the data this facet requires. |
51 */ | 56 */ |
52 @Override | 57 @Override |
58 | 63 |
59 final CalculationResult res = (CalculationResult) flys.compute(context, ComputeType.ADVANCE, false); | 64 final CalculationResult res = (CalculationResult) flys.compute(context, ComputeType.ADVANCE, false); |
60 | 65 |
61 final FloodDurationCalculationResults data = (FloodDurationCalculationResults) res.getData(); | 66 final FloodDurationCalculationResults data = (FloodDurationCalculationResults) res.getData(); |
62 | 67 |
68 final FloodDurationCalculationResult result = data.getResults().get(this.m_resultIndex); | |
69 | |
63 final double currentKm = FixChartGenerator.getCurrentKm(context); | 70 final double currentKm = FixChartGenerator.getCurrentKm(context); |
64 | 71 |
65 final List<StickyAxisAnnotation> annotations = new FloodDurationCalculation(context).calcInfrastructureAnnotations(currentKm, | 72 final Calculation problems = new Calculation(); |
66 this.riverBankKey, this.isW, data.getResults().get(this.index)); | 73 |
74 final FacetCalculator calculator = new FacetCalculator(context); | |
75 final List<StickyAxisAnnotation> annotations = calculator.calcInfrastructureAnnotations(problems, currentKm, this.isW, result, this.m_riverside); | |
67 | 76 |
68 return new RiverAnnotation(this.description, annotations); | 77 return new RiverAnnotation(this.description, annotations); |
69 } | 78 } |
70 | 79 |
71 | |
72 /** | 80 /** |
73 * Create a deep copy of this Facet. | 81 * Create a deep copy of this Facet. |
82 * | |
74 * @return a deep copy. | 83 * @return a deep copy. |
75 */ | 84 */ |
76 @Override | 85 @Override |
77 public FloodDurationInfrastructureFacet deepCopy() { | 86 public FloodDurationInfrastructureFacet deepCopy() { |
78 final FloodDurationInfrastructureFacet copy = new FloodDurationInfrastructureFacet(this.name, this.description, this.riverBankKey, this.isW); | 87 final FloodDurationInfrastructureFacet copy = new FloodDurationInfrastructureFacet(this.name, this.isW, this.m_resultIndex, this.m_riverside, |
88 this.index, this.description); | |
79 copy.set(this); | 89 copy.set(this); |
80 return copy; | 90 return copy; |
81 } | 91 } |
82 } | 92 } |
83 |