comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/TkhCalculation.java @ 8948:a4f1ac81f26d

Work on SINFO-FlowDepthMinMax. Also rework of result row stuff, in order to reduce abstraction, using result type concept
author gernotbelger
date Wed, 14 Mar 2018 14:10:32 +0100
parents 5d5d482da3e9
children 183f42641ab6
comparison
equal deleted inserted replaced
8947:86650594f051 8948:a4f1ac81f26d
26 import org.dive4elements.river.artifacts.model.CalculationResult; 26 import org.dive4elements.river.artifacts.model.CalculationResult;
27 import org.dive4elements.river.artifacts.model.WQKms; 27 import org.dive4elements.river.artifacts.model.WQKms;
28 import org.dive4elements.river.artifacts.resources.Resources; 28 import org.dive4elements.river.artifacts.resources.Resources;
29 import org.dive4elements.river.artifacts.sinfo.SINFOArtifact; 29 import org.dive4elements.river.artifacts.sinfo.SINFOArtifact;
30 import org.dive4elements.river.artifacts.sinfo.common.RiverInfoProvider; 30 import org.dive4elements.river.artifacts.sinfo.common.RiverInfoProvider;
31 import org.dive4elements.river.artifacts.sinfo.common.SInfoResultRow;
32 import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType;
31 import org.dive4elements.river.artifacts.sinfo.tkhcalculation.DischargeValuesFinder; 33 import org.dive4elements.river.artifacts.sinfo.tkhcalculation.DischargeValuesFinder;
32 import org.dive4elements.river.artifacts.sinfo.tkhcalculation.Tkh;
33 import org.dive4elements.river.artifacts.sinfo.tkhcalculation.TkhCalculator; 34 import org.dive4elements.river.artifacts.sinfo.tkhcalculation.TkhCalculator;
34 import org.dive4elements.river.artifacts.sinfo.tkhcalculation.WaterlevelValuesFinder; 35 import org.dive4elements.river.artifacts.sinfo.tkhcalculation.WaterlevelValuesFinder;
35 import org.dive4elements.river.artifacts.sinfo.util.BedHeightInfo; 36 import org.dive4elements.river.artifacts.sinfo.util.BedHeightInfo;
36 import org.dive4elements.river.artifacts.sinfo.util.CalculationUtils; 37 import org.dive4elements.river.artifacts.sinfo.util.CalculationUtils;
37 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; 38 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo;
132 if (calculatorsByRanges.isEmpty()) { 133 if (calculatorsByRanges.isEmpty()) {
133 /* there should already be some problems, so just abort */ 134 /* there should already be some problems, so just abort */
134 return null; 135 return null;
135 } 136 }
136 137
137 final Collection<TkhResultRow> rows = new ArrayList<>(); 138 final Collection<SInfoResultRow> rows = new ArrayList<>();
138 139
139 /* using wst-kms as basis, because we know that they are generated wst's with a fixed km-step */ 140 /* using wst-kms as basis, because we know that they are generated wst's with a fixed km-step */
140 // FIXME: das führt dazu, das aktuell die Sohlhöhen beliebig linear interpolierrt werden. ist das immer richtig? z.b. 141 // FIXME: das führt dazu, das aktuell die Sohlhöhen beliebig linear interpolierrt werden. ist das immer richtig? z.b.
141 // bei großen abständen? 142 // bei großen abständen?
142 143
148 /* find the right calculator (i.e. bedheigh) depending on station, there should only be one maximal */ 149 /* find the right calculator (i.e. bedheigh) depending on station, there should only be one maximal */
149 final TkhCalculator tkhCalculator = findCalculator(calculatorsByRanges, station); 150 final TkhCalculator tkhCalculator = findCalculator(calculatorsByRanges, station);
150 if (tkhCalculator == null) 151 if (tkhCalculator == null)
151 continue; 152 continue;
152 153
153 final Tkh tkh = tkhCalculator.getTkh(station); 154 final SInfoResultRow row = SInfoResultRow.create();
154 155
155 final String description = descBuilder.getDesc(wkms); 156 row.putValue(SInfoResultType.waterlevelLabel, descBuilder.getDesc(wkms));
156 final String gaugeLabel = riverInfoProvider.findGauge(station); 157 row.putValue(SInfoResultType.gaugeLabel, riverInfoProvider.findGauge(station));
157 final String location = riverInfoProvider.getLocation(station); 158 row.putValue(SInfoResultType.location, riverInfoProvider.getLocation(station));
158 159
159 rows.add(new TkhResultRow(tkh, description, gaugeLabel, location)); 160 tkhCalculator.calculateTkh(station, row);
161
162 rows.add(row);
160 } 163 }
161 164
162 return new TkhCalculationResult(wstLabel, wstInfo, true, rows); 165 return new TkhCalculationResult(wstLabel, wstInfo, true, rows);
163 } 166 }
164 167

http://dive4elements.wald.intevation.org