Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstMissVolCalculationResult2.java @ 9535:3fa8551c3d1b
Fixed error in bundu bzws missing volume calculation for mean bed height;
added various additional output columns (field bed height, field flow depth etc.)
author | mschaefer |
---|---|
date | Fri, 12 Oct 2018 18:49:38 +0200 |
parents | 5f81d3f7b82b |
children | 4deb6b24f072 |
comparison
equal
deleted
inserted
replaced
9534:b380a5693514 | 9535:3fa8551c3d1b |
---|---|
32 final class BezugswstMissVolCalculationResult2 extends AbstractCalculationExportableResult implements BunduWstExporter.MissResultType { | 32 final class BezugswstMissVolCalculationResult2 extends AbstractCalculationExportableResult implements BunduWstExporter.MissResultType { |
33 | 33 |
34 private static final long serialVersionUID = 1L; | 34 private static final long serialVersionUID = 1L; |
35 | 35 |
36 private static final String JASPER_FILE = "/jasper/templates/bundu.bezugswst.result2.jrxml"; | 36 private static final String JASPER_FILE = "/jasper/templates/bundu.bezugswst.result2.jrxml"; |
37 private static final String fieldBedheightMsgKey = "bundu.export.bezugswst.csv.meta.miss.bedheight.field"; | |
38 private static final String fieldFlowdepthMsgKey = "bundu.export.bezugswst.csv.meta.miss.flowdepth.field"; | |
37 private static final String fieldVolumeMsgKey = "bundu.export.bezugswst.csv.meta.miss.volume.field"; | 39 private static final String fieldVolumeMsgKey = "bundu.export.bezugswst.csv.meta.miss.volume.field"; |
38 private static final String fieldMassMsgKey = "bundu.export.bezugswst.csv.meta.miss.mass.field"; | 40 private static final String fieldMassMsgKey = "bundu.export.bezugswst.csv.meta.miss.mass.field"; |
39 | 41 |
40 public BezugswstMissVolCalculationResult2(final String label, final Collection<ResultRow> rows) { | 42 public BezugswstMissVolCalculationResult2(final String label, final Collection<ResultRow> rows) { |
41 super(label, rows); | 43 super(label, rows); |
57 return JASPER_FILE; | 59 return JASPER_FILE; |
58 } | 60 } |
59 | 61 |
60 protected String[] formatRow(final AbstractExportContext exportContext, final ResultRow row) { | 62 protected String[] formatRow(final AbstractExportContext exportContext, final ResultRow row) { |
61 | 63 |
62 final Collection<String> lines = new ArrayList<>(20); | 64 final Collection<String> lines = new ArrayList<>(44); |
63 | 65 |
64 lines.add(exportContext.formatRowValue(row, GeneralResultType.station)); | 66 lines.add(exportContext.formatRowValue(row, GeneralResultType.station)); |
65 @SuppressWarnings("unchecked") | 67 @SuppressWarnings("unchecked") |
66 final List<Double> vFields = (List<Double>) row.getValue(BunduResultType.missVolumeFields); | 68 final List<Double> vFields = (List<Double>) row.getValue(BunduResultType.missVolumeFields); |
67 assert (vFields.size() == fieldSize()); // immer abgleichen mit der Calculation! | 69 assert (vFields.size() == fieldSize()); // immer abgleichen mit der Calculation! |
68 @SuppressWarnings("unchecked") | 70 @SuppressWarnings("unchecked") |
69 final List<Double> mFields = (List<Double>) row.getValue(BunduResultType.missMassFields); | 71 final List<Double> mFields = (List<Double>) row.getValue(BunduResultType.missMassFields); |
70 assert (vFields.size() == mFields.size()); | 72 assert (vFields.size() == mFields.size()); |
73 @SuppressWarnings("unchecked") | |
74 final List<Double> hFields = (List<Double>) row.getValue(BunduResultType.bedHeightFields); | |
75 @SuppressWarnings("unchecked") | |
76 final List<Double> dFields = (List<Double>) row.getValue(BunduResultType.depthFields); | |
71 for (int i = 0; i < vFields.size(); i++) { | 77 for (int i = 0; i < vFields.size(); i++) { |
78 lines.add(BunduResultType.bedHeightFields.exportValue(exportContext.getContext(), hFields.get(i))); | |
79 lines.add(BunduResultType.depthFields.exportValue(exportContext.getContext(), dFields.get(i))); | |
72 lines.add(BunduResultType.missVolumeFields.exportValue(exportContext.getContext(), vFields.get(i))); | 80 lines.add(BunduResultType.missVolumeFields.exportValue(exportContext.getContext(), vFields.get(i))); |
73 lines.add(BunduResultType.missMassFields.exportValue(exportContext.getContext(), mFields.get(i))); | 81 lines.add(BunduResultType.missMassFields.exportValue(exportContext.getContext(), mFields.get(i))); |
74 } | 82 } |
83 lines.add(exportContext.formatRowValue(row, BunduResultType.heightMeanBed)); | |
84 lines.add(exportContext.formatRowValue(row, BunduResultType.flowdepthMeanBed)); | |
75 lines.add(exportContext.formatRowValue(row, BunduResultType.missVolumeMeanBed)); | 85 lines.add(exportContext.formatRowValue(row, BunduResultType.missVolumeMeanBed)); |
76 lines.add(exportContext.formatRowValue(row, BunduResultType.missMassMeanBed)); | 86 lines.add(exportContext.formatRowValue(row, BunduResultType.missMassMeanBed)); |
77 | 87 |
78 return lines.toArray(new String[lines.size()]); | 88 return lines.toArray(new String[lines.size()]); |
79 } | 89 } |
80 | 90 |
81 @Override | 91 @Override |
82 public void writeCSVHeader(final ExportContextCSV exportContextCSV, final RiverInfo river) { | 92 public void writeCSVHeader(final ExportContextCSV exportContextCSV, final RiverInfo river) { |
83 | 93 |
84 final int colSize = 2 * fieldSize() + 3; | 94 final int colSize = 4 * fieldSize() + 3; |
85 exportContextCSV.writeTitleForTabs("bundu.export.csv.title.bezugswst.result2", colSize); // Voraussetzung für Tabs ist, dass der Titel vor den Headern | 95 exportContextCSV.writeTitleForTabs("bundu.export.csv.title.bezugswst.result2", colSize); // Voraussetzung für Tabs ist, dass der Titel vor den Headern |
86 final Collection<String> header = new ArrayList<>(colSize); | 96 final Collection<String> header = new ArrayList<>(colSize); |
87 | 97 |
88 header.add(exportContextCSV.formatCsvHeader(GeneralResultType.station)); | 98 header.add(exportContextCSV.formatCsvHeader(GeneralResultType.station)); |
89 | 99 |
90 for (int i = 1, j = 1; i <= fieldSize() * 2; i += 2, j++) { | 100 for (int i = 1, j = 1; i <= fieldSize() * 4; i += 4, j++) { |
101 header.add(exportContextCSV.msg(fieldBedheightMsgKey, j) + " [" + river.getWstUnit() + "]"); | |
102 header.add(exportContextCSV.msg(fieldFlowdepthMsgKey, j)); | |
91 header.add(exportContextCSV.msg(fieldVolumeMsgKey, j)); | 103 header.add(exportContextCSV.msg(fieldVolumeMsgKey, j)); |
92 header.add(exportContextCSV.msg(fieldMassMsgKey, j)); | 104 header.add(exportContextCSV.msg(fieldMassMsgKey, j)); |
93 } | 105 } |
106 header.add(exportContextCSV.formatCsvHeader(BunduResultType.heightMeanBed) + " [" + river.getWstUnit() + "]"); | |
107 header.add(exportContextCSV.formatCsvHeader(BunduResultType.flowdepthMeanBed)); | |
94 header.add(exportContextCSV.formatCsvHeader(BunduResultType.missVolumeMeanBed)); | 108 header.add(exportContextCSV.formatCsvHeader(BunduResultType.missVolumeMeanBed)); |
95 header.add(exportContextCSV.formatCsvHeader(BunduResultType.missMassMeanBed)); | 109 header.add(exportContextCSV.formatCsvHeader(BunduResultType.missMassMeanBed)); |
96 | 110 |
97 exportContextCSV.writeCSVLine(header.toArray(new String[header.size()])); | 111 exportContextCSV.writeCSVLine(header.toArray(new String[header.size()])); |
98 | 112 |