# HG changeset patch
# User mschaefer
# Date 1539362978 -7200
# Node ID 3fa8551c3d1b154ce3cae0113026824e267ec3c0
# Parent b380a5693514a306c7edb99fa70354a34bcd7815
Fixed error in bundu bzws missing volume calculation for mean bed height;
added various additional output columns (field bed height, field flow depth etc.)
diff -r b380a5693514 -r 3fa8551c3d1b artifacts/doc/conf/jasper/templates/bundu.bezugswst.result3.jrxml
--- a/artifacts/doc/conf/jasper/templates/bundu.bezugswst.result3.jrxml Thu Oct 11 18:39:21 2018 +0200
+++ b/artifacts/doc/conf/jasper/templates/bundu.bezugswst.result3.jrxml Fri Oct 12 18:49:38 2018 +0200
@@ -132,35 +132,47 @@
-
+
-
+
+
+
+
+
+
+
-
+
-
+
-
+
+
+
+
+
+
+
-
+
@@ -171,7 +183,18 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -182,7 +205,7 @@
-
+
@@ -193,7 +216,7 @@
-
+
@@ -201,7 +224,18 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
diff -r b380a5693514 -r 3fa8551c3d1b artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/BunduResultType.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/BunduResultType.java Thu Oct 11 18:39:21 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/BunduResultType.java Fri Oct 12 18:49:38 2018 +0200
@@ -14,6 +14,7 @@
import org.dive4elements.artifacts.CallContext;
import org.dive4elements.river.artifacts.common.AbstractResultType;
import org.dive4elements.river.artifacts.common.I18NStrings;
+import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType;
import org.dive4elements.river.utils.Formatter;
/**
@@ -240,6 +241,36 @@
}
};
+ public static final SInfoResultType heightMeanBed = new SInfoResultType(null, "bundu.export.bezugswst.csv.meta.miss.height.mean_bed") {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String exportValue(final CallContext context, final Object value) {
+ final double doubleValue = asDouble(value);
+ return exportDoubleValue(context, doubleValue);
+ }
+
+ @Override
+ protected NumberFormat createFormatter(final CallContext context) {
+ return Formatter.getMeanBedHeight(context);
+ }
+ };
+
+ public static final SInfoResultType flowdepthMeanBed = new SInfoResultType(I18NStrings.UNIT_M, "bundu.export.bezugswst.csv.meta.miss.flowdepth.mean_bed") {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String exportValue(final CallContext context, final Object value) {
+ final double doubleValue = asDouble(value);
+ return exportDoubleValue(context, doubleValue);
+ }
+
+ @Override
+ protected NumberFormat createFormatter(final CallContext context) {
+ return Formatter.getFlowDepth(context);
+ }
+ };
+
public static final BunduResultType missDepthMeanBed = new BunduResultType(I18NStrings.UNIT_NONE, null) {
private static final long serialVersionUID = 1L;
@@ -319,7 +350,7 @@
@Override
protected NumberFormat createFormatter(final CallContext context) {
- throw new UnsupportedOperationException();
+ return Formatter.getMeanBedHeight(context);
}
};
@@ -338,7 +369,7 @@
@Override
protected NumberFormat createFormatter(final CallContext context) {
- throw new UnsupportedOperationException();
+ return Formatter.getFlowDepth(context);
}
};
diff -r b380a5693514 -r 3fa8551c3d1b artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstCalculation.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstCalculation.java Thu Oct 11 18:39:21 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstCalculation.java Fri Oct 12 18:49:38 2018 +0200
@@ -29,7 +29,6 @@
import org.dive4elements.river.artifacts.model.fixings.FixRealizingResult;
import org.dive4elements.river.artifacts.model.river.RiverInfoProvider;
import org.dive4elements.river.artifacts.resources.Resources;
-import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType;
import org.dive4elements.river.artifacts.sinfo.tkhstate.BedHeightsFinder;
import org.dive4elements.river.artifacts.sinfo.tkhstate.WinfoArtifactWrapper;
import org.dive4elements.river.artifacts.sinfo.util.CalculationUtils;
@@ -202,11 +201,11 @@
// Set bed and channel bottom height
final double msh = bedHeightsFinder.getMeanBedHeight(station);
- row.putValue(SInfoResultType.meanBedHeight, msh);
+ row.putValue(BunduResultType.heightMeanBed, msh);
if (!Double.isNaN(w) && !Double.isNaN(msh))
- row.putValue(SInfoResultType.flowdepth, w - msh);
+ row.putValue(BunduResultType.flowdepthMeanBed, w - msh);
else
- row.putValue(SInfoResultType.flowdepth, Double.NaN);
+ row.putValue(BunduResultType.flowdepthMeanBed, Double.NaN);
final double channelDepth = channelFinder.getDepth(station);
row.putValue(BunduResultType.channelDepth, channelDepth);
@@ -288,11 +287,14 @@
}
if (first < 0)
return;
+ // Calculate all kms in missing volume calc range
+ double km;
int last = this.rows.size() - 1;
for (int i = first; i <= this.rows.size() - 1; i++) {
- if (!isKmInMissingVolumeRange(this.rows.get(i).getDoubleValue(GeneralResultType.station)))
+ km = this.rows.get(i).getDoubleValue(GeneralResultType.station);
+ if (!isKmInMissingVolumeRange(km))
break;
- if (this.rows.get(i).getDoubleValue(GeneralResultType.station) > this.missKmTo.doubleValue() - 0.0001)
+ if (km > this.missKmTo.doubleValue() - 0.0001)
last = i;
final List areas = new ArrayList<>();
final List volumes = new ArrayList<>();
@@ -357,6 +359,8 @@
private double[] computeMeanBedMissingAreaAndVolume(final int current, final int first, final int last) {
final double areaCurr = meanBedMissingArea(current, first, last);
+ if (areaCurr < 0.0001)
+ return new double[] { 0.0, 0.0 };
final double areaPrev = meanBedMissingArea(current - 1, first, last);
final double areaNext = meanBedMissingArea(current + 1, first, last);
final double kmCurr = missingKm(current);
@@ -375,7 +379,7 @@
private double meanBedMissingArea(final int rowIndex, final int first, final int last) {
if ((first <= rowIndex) && (rowIndex <= last)) {
final double dh = this.rows.get(rowIndex).getDoubleValue(BunduResultType.channelDepth)
- - this.rows.get(rowIndex).getDoubleValue(SInfoResultType.flowdepth);
+ - this.rows.get(rowIndex).getDoubleValue(BunduResultType.flowdepthMeanBed);
if (dh > 0.0)
return dh * this.rows.get(rowIndex).getDoubleValue(BunduResultType.channelWidth);
return 0.0;
diff -r b380a5693514 -r 3fa8551c3d1b artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstDepthProcessor.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstDepthProcessor.java Thu Oct 11 18:39:21 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstDepthProcessor.java Fri Oct 12 18:49:38 2018 +0200
@@ -20,7 +20,6 @@
import org.dive4elements.river.artifacts.common.AbstractProcessor;
import org.dive4elements.river.artifacts.common.AbstractResultType;
import org.dive4elements.river.artifacts.resources.Resources;
-import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType;
import org.dive4elements.river.exports.DiagramGenerator;
import org.dive4elements.river.model.BedHeightValueType;
import org.dive4elements.river.themes.ThemeDocument;
@@ -98,7 +97,7 @@
protected AbstractResultType doGetType(final String facetName) {
if (FACET_FLOWDEPTH_FILTERED.contentEquals(facetName))
- return SInfoResultType.flowdepth;
+ return BunduResultType.flowdepthMeanBed;
if (FACET_CHANNELDEPTH.contentEquals(facetName))
return BunduResultType.channelDepth;
diff -r b380a5693514 -r 3fa8551c3d1b artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstHeightProcessor.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstHeightProcessor.java Thu Oct 11 18:39:21 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstHeightProcessor.java Fri Oct 12 18:49:38 2018 +0200
@@ -20,7 +20,6 @@
import org.dive4elements.river.artifacts.common.AbstractProcessor;
import org.dive4elements.river.artifacts.common.AbstractResultType;
import org.dive4elements.river.artifacts.resources.Resources;
-import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType;
import org.dive4elements.river.exports.DiagramGenerator;
import org.dive4elements.river.exports.LongitudinalSectionGenerator;
import org.dive4elements.river.model.BedHeightValueType;
@@ -102,7 +101,7 @@
if (FACET_CHANNELMIN.contentEquals(facetName))
return BunduResultType.channelLowerEdge;
if (FACET_BEDHEIGHT.contentEquals(facetName))
- return SInfoResultType.meanBedHeight;
+ return BunduResultType.heightMeanBed;
final String error = String.format("Unknown facet name: %s", facetName);
throw new UnsupportedOperationException(error);
diff -r b380a5693514 -r 3fa8551c3d1b artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstMissVolCalculationResult2.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstMissVolCalculationResult2.java Thu Oct 11 18:39:21 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstMissVolCalculationResult2.java Fri Oct 12 18:49:38 2018 +0200
@@ -34,6 +34,8 @@
private static final long serialVersionUID = 1L;
private static final String JASPER_FILE = "/jasper/templates/bundu.bezugswst.result2.jrxml";
+ private static final String fieldBedheightMsgKey = "bundu.export.bezugswst.csv.meta.miss.bedheight.field";
+ private static final String fieldFlowdepthMsgKey = "bundu.export.bezugswst.csv.meta.miss.flowdepth.field";
private static final String fieldVolumeMsgKey = "bundu.export.bezugswst.csv.meta.miss.volume.field";
private static final String fieldMassMsgKey = "bundu.export.bezugswst.csv.meta.miss.mass.field";
@@ -59,7 +61,7 @@
protected String[] formatRow(final AbstractExportContext exportContext, final ResultRow row) {
- final Collection lines = new ArrayList<>(20);
+ final Collection lines = new ArrayList<>(44);
lines.add(exportContext.formatRowValue(row, GeneralResultType.station));
@SuppressWarnings("unchecked")
@@ -68,10 +70,18 @@
@SuppressWarnings("unchecked")
final List mFields = (List) row.getValue(BunduResultType.missMassFields);
assert (vFields.size() == mFields.size());
+ @SuppressWarnings("unchecked")
+ final List hFields = (List) row.getValue(BunduResultType.bedHeightFields);
+ @SuppressWarnings("unchecked")
+ final List dFields = (List) row.getValue(BunduResultType.depthFields);
for (int i = 0; i < vFields.size(); i++) {
+ lines.add(BunduResultType.bedHeightFields.exportValue(exportContext.getContext(), hFields.get(i)));
+ lines.add(BunduResultType.depthFields.exportValue(exportContext.getContext(), dFields.get(i)));
lines.add(BunduResultType.missVolumeFields.exportValue(exportContext.getContext(), vFields.get(i)));
lines.add(BunduResultType.missMassFields.exportValue(exportContext.getContext(), mFields.get(i)));
}
+ lines.add(exportContext.formatRowValue(row, BunduResultType.heightMeanBed));
+ lines.add(exportContext.formatRowValue(row, BunduResultType.flowdepthMeanBed));
lines.add(exportContext.formatRowValue(row, BunduResultType.missVolumeMeanBed));
lines.add(exportContext.formatRowValue(row, BunduResultType.missMassMeanBed));
@@ -81,16 +91,20 @@
@Override
public void writeCSVHeader(final ExportContextCSV exportContextCSV, final RiverInfo river) {
- final int colSize = 2 * fieldSize() + 3;
+ final int colSize = 4 * fieldSize() + 3;
exportContextCSV.writeTitleForTabs("bundu.export.csv.title.bezugswst.result2", colSize); // Voraussetzung für Tabs ist, dass der Titel vor den Headern
final Collection header = new ArrayList<>(colSize);
header.add(exportContextCSV.formatCsvHeader(GeneralResultType.station));
- for (int i = 1, j = 1; i <= fieldSize() * 2; i += 2, j++) {
+ for (int i = 1, j = 1; i <= fieldSize() * 4; i += 4, j++) {
+ header.add(exportContextCSV.msg(fieldBedheightMsgKey, j) + " [" + river.getWstUnit() + "]");
+ header.add(exportContextCSV.msg(fieldFlowdepthMsgKey, j));
header.add(exportContextCSV.msg(fieldVolumeMsgKey, j));
header.add(exportContextCSV.msg(fieldMassMsgKey, j));
}
+ header.add(exportContextCSV.formatCsvHeader(BunduResultType.heightMeanBed) + " [" + river.getWstUnit() + "]");
+ header.add(exportContextCSV.formatCsvHeader(BunduResultType.flowdepthMeanBed));
header.add(exportContextCSV.formatCsvHeader(BunduResultType.missVolumeMeanBed));
header.add(exportContextCSV.formatCsvHeader(BunduResultType.missMassMeanBed));
diff -r b380a5693514 -r 3fa8551c3d1b artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstMissVolCalculationResult3.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstMissVolCalculationResult3.java Thu Oct 11 18:39:21 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstMissVolCalculationResult3.java Fri Oct 12 18:49:38 2018 +0200
@@ -49,19 +49,21 @@
protected String[] formatRow(final AbstractExportContext exportContext, final ResultRow row) {
- final Collection lines = new ArrayList<>(4);
+ final Collection lines = new ArrayList<>(6);
lines.add(exportContext.formatRowValue(row, BunduResultType.missStationRangeFrom));
lines.add(exportContext.formatRowValue(row, BunduResultType.missStationRangeTo));
lines.add(exportContext.formatRowValue(row, BunduResultType.missVolumeTotal));
lines.add(exportContext.formatRowValue(row, BunduResultType.missMassTotal));
+ lines.add(exportContext.formatRowValue(row, BunduResultType.excavationVolumeTotal));
+ lines.add(exportContext.formatRowValue(row, BunduResultType.excavationCostsTotal));
return lines.toArray(new String[lines.size()]);
}
@Override
public void writeCSVHeader(final ExportContextCSV exportContextCSV, final RiverInfo river) {
- final int colSize = 4;
+ final int colSize = 6;
exportContextCSV.writeTitleForTabs("bundu.export.csv.title.bezugswst.result3", colSize); // Voraussetzung für Tabs ist, dass der Titel vor den Headern
final Collection header = new ArrayList<>(colSize);
@@ -69,6 +71,8 @@
header.add(exportContextCSV.formatCsvHeader(BunduResultType.missStationRangeTo));
header.add(exportContextCSV.formatCsvHeader(BunduResultType.missVolumeTotal));
header.add(exportContextCSV.formatCsvHeader(BunduResultType.missMassTotal));
+ header.add(exportContextCSV.formatCsvHeader(BunduResultType.excavationVolumeTotal));
+ header.add(exportContextCSV.formatCsvHeader(BunduResultType.excavationCostsTotal));
exportContextCSV.writeCSVLine(header.toArray(new String[header.size()]));
@@ -94,6 +98,8 @@
exportContextPDF.addJRMetadata(source, "station_to_header", BunduResultType.missStationRangeTo);
exportContextPDF.addJRMetadata(source, "channel_miss_volume_header", BunduResultType.missVolumeTotal);
exportContextPDF.addJRMetadata(source, "channel_miss_mass_header", BunduResultType.missMassTotal);
+ exportContextPDF.addJRMetadata(source, "excavation_volume_header", BunduResultType.excavationVolumeTotal);
+ exportContextPDF.addJRMetadata(source, "excavation_costs_header", BunduResultType.excavationCostsTotal);
}
}
\ No newline at end of file
diff -r b380a5693514 -r 3fa8551c3d1b artifacts/src/main/resources/messages.properties
--- a/artifacts/src/main/resources/messages.properties Thu Oct 11 18:39:21 2018 +0200
+++ b/artifacts/src/main/resources/messages.properties Fri Oct 12 18:49:38 2018 +0200
@@ -938,8 +938,12 @@
bundu.export.bezugswst.csv.meta.miss.channel.lower_edge = Lower Edge of Channel
bundu.export.bezugswst.pdf.meta.miss.channel.lower_edge = Lower Edge of Channel
bundu.export.bezugswst.csv.meta.miss.sounding = Sounding
+bundu.export.bezugswst.csv.meta.miss.bedheight.field = Feld {0} Geodetic Altitude
+bundu.export.bezugswst.csv.meta.miss.flowdepth.field = Feld {0} Flow Depth [m]
bundu.export.bezugswst.csv.meta.miss.mass.field = Field {0} Missing Mass [t]
bundu.export.bezugswst.csv.meta.miss.volume.field = Field {0} Missing Volume [m\u00b3]
+bundu.export.bezugswst.csv.meta.miss.height.mean_bed = Mean Bed Height Geodetic Altitude
+bundu.export.bezugswst.csv.meta.miss.flowdepth.mean_bed = Mean Bed Height Flow Depth [m]
bundu.export.bezugswst.csv.meta.miss.mass.mean_bed = Mean Bed Height Missing Mass [t]
bundu.export.bezugswst.csv.meta.miss.volume.mean_bed = Mean Bed Height Missing Volume [m\u00b3]
bundu.export.bezugswst.csv.meta.miss.km_from = River-km From
diff -r b380a5693514 -r 3fa8551c3d1b artifacts/src/main/resources/messages_de.properties
--- a/artifacts/src/main/resources/messages_de.properties Thu Oct 11 18:39:21 2018 +0200
+++ b/artifacts/src/main/resources/messages_de.properties Fri Oct 12 18:49:38 2018 +0200
@@ -928,9 +928,9 @@
bundu.export.bezugswst.csv.meta.miss.mass.total = Fehlmasse gesamt [t]
bundu.export.bezugswst.csv.meta.miss.volume.total = Fehlvolumen gesamt [m\u00b3]
bundu.export.bezugswst.csv.meta.miss.coststotal = Baggerkosten gesamt [\u20ac]
-bundu.export.bezugswst.pdf.meta.miss.coststotal = Bagger-kosten gesamt [\u20ac]
+bundu.export.bezugswst.pdf.meta.miss.coststotal = Baggerkosten gesamt [\u20ac]
bundu.export.bezugswst.csv.meta.miss.excavationtotal = Baggervolumen gesamt [m\u00b3]
-bundu.export.bezugswst.pdf.meta.miss.excavationtotal = Bagger-volumen gesamt [m\u00b3]
+bundu.export.bezugswst.pdf.meta.miss.excavationtotal = Baggervolumen gesamt [m\u00b3]
bundu.export.bezugswst.csv.meta.miss.exists = Fehltiefe vorhanden?
bundu.export.bezugswst.pdf.meta.miss.exists = Fehl-tiefe vor-handen?
bundu.export.bezugswst.csv.meta.miss.channel.min_depth = Zu gew\u00e4hrleistende Fahrrinnentiefe [m]
@@ -938,8 +938,12 @@
bundu.export.bezugswst.csv.meta.miss.channel.lower_edge = Unterkante Fahrrinnenkasten
bundu.export.bezugswst.pdf.meta.miss.channel.lower_edge = Unterkante Fahrrinnen-kasten
bundu.export.bezugswst.csv.meta.miss.sounding = Peilung
+bundu.export.bezugswst.csv.meta.miss.bedheight.field = Feld {0} Geod\u00e4tische H\u00f6he
+bundu.export.bezugswst.csv.meta.miss.flowdepth.field = Feld {0} Flie\u00dftiefe [m]
bundu.export.bezugswst.csv.meta.miss.mass.field = Feld {0} Fehlmasse [t]
bundu.export.bezugswst.csv.meta.miss.volume.field = Feld {0} Fehlvolumen [m\u00b3]
+bundu.export.bezugswst.csv.meta.miss.height.mean_bed = Mittlere Sohlh\u00f6he Geod\u00e4tische H\u00f6he
+bundu.export.bezugswst.csv.meta.miss.flowdepth.mean_bed = Mittlere Sohlh\u00f6he Flie\u00dftiefe [t]
bundu.export.bezugswst.csv.meta.miss.mass.mean_bed = Mittlere Sohlh\u00f6he Fehlmasse [t]
bundu.export.bezugswst.csv.meta.miss.volume.mean_bed = Mittlere Sohlh\u00f6he Fehlvolumen [m\u00b3]
bundu.export.bezugswst.csv.meta.miss.km_from = Fluss-km von