Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstMissVolCalculationResult3.java @ 9432:d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
author | mschaefer |
---|---|
date | Mon, 20 Aug 2018 09:46:02 +0200 |
parents | c64de8cc4e97 |
children | ecadc9ed0ba0 |
rev | line source |
---|---|
9332 | 1 /* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde |
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 | |
52 final Collection<String> lines = new ArrayList<>(20); | |
53 | |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9332
diff
changeset
|
54 lines.add(exportContext.formatRowValue(row, BunduResultType.missStationRange)); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9332
diff
changeset
|
55 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
|
56 lines.add(exportContext.formatRowValue(row, BunduResultType.missMassTotal)); |
9332 | 57 return lines.toArray(new String[lines.size()]); |
58 } | |
59 | |
60 @Override | |
61 public void writeCSVHeader(final ExportContextCSV exportContextCSV, final RiverInfo river) { | |
62 | |
63 final int colSize = 3; | |
64 exportContextCSV.writeTitleForTabs("bundu.export.csv.title.bezugswst.result3", colSize); // Voraussetzung für Tabs ist, dass der Titel vor den Headern | |
65 final Collection<String> header = new ArrayList<>(colSize); | |
66 | |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9332
diff
changeset
|
67 header.add(exportContextCSV.formatCsvHeader(BunduResultType.missStationRange)); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9332
diff
changeset
|
68 header.add(exportContextCSV.formatCsvHeader(BunduResultType.missVolumeTotal)); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9332
diff
changeset
|
69 header.add(exportContextCSV.formatCsvHeader(BunduResultType.missMassTotal)); |
9332 | 70 |
71 exportContextCSV.writeCSVLine(header.toArray(new String[header.size()])); | |
72 | |
73 } | |
74 | |
75 @Override | |
76 protected String[] formatCSVRow(final ExportContextCSV exportContextCSV, final ResultRow row) { | |
77 | |
78 return this.formatRow(exportContextCSV, row); | |
79 } | |
80 | |
81 @Override | |
82 protected String[] formatPDFRow(final ExportContextPDF exportContextPDF, final ResultRow row) { | |
83 | |
84 return this.formatRow(exportContextPDF, row); | |
85 } | |
86 | |
87 @Override | |
88 protected void addJRTableHeader(final ExportContextPDF exportContextPDF, final MetaAndTableJRDataSource source) { | |
89 /* column headings */ | |
90 | |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9332
diff
changeset
|
91 exportContextPDF.addJRMetadata(source, "station_header", BunduResultType.missStationRange); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9332
diff
changeset
|
92 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
|
93 exportContextPDF.addJRMetadata(source, "channel_miss_mass_header", BunduResultType.missMassTotal); |
9332 | 94 |
95 } | |
96 } |