Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculation.java @ 9612:f8308db94634
#20 UI, Diagramme
author | dnt_bjoernsen <d.tironi@bjoernsen.de> |
---|---|
date | Wed, 09 Oct 2019 16:17:16 +0200 |
parents | b380a5693514 |
children | d889ffe2fb05 |
comparison
equal
deleted
inserted
replaced
9611:8ed6c45136fa | 9612:f8308db94634 |
---|---|
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the | 7 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
8 * documentation coming with Dive4Elements River for details. | 8 * documentation coming with Dive4Elements River for details. |
9 */ | 9 */ |
10 package org.dive4elements.river.artifacts.sinfo.flood_duration; | 10 package org.dive4elements.river.artifacts.sinfo.flood_duration; |
11 | 11 |
12 import java.util.List; | 12 import java.util.Set; |
13 | 13 |
14 import org.apache.commons.lang.math.DoubleRange; | 14 import org.apache.commons.lang.math.DoubleRange; |
15 import org.dive4elements.artifacts.CallContext; | 15 import org.dive4elements.artifacts.CallContext; |
16 import org.dive4elements.river.artifacts.WINFOArtifact; | 16 import org.dive4elements.river.artifacts.WINFOArtifact; |
17 import org.dive4elements.river.artifacts.model.Calculation; | 17 import org.dive4elements.river.artifacts.model.Calculation; |
18 import org.dive4elements.river.artifacts.model.CalculationResult; | 18 import org.dive4elements.river.artifacts.model.CalculationResult; |
19 import org.dive4elements.river.artifacts.model.WQDay; | 19 import org.dive4elements.river.artifacts.model.WQDay; |
20 import org.dive4elements.river.artifacts.model.river.RiverInfoProvider; | 20 import org.dive4elements.river.artifacts.model.river.RiverInfoProvider; |
21 import org.dive4elements.river.artifacts.resources.Resources; | 21 import org.dive4elements.river.artifacts.resources.Resources; |
22 import org.dive4elements.river.artifacts.sinfo.SINFOArtifact; | 22 import org.dive4elements.river.artifacts.sinfo.SINFOArtifact; |
23 import org.dive4elements.river.artifacts.sinfo.flood_duration.FloodDurationCalculationResult.Infrastructure; | |
23 import org.dive4elements.river.artifacts.sinfo.tkhstate.WinfoArtifactWrapper; | 24 import org.dive4elements.river.artifacts.sinfo.tkhstate.WinfoArtifactWrapper; |
24 import org.dive4elements.river.artifacts.sinfo.util.CalculationUtils; | 25 import org.dive4elements.river.artifacts.sinfo.util.CalculationUtils; |
25 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; | 26 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; |
26 import org.dive4elements.river.jfree.StickyAxisAnnotation; | |
27 import org.dive4elements.river.model.Attribute.AttributeKey; | |
28 import org.dive4elements.river.model.River; | 27 import org.dive4elements.river.model.River; |
29 | 28 |
30 /** | 29 /** |
31 * Calculation of the flood durations of the infrastructures of the km range of a river | 30 * Calculation of the flood durations of the infrastructures of the km range of a river |
32 * | 31 * |
70 } | 69 } |
71 | 70 |
72 /** | 71 /** |
73 * Calculates the flood durations of the infrastructures of a km range of a river | 72 * Calculates the flood durations of the infrastructures of a km range of a river |
74 */ | 73 */ |
75 private void calculateResult(final String label, final DoubleRange calcRange, final RiverInfoProvider riverInfoProvider, | 74 private void calculateResult(final String label, final DoubleRange calcRange, final RiverInfoProvider riverInfoProvider, final FloodDurationAccess access, |
76 final FloodDurationAccess access, final Calculation problems, final WINFOArtifact winfo, final FloodDurationCalculationResults results) { | 75 final Calculation problems, final WINFOArtifact winfo, final FloodDurationCalculationResults results) { |
77 | 76 |
78 final FloodDurationCalculator calculator = new FloodDurationCalculator(this.context, riverInfoProvider); | 77 final FloodDurationCalculator calculator = new FloodDurationCalculator(this.context, riverInfoProvider); |
79 calculator.execute(problems, label, calcRange, access.getRiverside(), access.getIsWspl(), winfo, results); | 78 |
79 // FIXME: fetch from acces; maybe we need database for that... whatever | |
80 final Set<Infrastructure> infrastructureKeys = null; | |
81 | |
82 calculator.execute(problems, label, calcRange, access.getRiverside(), infrastructureKeys, access.getIsWspl(), winfo, results); | |
80 } | 83 } |
81 | 84 |
82 /** | 85 /** |
83 * Calculates the flood duration curve of a station | 86 * Calculates the flood duration curve of a station |
84 */ | 87 */ |
98 | 101 |
99 final FloodDurationCalculator calculator = new FloodDurationCalculator(this.context, infoProvider); | 102 final FloodDurationCalculator calculator = new FloodDurationCalculator(this.context, infoProvider); |
100 if (!Double.isNaN(station)) { | 103 if (!Double.isNaN(station)) { |
101 winfo.addStringData("ld_locations", Double.toString(station)); | 104 winfo.addStringData("ld_locations", Double.toString(station)); |
102 return calculator.calcWQDays(problems, station, winfo); | 105 return calculator.calcWQDays(problems, station, winfo); |
103 } | 106 } else { |
104 else { | |
105 winfo.addStringData("ld_locations", Double.toString(calcRange.getMinimumDouble())); | 107 winfo.addStringData("ld_locations", Double.toString(calcRange.getMinimumDouble())); |
106 return calculator.calcWQDays(problems, calcRange.getMinimumDouble(), winfo); | 108 return calculator.calcWQDays(problems, calcRange.getMinimumDouble(), winfo); |
107 } | 109 } |
108 } | 110 } |
109 | |
110 /** | |
111 * Calculates the annotations of the infrastructure(s) of a station for a flood duration calculation | |
112 */ | |
113 public List<StickyAxisAnnotation> calcInfrastructureAnnotations(final double station, final AttributeKey riverside, final boolean isW, | |
114 final FloodDurationCalculationResult result) { | |
115 | |
116 final Calculation problems = new Calculation(); | |
117 | |
118 final FloodDurationCalculator calculator = new FloodDurationCalculator(this.context, null); | |
119 return calculator.calcInfrastructureAnnotations(problems, station, riverside, isW, result); | |
120 } | |
121 | |
122 /** | |
123 * Calculates the annotations of the W main values of a station | |
124 */ | |
125 public List<StickyAxisAnnotation> calcMainValueWAnnotations(final double station, final FloodDurationCalculationResult result) { | |
126 | |
127 final Calculation problems = new Calculation(); | |
128 | |
129 final FloodDurationCalculator calculator = new FloodDurationCalculator(this.context, null); | |
130 return calculator.calcMainValueWAnnotations(problems, station, result); | |
131 } | |
132 | |
133 /** | |
134 * Calculates the annotations of the Q main values of a station | |
135 */ | |
136 public List<StickyAxisAnnotation> calcMainValueQAnnotations(final double station, final FloodDurationCalculationResult result) { | |
137 | |
138 final Calculation problems = new Calculation(); | |
139 | |
140 final FloodDurationCalculator calculator = new FloodDurationCalculator(this.context, null); | |
141 return calculator.calcMainValueQAnnotations(problems, station, result); | |
142 } | |
143 } | 111 } |