Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstCalculation.java @ 9480:7228bd10a8cc
Fixed bundu bzws bedheightfinder todos, added types for excavation volume and costs total
author | mschaefer |
---|---|
date | Mon, 10 Sep 2018 17:06:23 +0200 |
parents | 2b83d3a96703 |
children | bb278c927b66 |
comparison
equal
deleted
inserted
replaced
9479:2b83d3a96703 | 9480:7228bd10a8cc |
---|---|
100 | 100 |
101 final WQKms wqkms = fixResult.getWQKms()[0]; | 101 final WQKms wqkms = fixResult.getWQKms()[0]; |
102 final WstInfo wstInfo = new WstInfo(wqkms.getName(), 0, riverInfoProvider.getReferenceGauge(), true); | 102 final WstInfo wstInfo = new WstInfo(wqkms.getName(), 0, riverInfoProvider.getReferenceGauge(), true); |
103 | 103 |
104 // Fetch the bed heights of the selected sounding | 104 // Fetch the bed heights of the selected sounding |
105 final Integer bedHeightId = access.getBedHeightID(); // TODO: REMOVE BEDHEIGHTFINDER FROM CALCULATION - HOW? | 105 final Integer bedHeightId = access.getBedHeightID(); |
106 final BedHeightsFinder bedHeightsFinder = bedHeightId == null ? null : BedHeightsFinder.forId(problems, bedHeightId, access.getRange()); | 106 final BedHeightsFinder bedHeightsFinder = (bedHeightId != null) ? BedHeightsFinder.forId(problems, bedHeightId, access.getRange()) |
107 : BedHeightsFinder.NullFinder(); | |
107 | 108 |
108 // Fetch the river channel data | 109 // Fetch the river channel data |
109 final ChannelFinder channelFinder = ChannelFinder.loadValues(problems, river, access.getBezugsJahr()); | 110 final ChannelFinder channelFinder = ChannelFinder.loadValues(problems, river, access.getBezugsJahr()); |
110 if (channelFinder == null) | 111 if (channelFinder == null) |
111 return new CalculationResult(results, problems); | 112 return new CalculationResult(results, problems); |
112 | 113 |
113 // Compute the result rows | 114 // Compute the result rows |
114 for (int i = 0; i <= wqkms.size() - 1; i++) { | 115 for (int i = 0; i <= wqkms.size() - 1; i++) { |
115 // TODO: REMOVE BEDHEIGHTFINDER FROM CALCULATION - HOW? | |
116 this.rows.add(createRow(wqkms.getKm(i), wqkms.getW(i), wqkms.getQ(i), bedHeightsFinder, channelFinder, riverInfoProvider, wstInfo)); | 116 this.rows.add(createRow(wqkms.getKm(i), wqkms.getW(i), wqkms.getQ(i), bedHeightsFinder, channelFinder, riverInfoProvider, wstInfo)); |
117 } | 117 } |
118 | 118 |
119 // Compute the missing volumes | 119 // Compute the missing volumes |
120 if (access.isCalculateMissingValue()) { | 120 if (access.isCalculateMissingValue()) { |
121 if (bedHeightsFinder == null) | 121 if ((bedHeightsFinder == null) || bedHeightsFinder.isNull()) |
122 return new CalculationResult(results, problems); | 122 return new CalculationResult(results, problems); |
123 computeMissingVolumes(problems); | 123 computeMissingVolumes(problems); |
124 final BedQualityCalculator bqCalculator = computeDensities(problems, bunduartifact, access, river); | 124 final BedQualityCalculator bqCalculator = computeDensities(problems, bunduartifact, access, river); |
125 computeMissingMasses(problems, bqCalculator); | 125 computeMissingMasses(problems, bqCalculator); |
126 } | 126 } |
186 row.putValue(BunduResultType.bezugswst, w); | 186 row.putValue(BunduResultType.bezugswst, w); |
187 row.putValue(GeneralResultType.dischargeQwithUnit, q); | 187 row.putValue(GeneralResultType.dischargeQwithUnit, q); |
188 row.putValue(GeneralResultType.waterlevelLabel, wstInfo.getLabel()); | 188 row.putValue(GeneralResultType.waterlevelLabel, wstInfo.getLabel()); |
189 row.putValue(GeneralResultType.gaugeLabel, riverInfoProv.findGauge(station)); | 189 row.putValue(GeneralResultType.gaugeLabel, riverInfoProv.findGauge(station)); |
190 row.putValue(GeneralResultType.location, riverInfoProv.getLocation(station)); | 190 row.putValue(GeneralResultType.location, riverInfoProv.getLocation(station)); |
191 row.putValue(BunduResultType.sounding, bedHeightsFinder.getInfo().getDescription()); | 191 if (bedHeightsFinder.getInfo() != null) |
192 row.putValue(BunduResultType.sounding, bedHeightsFinder.getInfo().getDescription()); | |
193 else | |
194 row.putValue(BunduResultType.sounding, ""); | |
192 | 195 |
193 // Set bed and channel bottom height | 196 // Set bed and channel bottom height |
194 | |
195 // TODO: REMOVE BEDHEIGHTFINDER FROM CALCULATION - HOW? | |
196 final double msh = bedHeightsFinder.getMeanBedHeight(station); | 197 final double msh = bedHeightsFinder.getMeanBedHeight(station); |
197 row.putValue(SInfoResultType.meanBedHeight, msh); | 198 row.putValue(SInfoResultType.meanBedHeight, msh); |
198 if (!Double.isNaN(w) && !Double.isNaN(msh)) | 199 if (!Double.isNaN(w) && !Double.isNaN(msh)) |
199 row.putValue(SInfoResultType.flowdepth, Formatter.roundFlowDepth(w).subtract(Formatter.roundFlowDepth(msh)).doubleValue()); | 200 row.putValue(SInfoResultType.flowdepth, Formatter.roundFlowDepth(w).subtract(Formatter.roundFlowDepth(msh)).doubleValue()); |
200 else | 201 else |
465 final ResultRow sumRow = ResultRow.create(); | 466 final ResultRow sumRow = ResultRow.create(); |
466 sumRow.putValue(BunduResultType.missStationRangeFrom, Double.valueOf(this.missKmFrom)); | 467 sumRow.putValue(BunduResultType.missStationRangeFrom, Double.valueOf(this.missKmFrom)); |
467 sumRow.putValue(BunduResultType.missStationRangeTo, Double.valueOf(this.missKmTo)); | 468 sumRow.putValue(BunduResultType.missStationRangeTo, Double.valueOf(this.missKmTo)); |
468 sumRow.putValue(BunduResultType.missVolumeTotal, vTotal); | 469 sumRow.putValue(BunduResultType.missVolumeTotal, vTotal); |
469 sumRow.putValue(BunduResultType.missMassTotal, mTotal); | 470 sumRow.putValue(BunduResultType.missMassTotal, mTotal); |
470 // TODO sumRow.putValue(BunduResultType.excavationVolumeTotal, eTotal); | 471 sumRow.putValue(BunduResultType.excavationVolumeTotal, eTotal); |
471 // TODO sumRow.putValue(BunduResultType.excavationCostsTotal, cTotal); | 472 sumRow.putValue(BunduResultType.excavationCostsTotal, cTotal); |
472 return sumRow; | 473 return sumRow; |
473 } | 474 } |
474 | 475 |
475 /** | 476 /** |
476 * Copies the rows of the missing volume calculation range into a new list | 477 * Copies the rows of the missing volume calculation range into a new list |