Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstMissVolCalculationResult2.java @ 9636:ac41551a8e4d
Bundu/Bzws: Error message for missing channel/year, Nachtrag Pos. 20: import of two levels of infrastructure types
author | mschaefer |
---|---|
date | Mon, 11 Nov 2019 16:29:36 +0100 |
parents | 4deb6b24f072 |
children |
rev | line source |
---|---|
9444
ecadc9ed0ba0
Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents:
9432
diff
changeset
|
1 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde |
9331 | 2 * Software engineering by |
3 * Björnsen Beratende Ingenieure GmbH | |
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt | |
5 * | |
6 * This file is Free Software under the GNU AGPL (>=v3) | |
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the | |
8 * documentation coming with Dive4Elements River for details. | |
9 */ | |
10 package org.dive4elements.river.artifacts.bundu.bezugswst; | |
11 | |
12 import java.util.ArrayList; | |
13 import java.util.Collection; | |
14 import java.util.List; | |
15 | |
16 import org.dive4elements.river.artifacts.bundu.BunduResultType; | |
17 import org.dive4elements.river.artifacts.common.AbstractCalculationExportableResult; | |
18 import org.dive4elements.river.artifacts.common.AbstractExportContext; | |
19 import org.dive4elements.river.artifacts.common.ExportContextCSV; | |
20 import org.dive4elements.river.artifacts.common.ExportContextPDF; | |
21 import org.dive4elements.river.artifacts.common.GeneralResultType; | |
22 import org.dive4elements.river.artifacts.common.MetaAndTableJRDataSource; | |
23 import org.dive4elements.river.artifacts.common.ResultRow; | |
24 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; | |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
25 import org.dive4elements.river.model.BedHeightValueType; |
9331 | 26 |
27 /** | |
28 * Contains the results of a //TODO LINK{@link BezugswstCalculation}. | |
29 * | |
30 * @author Gernot Belger | |
31 */ | |
9332 | 32 final class BezugswstMissVolCalculationResult2 extends AbstractCalculationExportableResult implements BunduWstExporter.MissResultType { |
9331 | 33 |
34 private static final long serialVersionUID = 1L; | |
35 | |
9535
3fa8551c3d1b
Fixed error in bundu bzws missing volume calculation for mean bed height;
mschaefer
parents:
9455
diff
changeset
|
36 private static final String fieldBedheightMsgKey = "bundu.export.bezugswst.csv.meta.miss.bedheight.field"; |
3fa8551c3d1b
Fixed error in bundu bzws missing volume calculation for mean bed height;
mschaefer
parents:
9455
diff
changeset
|
37 private static final String fieldFlowdepthMsgKey = "bundu.export.bezugswst.csv.meta.miss.flowdepth.field"; |
9444
ecadc9ed0ba0
Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents:
9432
diff
changeset
|
38 private static final String fieldVolumeMsgKey = "bundu.export.bezugswst.csv.meta.miss.volume.field"; |
ecadc9ed0ba0
Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents:
9432
diff
changeset
|
39 private static final String fieldMassMsgKey = "bundu.export.bezugswst.csv.meta.miss.mass.field"; |
9331 | 40 |
41 public BezugswstMissVolCalculationResult2(final String label, final Collection<ResultRow> rows) { | |
42 super(label, rows); | |
43 | |
44 } | |
45 | |
46 @Override | |
9455 | 47 protected boolean pdfExportEnabled() { |
48 return false; | |
49 } | |
50 | |
51 @Override | |
9331 | 52 protected void writeCSVResultMetadata(final ExportContextCSV exportContextCSV) { |
53 // no metadata | |
54 } | |
55 | |
56 @Override | |
57 protected String getJasperFile() { | |
9539 | 58 throw new UnsupportedOperationException(); |
9331 | 59 } |
60 | |
61 protected String[] formatRow(final AbstractExportContext exportContext, final ResultRow row) { | |
62 | |
9535
3fa8551c3d1b
Fixed error in bundu bzws missing volume calculation for mean bed height;
mschaefer
parents:
9455
diff
changeset
|
63 final Collection<String> lines = new ArrayList<>(44); |
9331 | 64 |
65 lines.add(exportContext.formatRowValue(row, GeneralResultType.station)); | |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
66 @SuppressWarnings("unchecked") |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
67 final List<Double> vFields = (List<Double>) row.getValue(BunduResultType.missVolumeFields); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
68 assert (vFields.size() == fieldSize()); // immer abgleichen mit der Calculation! |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
69 @SuppressWarnings("unchecked") |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
70 final List<Double> mFields = (List<Double>) row.getValue(BunduResultType.missMassFields); |
9448 | 71 assert (vFields.size() == mFields.size()); |
9535
3fa8551c3d1b
Fixed error in bundu bzws missing volume calculation for mean bed height;
mschaefer
parents:
9455
diff
changeset
|
72 @SuppressWarnings("unchecked") |
3fa8551c3d1b
Fixed error in bundu bzws missing volume calculation for mean bed height;
mschaefer
parents:
9455
diff
changeset
|
73 final List<Double> hFields = (List<Double>) row.getValue(BunduResultType.bedHeightFields); |
3fa8551c3d1b
Fixed error in bundu bzws missing volume calculation for mean bed height;
mschaefer
parents:
9455
diff
changeset
|
74 @SuppressWarnings("unchecked") |
3fa8551c3d1b
Fixed error in bundu bzws missing volume calculation for mean bed height;
mschaefer
parents:
9455
diff
changeset
|
75 final List<Double> dFields = (List<Double>) row.getValue(BunduResultType.depthFields); |
9448 | 76 for (int i = 0; i < vFields.size(); i++) { |
9535
3fa8551c3d1b
Fixed error in bundu bzws missing volume calculation for mean bed height;
mschaefer
parents:
9455
diff
changeset
|
77 lines.add(BunduResultType.bedHeightFields.exportValue(exportContext.getContext(), hFields.get(i))); |
3fa8551c3d1b
Fixed error in bundu bzws missing volume calculation for mean bed height;
mschaefer
parents:
9455
diff
changeset
|
78 lines.add(BunduResultType.depthFields.exportValue(exportContext.getContext(), dFields.get(i))); |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
79 lines.add(BunduResultType.missVolumeFields.exportValue(exportContext.getContext(), vFields.get(i))); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
80 lines.add(BunduResultType.missMassFields.exportValue(exportContext.getContext(), mFields.get(i))); |
9331 | 81 } |
9535
3fa8551c3d1b
Fixed error in bundu bzws missing volume calculation for mean bed height;
mschaefer
parents:
9455
diff
changeset
|
82 lines.add(exportContext.formatRowValue(row, BunduResultType.heightMeanBed)); |
3fa8551c3d1b
Fixed error in bundu bzws missing volume calculation for mean bed height;
mschaefer
parents:
9455
diff
changeset
|
83 lines.add(exportContext.formatRowValue(row, BunduResultType.flowdepthMeanBed)); |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9332
diff
changeset
|
84 lines.add(exportContext.formatRowValue(row, BunduResultType.missVolumeMeanBed)); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9332
diff
changeset
|
85 lines.add(exportContext.formatRowValue(row, BunduResultType.missMassMeanBed)); |
9331 | 86 |
87 return lines.toArray(new String[lines.size()]); | |
88 } | |
89 | |
90 @Override | |
91 public void writeCSVHeader(final ExportContextCSV exportContextCSV, final RiverInfo river) { | |
92 | |
9535
3fa8551c3d1b
Fixed error in bundu bzws missing volume calculation for mean bed height;
mschaefer
parents:
9455
diff
changeset
|
93 final int colSize = 4 * fieldSize() + 3; |
9331 | 94 exportContextCSV.writeTitleForTabs("bundu.export.csv.title.bezugswst.result2", colSize); // Voraussetzung für Tabs ist, dass der Titel vor den Headern |
95 final Collection<String> header = new ArrayList<>(colSize); | |
96 | |
97 header.add(exportContextCSV.formatCsvHeader(GeneralResultType.station)); | |
98 | |
9535
3fa8551c3d1b
Fixed error in bundu bzws missing volume calculation for mean bed height;
mschaefer
parents:
9455
diff
changeset
|
99 for (int i = 1, j = 1; i <= fieldSize() * 4; i += 4, j++) { |
3fa8551c3d1b
Fixed error in bundu bzws missing volume calculation for mean bed height;
mschaefer
parents:
9455
diff
changeset
|
100 header.add(exportContextCSV.msg(fieldBedheightMsgKey, j) + " [" + river.getWstUnit() + "]"); |
3fa8551c3d1b
Fixed error in bundu bzws missing volume calculation for mean bed height;
mschaefer
parents:
9455
diff
changeset
|
101 header.add(exportContextCSV.msg(fieldFlowdepthMsgKey, j)); |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
102 header.add(exportContextCSV.msg(fieldVolumeMsgKey, j)); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
103 header.add(exportContextCSV.msg(fieldMassMsgKey, j)); |
9331 | 104 } |
9535
3fa8551c3d1b
Fixed error in bundu bzws missing volume calculation for mean bed height;
mschaefer
parents:
9455
diff
changeset
|
105 header.add(exportContextCSV.formatCsvHeader(BunduResultType.heightMeanBed) + " [" + river.getWstUnit() + "]"); |
3fa8551c3d1b
Fixed error in bundu bzws missing volume calculation for mean bed height;
mschaefer
parents:
9455
diff
changeset
|
106 header.add(exportContextCSV.formatCsvHeader(BunduResultType.flowdepthMeanBed)); |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9332
diff
changeset
|
107 header.add(exportContextCSV.formatCsvHeader(BunduResultType.missVolumeMeanBed)); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9332
diff
changeset
|
108 header.add(exportContextCSV.formatCsvHeader(BunduResultType.missMassMeanBed)); |
9331 | 109 |
110 exportContextCSV.writeCSVLine(header.toArray(new String[header.size()])); | |
111 | |
112 } | |
113 | |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
114 /** |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
115 * Number of elements of the various field lists |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
116 */ |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
117 private int fieldSize() { |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
118 return BedHeightValueType.FIELD_LAST_INDEX - BedHeightValueType.FIELD_FIRST_INDEX + 1; |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
119 } |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
120 |
9331 | 121 @Override |
122 protected String[] formatCSVRow(final ExportContextCSV exportContextCSV, final ResultRow row) { | |
123 | |
124 return this.formatRow(exportContextCSV, row); | |
125 } | |
126 | |
127 @Override | |
128 protected String[] formatPDFRow(final ExportContextPDF exportContextPDF, final ResultRow row) { | |
9539 | 129 throw new UnsupportedOperationException(); |
9331 | 130 } |
131 | |
132 @Override | |
9539 | 133 protected void addJRTableHeader(final ExportContextPDF exportContext, final MetaAndTableJRDataSource source) { |
134 throw new UnsupportedOperationException(); | |
135 } | |
9331 | 136 |
137 } |