Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxCalculation.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 | 322b0e6298ea |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxCalculation.java Wed Mar 14 14:09:33 2018 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxCalculation.java Wed Mar 14 14:10:32 2018 +0100 @@ -20,6 +20,8 @@ import org.dive4elements.river.artifacts.resources.Resources; import org.dive4elements.river.artifacts.sinfo.SINFOArtifact; import org.dive4elements.river.artifacts.sinfo.common.RiverInfoProvider; +import org.dive4elements.river.artifacts.sinfo.common.SInfoResultRow; +import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType; import org.dive4elements.river.artifacts.sinfo.flowdepth.FlowDepthUtils; import org.dive4elements.river.artifacts.sinfo.flowdepthminmax.FlowDepthMinMaxAccess.MinMaxIdPair; import org.dive4elements.river.artifacts.sinfo.tkhcalculation.DischargeValuesFinder; @@ -86,7 +88,7 @@ /* access real input data from database */ final String wstId = minMaxPair.getWstId(); final String minSoundingId = minMaxPair.getMinSoundingId(); - final String maxSoundingId = minMaxPair.getMinSoundingId(); + final String maxSoundingId = minMaxPair.getMaxSoundingId(); final BedHeightsFinder minBedHeight = minSoundingId == null ? null : BedHeightsFinder.forId(this.context, minSoundingId, calcRange, problems); final BedHeightsFinder maxBedHeight = maxSoundingId == null ? null : BedHeightsFinder.forId(this.context, maxSoundingId, calcRange, problems); @@ -121,7 +123,7 @@ final String soundingLabel = buildSoundingLabel(minBedHeight, maxBedHeight); /* real calculation loop */ - final Collection<FlowDepthMinMaxRow> rows = new ArrayList<>(); + final Collection<SInfoResultRow> rows = new ArrayList<>(); // FIXME: determine what is the spatial discretisation that we will use... final double[] allKms = wstKms.allKms().toNativeArray(); @@ -146,13 +148,24 @@ // REMARK: access the gauge once only during calculation final String gaugeLabel = riverInfoProvider.findGauge(station); - rows.add(new FlowDepthMinMaxRow(station, minFlowDepth, maxFlowDepth, wst, discharge, waterlevelLabel, gaugeLabel, meanBedHeight, soundingLabel, - location)); + final SInfoResultRow row = SInfoResultRow.create().// + putValue(SInfoResultType.station, station). // + putValue(SInfoResultType.flowdepthmin, minFlowDepth). // + putValue(SInfoResultType.flowdepthmax, maxFlowDepth). // + putValue(SInfoResultType.waterlevel, wst). // + putValue(SInfoResultType.discharge, discharge). // + putValue(SInfoResultType.waterlevelLabel, waterlevelLabel). // + putValue(SInfoResultType.gaugeLabel, gaugeLabel). // + putValue(SInfoResultType.meanBedHeight, meanBedHeight). // + putValue(SInfoResultType.soundingLabel, soundingLabel). // + putValue(SInfoResultType.location, location); + rows.add(row); } } final BedHeightInfo minBedHeightInfo = minBedHeight == null ? null : minBedHeight.getInfo(); final BedHeightInfo maxBedHeightInfo = maxBedHeight == null ? null : maxBedHeight.getInfo(); + return new FlowDepthMinMaxCalculationResult(label, wstInfo, minBedHeightInfo, maxBedHeightInfo, rows); }