Mercurial > dive4elements > river
changeset 9131:0a19a79663dd
TKH calculation now takes the stations of the bed heights for the waterlevel calculation instead of letting the user define a km-step
author | gernotbelger |
---|---|
date | Wed, 06 Jun 2018 14:17:18 +0200 (2018-06-06) |
parents | f61bc0c63188 |
children | 8cc192731c7d |
files | artifacts/doc/conf/artifacts/sinfo.xml artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/TkhCalculation.java |
diffstat | 2 files changed, 19 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/doc/conf/artifacts/sinfo.xml Wed Jun 06 14:16:28 2018 +0200 +++ b/artifacts/doc/conf/artifacts/sinfo.xml Wed Jun 06 14:17:18 2018 +0200 @@ -309,13 +309,19 @@ <!-- Calculation Mode: Überflutungsdauern Infrastrukturen BWaStr --> - <!-- Schrittweite benötigt für wq-state --> + <!-- Schrittweite benötigt für wq-state: TODO: vermutlich hier auch nicht? --> <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> <from state="state.sinfo.calculation_mode" /> <to state="state.sinfo.distance" /> <condition data="calculation_mode" value="sinfo_calc_flood_duration" operator="equal" /> </transition> + <state id="state.sinfo.distance" description="state.sinfo.distance" state="org.dive4elements.river.artifacts.states.DistanceSelect" helpText="help.state.sinfo.distance"> + <data name="ld_from" type="Double" /> + <data name="ld_to" type="Double" /> + <data name="ld_step" type="Double" /> + </state> + <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> <from state="state.sinfo.distance" /> <to state="state.sinfo.riverside" /> @@ -401,21 +407,12 @@ <!-- Calculation Mode: Transportkörperhöhen --> <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> <from state="state.sinfo.calculation_mode" /> - <to state="state.sinfo.distance" /> + <to state="state.sinfo.distance_only" /> <condition data="calculation_mode" value="sinfo_calc_transport_bodies_heights" operator="equal" /> </transition> - <state id="state.sinfo.distance" description="state.sinfo.distance" state="org.dive4elements.river.artifacts.states.DistanceSelect" helpText="help.state.sinfo.distance"> - <data name="ld_from" type="Double" /> - <data name="ld_to" type="Double" /> - <data name="ld_step" type="Double" /> - </state> - - - - <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> - <from state="state.sinfo.distance" /> + <from state="state.sinfo.distance_only" /> <to state="state.sinfo.wq" /> <condition data="calculation_mode" value="sinfo_calc_transport_bodies_heights" operator="equal" /> </transition>
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/TkhCalculation.java Wed Jun 06 14:16:28 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/TkhCalculation.java Wed Jun 06 14:17:18 2018 +0200 @@ -63,11 +63,20 @@ final RiverInfo riverInfo = new RiverInfo(river); final DoubleRange calcRange = access.getRange(); + final String calcModeLabel = Resources.getMsg(this.context.getMeta(), sinfo.getCalculationMode().name()); + final String user = CalculationUtils.findArtifactUser(this.context, sinfo); + final Calculation problems = new Calculation(); /* find relevant bed-heights */ final List<BedHeight> defaultBedHeights = new DefaultBedHeights(river).getBedHeights(problems); final Collection<BedHeightsFinder> bedHeights = BedHeightsFinder.createTkhBedHeights(problems, calcRange, defaultBedHeights); + + if (defaultBedHeights.isEmpty()) { + final TkhCalculationResults results = new TkhCalculationResults(calcModeLabel, user, riverInfo, calcRange, ""); + return new CalculationResult(results, problems); + } + final double[] stations = extractStations(bedHeights); /* misuse winfo-artifact to calculate waterlevels in the same way */ @@ -78,10 +87,6 @@ final RiverInfoProvider infoProvider = RiverInfoProvider.forRange(this.context, river, calcRange); - final String user = CalculationUtils.findArtifactUser(this.context, sinfo); - - final String calcModeLabel = Resources.getMsg(this.context.getMeta(), sinfo.getCalculationMode().name()); - final WaterlevelDescriptionBuilder descBuilder = new WaterlevelDescriptionBuilder(winfo, this.context); final String descriptionHeader = descBuilder.getColumnHeader(); @@ -126,10 +131,7 @@ private WQKms[] calculateWaterlevels(final WINFOArtifact winfo, final double[] stations, final Calculation problems) { - // FIXME: we take kms from step, but instead we would like to take kms from bedheights - // FIXME: this will definitely break the serialization of the winfo artifact - - final CalculationResult waterlevelData = winfo.getWaterlevelData(this.context); + final CalculationResult waterlevelData = winfo.computeWaterlevelData(stations); /* copy all problems */ final Calculation winfoProblems = waterlevelData.getReport();