Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstMissVolCalculationResult3.java @ 9452:af163ce96eb4
pdf export result 3 miss vol
author | gernotbelger |
---|---|
date | Thu, 23 Aug 2018 11:01:54 +0200 |
parents | e60584f2a531 |
children | 3fa8551c3d1b |
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 |
9332 | 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 | |
15 import org.dive4elements.river.artifacts.bundu.BunduResultType; | |
16 import org.dive4elements.river.artifacts.common.AbstractCalculationExportableResult; | |
17 import org.dive4elements.river.artifacts.common.AbstractExportContext; | |
18 import org.dive4elements.river.artifacts.common.ExportContextCSV; | |
19 import org.dive4elements.river.artifacts.common.ExportContextPDF; | |
20 import org.dive4elements.river.artifacts.common.MetaAndTableJRDataSource; | |
21 import org.dive4elements.river.artifacts.common.ResultRow; | |
22 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; | |
23 | |
24 /** | |
25 * Contains the results of a //TODO LINK{@link BezugswstCalculation}. | |
26 * | |
27 * @author Gernot Belger | |
28 */ | |
29 final class BezugswstMissVolCalculationResult3 extends AbstractCalculationExportableResult implements BunduWstExporter.MissResultType { | |
30 | |
31 private static final long serialVersionUID = 1L; | |
32 | |
33 private static final String JASPER_FILE = "/jasper/templates/bundu.bezugswst.result3.jrxml"; | |
34 | |
35 public BezugswstMissVolCalculationResult3(final String label, final Collection<ResultRow> rows) { | |
36 super(label, rows); | |
37 | |
38 } | |
39 | |
40 @Override | |
41 protected void writeCSVResultMetadata(final ExportContextCSV exportContextCSV) { | |
42 // no metadata | |
43 } | |
44 | |
45 @Override | |
46 protected String getJasperFile() { | |
47 return JASPER_FILE; | |
48 } | |
49 | |
50 protected String[] formatRow(final AbstractExportContext exportContext, final ResultRow row) { | |
51 | |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
52 final Collection<String> lines = new ArrayList<>(4); |
9332 | 53 |
9444
ecadc9ed0ba0
Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents:
9432
diff
changeset
|
54 lines.add(exportContext.formatRowValue(row, BunduResultType.missStationRangeFrom)); |
ecadc9ed0ba0
Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents:
9432
diff
changeset
|
55 lines.add(exportContext.formatRowValue(row, BunduResultType.missStationRangeTo)); |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9332
diff
changeset
|
56 lines.add(exportContext.formatRowValue(row, BunduResultType.missVolumeTotal)); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9332
diff
changeset
|
57 lines.add(exportContext.formatRowValue(row, BunduResultType.missMassTotal)); |
9332 | 58 return lines.toArray(new String[lines.size()]); |
59 } | |
60 | |
61 @Override | |
62 public void writeCSVHeader(final ExportContextCSV exportContextCSV, final RiverInfo river) { | |
63 | |
9444
ecadc9ed0ba0
Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents:
9432
diff
changeset
|
64 final int colSize = 4; |
9332 | 65 exportContextCSV.writeTitleForTabs("bundu.export.csv.title.bezugswst.result3", colSize); // Voraussetzung für Tabs ist, dass der Titel vor den Headern |
66 final Collection<String> header = new ArrayList<>(colSize); | |
67 | |
9444
ecadc9ed0ba0
Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents:
9432
diff
changeset
|
68 header.add(exportContextCSV.formatCsvHeader(BunduResultType.missStationRangeFrom)); |
ecadc9ed0ba0
Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents:
9432
diff
changeset
|
69 header.add(exportContextCSV.formatCsvHeader(BunduResultType.missStationRangeTo)); |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9332
diff
changeset
|
70 header.add(exportContextCSV.formatCsvHeader(BunduResultType.missVolumeTotal)); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9332
diff
changeset
|
71 header.add(exportContextCSV.formatCsvHeader(BunduResultType.missMassTotal)); |
9332 | 72 |
73 exportContextCSV.writeCSVLine(header.toArray(new String[header.size()])); | |
74 | |
75 } | |
76 | |
77 @Override | |
78 protected String[] formatCSVRow(final ExportContextCSV exportContextCSV, final ResultRow row) { | |
79 | |
80 return this.formatRow(exportContextCSV, row); | |
81 } | |
82 | |
83 @Override | |
84 protected String[] formatPDFRow(final ExportContextPDF exportContextPDF, final ResultRow row) { | |
85 | |
86 return this.formatRow(exportContextPDF, row); | |
87 } | |
88 | |
89 @Override | |
90 protected void addJRTableHeader(final ExportContextPDF exportContextPDF, final MetaAndTableJRDataSource source) { | |
91 /* column headings */ | |
92 | |
9452 | 93 exportContextPDF.addJRMetadata(source, "station_from_header", BunduResultType.missStationRangeFrom); |
94 exportContextPDF.addJRMetadata(source, "station_to_header", BunduResultType.missStationRangeTo); | |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9332
diff
changeset
|
95 exportContextPDF.addJRMetadata(source, "channel_miss_volume_header", BunduResultType.missVolumeTotal); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9332
diff
changeset
|
96 exportContextPDF.addJRMetadata(source, "channel_miss_mass_header", BunduResultType.missMassTotal); |
9332 | 97 |
98 } | |
99 } |