comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculator.java @ 9625:07f02019065e

Nachtrag Pos. 20: infrastructure query added, calculation updated for extended access class
author mschaefer
date Mon, 14 Oct 2019 08:14:58 +0200
parents 26e113e8224f
children 6ecd1a28017f
comparison
equal deleted inserted replaced
9624:02ca823ec9c6 9625:07f02019065e
31 import org.dive4elements.river.artifacts.model.WstValueTable.QPosition; 31 import org.dive4elements.river.artifacts.model.WstValueTable.QPosition;
32 import org.dive4elements.river.artifacts.model.WstValueTableFactory; 32 import org.dive4elements.river.artifacts.model.WstValueTableFactory;
33 import org.dive4elements.river.artifacts.model.river.RiverInfoProvider; 33 import org.dive4elements.river.artifacts.model.river.RiverInfoProvider;
34 import org.dive4elements.river.artifacts.sinfo.common.GaugeDurationValuesFinder; 34 import org.dive4elements.river.artifacts.sinfo.common.GaugeDurationValuesFinder;
35 import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType; 35 import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType;
36 import org.dive4elements.river.artifacts.sinfo.flood_duration.InfrastructureServerClientXChange.Element;
36 import org.dive4elements.river.exports.WaterlevelDescriptionBuilder; 37 import org.dive4elements.river.exports.WaterlevelDescriptionBuilder;
37 import org.dive4elements.river.model.Attribute.AttributeKey; 38 import org.dive4elements.river.model.Attribute.AttributeKey;
38 import org.dive4elements.river.model.Gauge; 39 import org.dive4elements.river.model.Gauge;
39 import org.dive4elements.river.model.sinfo.InfrastructureValue; 40 import org.dive4elements.river.model.sinfo.InfrastructureValue;
40 41
65 66
66 /** 67 /**
67 * Calculate the infrastructures flood duration result rows 68 * Calculate the infrastructures flood duration result rows
68 */ 69 */
69 public void execute(final Calculation problems, final String label, final DoubleRange calcRange, final AttributeKey riverside, 70 public void execute(final Calculation problems, final String label, final DoubleRange calcRange, final AttributeKey riverside,
70 final Set<String> infrastructureChoices, final boolean withWspl, final WINFOArtifact winfo, final FloodDurationCalculationResults results) { 71 final List<Element> infrastructureChoices, final boolean withWspl, final WINFOArtifact winfo, final FloodDurationCalculationResults results) {
71 72
72 // Find all gauges of the calc range, and create the duration finders 73 // Find all gauges of the calc range, and create the duration finders
73 final Map<Gauge, GaugeDurationValuesFinder> durFinders = new HashMap<>(); 74 final Map<Gauge, GaugeDurationValuesFinder> durFinders = new HashMap<>();
74 for (final Gauge gauge : this.riverInfoProvider.getGauges()) { 75 for (final Gauge gauge : this.riverInfoProvider.getGauges()) {
75 durFinders.put(gauge, GaugeDurationValuesFinder.loadValues(gauge, problems)); 76 durFinders.put(gauge, GaugeDurationValuesFinder.loadValues(gauge, problems));
76 } 77 }
77 78
78 // Find all infrastructures within the calc range 79 // Find all infrastructures within the calc range
80 final Set<String> choices = new HashSet<>();
81 for (final Element ifch : infrastructureChoices)
82 choices.add(ifch.getGroupLabel() + "\t" + ifch.getTypeLabel());
79 final List<InfrastructureValue> infras = InfrastructureValue.getValues(this.riverInfoProvider.getRiver(), calcRange.getMinimumDouble(), 83 final List<InfrastructureValue> infras = InfrastructureValue.getValues(this.riverInfoProvider.getRiver(), calcRange.getMinimumDouble(),
80 calcRange.getMaximumDouble(), riverside, infrastructureChoices); 84 calcRange.getMaximumDouble(), riverside, choices);
81 85
82 // Merge all stations (range/step, borders of gauge ranges, infrastructures) 86 // Merge all stations (range/step, borders of gauge ranges, infrastructures)
83 // final Map<Double, InfrastructureValue> allStations = new HashMap<>(); 87 // final Map<Double, InfrastructureValue> allStations = new HashMap<>();
84 this.stationInfras.clear(); 88 this.stationInfras.clear();
85 // final Map<Double, InfrastructureValue> secondBank = new HashMap<>(); // any second infrastructure in case of 89 // final Map<Double, InfrastructureValue> secondBank = new HashMap<>(); // any second infrastructure in case of

http://dive4elements.wald.intevation.org