Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthdev/FlowDepthDevelopmentCalculation.java @ 8980:b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
Some improvements to error handling and handling of empty results.
author | gernotbelger |
---|---|
date | Thu, 05 Apr 2018 18:30:34 +0200 |
parents | b5600453bb8f |
children | d5802f22e4f5 |
comparison
equal
deleted
inserted
replaced
8979:951a4af24a09 | 8980:b194fa64506a |
---|---|
68 final String calcModeLabel = Resources.getMsg(this.context.getMeta(), sinfo.getCalculationMode().name()); | 68 final String calcModeLabel = Resources.getMsg(this.context.getMeta(), sinfo.getCalculationMode().name()); |
69 | 69 |
70 final FlowDepthDevelopmentCalculationResults results = new FlowDepthDevelopmentCalculationResults(calcModeLabel, user, riverInfo, calcRange); | 70 final FlowDepthDevelopmentCalculationResults results = new FlowDepthDevelopmentCalculationResults(calcModeLabel, user, riverInfo, calcRange); |
71 | 71 |
72 final FlowDepthDevelopmentCalculationResult result = calculateResult(calcRange, currentPair, histPair, problems, infoProvider); | 72 final FlowDepthDevelopmentCalculationResult result = calculateResult(calcRange, currentPair, histPair, problems, infoProvider); |
73 if (result != null) | 73 results.addResult(result, problems); |
74 results.addResult(result); | |
75 | 74 |
76 return new CalculationResult(results, problems); | 75 return new CalculationResult(results, problems); |
77 } | 76 } |
78 | 77 |
79 private FlowDepthDevelopmentCalculationResult calculateResult(final DoubleRange calcRange, final WstSoundingIdPair currentPair, | 78 private FlowDepthDevelopmentCalculationResult calculateResult(final DoubleRange calcRange, final WstSoundingIdPair currentPair, |
116 problems.addProblem("flowdepthdevelopmentcalculation.missingHistoricalYear", historicalWaterlevel.getName()); | 115 problems.addProblem("flowdepthdevelopmentcalculation.missingHistoricalYear", historicalWaterlevel.getName()); |
117 return null; | 116 return null; |
118 } | 117 } |
119 | 118 |
120 // FIXME: distinguish error messages | 119 // FIXME: distinguish error messages |
121 FlowDepthUtils.checkYearDifference("", currentWstYear, currentSoundingYear, problems); | 120 FlowDepthUtils.checkYearDifference(Resources.getMsg(this.context.getMeta(), "flowdepthdevelopmentcalculation.yearDifferenceCurrent"), currentWstYear, |
122 FlowDepthUtils.checkYearDifference("", historicalWstYear, historicalSoundingYear, problems); | 121 currentSoundingYear, problems); |
122 FlowDepthUtils.checkYearDifference(Resources.getMsg(this.context.getMeta(), "flowdepthdevelopmentcalculation.yearDifferenceHistorical"), | |
123 historicalWstYear, | |
124 historicalSoundingYear, problems); | |
123 | 125 |
124 /* re-determine the reference gauge, in the same way as the WaterlevelArtifact would do it */ | 126 /* re-determine the reference gauge, in the same way as the WaterlevelArtifact would do it */ |
125 final RiverInfoProvider currentRiverInfoProvider = infoProvider.forWaterlevel(currentWaterlevel); | 127 final RiverInfoProvider currentRiverInfoProvider = infoProvider.forWaterlevel(currentWaterlevel); |
126 final RiverInfoProvider histRiverInfoProvider = infoProvider.forWaterlevel(historicalWaterlevel); | 128 final RiverInfoProvider histRiverInfoProvider = infoProvider.forWaterlevel(historicalWaterlevel); |
127 | 129 |