Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstMissVolCalculationResult1.java @ 9330:0a0937f33bb5
bundu.bezugswst first result for missing volume added
author | gernotbelger |
---|---|
date | Fri, 27 Jul 2018 17:19:27 +0200 |
parents | |
children | 127638669052 |
comparison
equal
deleted
inserted
replaced
9329:6a7758923762 | 9330:0a0937f33bb5 |
---|---|
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.ExportContextCSV; | |
18 import org.dive4elements.river.artifacts.common.ExportContextPDF; | |
19 import org.dive4elements.river.artifacts.common.GeneralResultType; | |
20 import org.dive4elements.river.artifacts.common.IExportContext; | |
21 import org.dive4elements.river.artifacts.common.MetaAndTableJRDataSource; | |
22 import org.dive4elements.river.artifacts.common.ResultRow; | |
23 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; | |
24 | |
25 /** | |
26 * Contains the results of a //TODO LINK{@link BezugswstCalculation}. | |
27 * | |
28 * @author Gernot Belger | |
29 */ | |
30 final class BezugswstMissVolCalculationResult1 extends AbstractCalculationExportableResult { | |
31 | |
32 private static final long serialVersionUID = 1L; | |
33 | |
34 private static final String JASPER_FILE = "/jasper/templates/bundu.bezugswst.result1.jrxml"; | |
35 | |
36 public BezugswstMissVolCalculationResult1(final String label, final Collection<ResultRow> rows) { | |
37 super(label, rows); | |
38 | |
39 } | |
40 | |
41 @Override | |
42 protected void writeCSVResultMetadata(final ExportContextCSV exportContextCSV) { | |
43 // no metadata | |
44 } | |
45 | |
46 @Override | |
47 protected String getJasperFile() { | |
48 return JASPER_FILE; | |
49 } | |
50 | |
51 protected String[] formatRow(final IExportContext exportContext, final ResultRow row) { | |
52 | |
53 final Collection<String> lines = new ArrayList<>(10); | |
54 | |
55 lines.add(exportContext.formatRowValue(row, BunduResultType.bezugswst)); | |
56 lines.add(exportContext.formatRowValue(row, GeneralResultType.dischargeQwithUnit)); | |
57 lines.add(exportContext.formatRowValue(row, GeneralResultType.waterlevelLabel)); | |
58 lines.add(exportContext.formatRowValue(row, GeneralResultType.gaugeLabel)); | |
59 | |
60 lines.add(exportContext.formatRowValue(row, BunduResultType.sounding)); | |
61 lines.add(exportContext.formatRowValue(row, BunduResultType.channelLowerEdge)); | |
62 lines.add(exportContext.formatRowValue(row, BunduResultType.channelMinDepth)); | |
63 lines.add(exportContext.formatRowValue(row, BunduResultType.hasMissingDepth)); | |
64 lines.add(exportContext.formatRowValue(row, BunduResultType.missVolume)); | |
65 lines.add(exportContext.formatRowValue(row, BunduResultType.missMass)); | |
66 lines.add(exportContext.formatRowValue(row, BunduResultType.excavationVolume)); | |
67 lines.add(exportContext.formatRowValue(row, BunduResultType.excavationCosts)); | |
68 lines.add(exportContext.formatRowValue(row, BunduResultType.channelWidth)); | |
69 lines.add(exportContext.formatRowValue(row, BunduResultType.density)); | |
70 | |
71 lines.add(exportContext.formatRowValue(row, GeneralResultType.location)); | |
72 | |
73 return lines.toArray(new String[lines.size()]); | |
74 } | |
75 | |
76 @Override | |
77 public void writeCSVHeader(final ExportContextCSV exportContextCSV, final RiverInfo river) { | |
78 | |
79 final int colSize = 15; | |
80 exportContextCSV.writeTitleForTabs("bundu.export.csv.title.bezugswst.result1", colSize); // Voraussetzung für Tabs ist, dass der Titel vor den Headern | |
81 final Collection<String> header = new ArrayList<>(colSize); | |
82 | |
83 header.add(exportContextCSV.formatCsvHeader(BunduResultType.bezugswst) + " [" + river.getWstUnit() + "]"); | |
84 header.add(exportContextCSV.formatCsvHeader(GeneralResultType.dischargeQwithUnit)); | |
85 header.add(exportContextCSV.formatCsvHeader(GeneralResultType.waterlevelLabel)); | |
86 header.add(exportContextCSV.formatCsvHeader(GeneralResultType.gaugeLabel)); | |
87 | |
88 header.add(exportContextCSV.formatCsvHeader(BunduResultType.sounding)); | |
89 header.add(exportContextCSV.formatCsvHeader(BunduResultType.channelLowerEdge)); | |
90 header.add(exportContextCSV.formatCsvHeader(BunduResultType.channelMinDepth)); | |
91 header.add(exportContextCSV.formatCsvHeader(BunduResultType.hasMissingDepth)); | |
92 header.add(exportContextCSV.formatCsvHeader(BunduResultType.missVolume)); | |
93 header.add(exportContextCSV.formatCsvHeader(BunduResultType.missMass)); | |
94 header.add(exportContextCSV.formatCsvHeader(BunduResultType.excavationVolume)); | |
95 header.add(exportContextCSV.formatCsvHeader(BunduResultType.excavationCosts)); | |
96 header.add(exportContextCSV.formatCsvHeader(BunduResultType.channelWidth)); | |
97 header.add(exportContextCSV.formatCsvHeader(BunduResultType.density)); | |
98 | |
99 header.add(exportContextCSV.formatCsvHeader(GeneralResultType.location)); | |
100 | |
101 exportContextCSV.writeCSVLine(header.toArray(new String[header.size()])); | |
102 | |
103 } | |
104 | |
105 @Override | |
106 protected String[] formatCSVRow(final ExportContextCSV exportContextCSV, final ResultRow row) { | |
107 | |
108 return this.formatRow(exportContextCSV, row); | |
109 } | |
110 | |
111 @Override | |
112 protected String[] formatPDFRow(final ExportContextPDF exportContextPDF, final ResultRow row) { | |
113 | |
114 return this.formatRow(exportContextPDF, row); | |
115 } | |
116 | |
117 @Override | |
118 protected void addJRTableHeader(final ExportContextPDF exportContextPDF, final MetaAndTableJRDataSource source) { | |
119 /* column headings */ | |
120 | |
121 exportContextPDF.addJRMetadata(source, "bezugswst_header", BunduResultType.bezugswst); | |
122 exportContextPDF.addJRMetadata(source, "discharge_header", GeneralResultType.dischargeQwithUnit); | |
123 exportContextPDF.addJRMetadata(source, "waterlevel_name_header", GeneralResultType.waterlevelLabel); | |
124 exportContextPDF.addJRMetadata(source, "gauge_header", GeneralResultType.gaugeLabel); | |
125 | |
126 exportContextPDF.addJRMetadata(source, "sounding_header", BunduResultType.sounding); | |
127 exportContextPDF.addJRMetadata(source, "channel_lower_edge_header", BunduResultType.channelLowerEdge); | |
128 exportContextPDF.addJRMetadata(source, "channel_min_depth_header", BunduResultType.channelMinDepth); | |
129 exportContextPDF.addJRMetadata(source, "channel_miss_depth_header", BunduResultType.hasMissingDepth); | |
130 exportContextPDF.addJRMetadata(source, "channel_miss_volume_header", BunduResultType.missVolume); | |
131 exportContextPDF.addJRMetadata(source, "channel_miss_mass_header", BunduResultType.missMass); | |
132 exportContextPDF.addJRMetadata(source, "excavation_volume_header", BunduResultType.excavationVolume); | |
133 exportContextPDF.addJRMetadata(source, "excavation_costs_header", BunduResultType.excavationCosts); | |
134 exportContextPDF.addJRMetadata(source, "channel_width_header", BunduResultType.channelWidth); | |
135 exportContextPDF.addJRMetadata(source, "density_header", BunduResultType.density); | |
136 | |
137 exportContextPDF.addJRMetadata(source, "location_header", GeneralResultType.location); | |
138 | |
139 } | |
140 } |