Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstCalculationResult.java @ 9313:6ffcbb4f35d5
bundu.bezugswst first result stump
author | gernotbelger |
---|---|
date | Thu, 26 Jul 2018 15:58:08 +0200 |
parents | |
children | 7b2b086e45f0 |
comparison
equal
deleted
inserted
replaced
9312:740d65e4aa14 | 9313:6ffcbb4f35d5 |
---|---|
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.common.AbstractCalculationExportableResult; | |
16 import org.dive4elements.river.artifacts.common.ExportContextCSV; | |
17 import org.dive4elements.river.artifacts.common.ExportContextPDF; | |
18 import org.dive4elements.river.artifacts.common.GeneralResultType; | |
19 import org.dive4elements.river.artifacts.common.IExportContext; | |
20 import org.dive4elements.river.artifacts.common.MetaAndTableJRDataSource; | |
21 import org.dive4elements.river.artifacts.common.ResultRow; | |
22 import org.dive4elements.river.artifacts.sinfo.util.BedHeightInfo; | |
23 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; | |
24 import org.dive4elements.river.artifacts.sinfo.util.WstInfo; | |
25 | |
26 /** | |
27 * Contains the results of a //TODO LINK{@link BezugswstCalculation}. | |
28 * | |
29 * @author Gernot Belger | |
30 */ | |
31 final class BezugswstCalculationResult extends AbstractCalculationExportableResult { | |
32 | |
33 private static final long serialVersionUID = 1L; | |
34 | |
35 private static final String JASPER_FILE = "/jasper/templates/bundu.bezugswst.jrxml"; | |
36 | |
37 private final WstInfo wst = null; | |
38 private final BedHeightInfo sounding = null; | |
39 | |
40 public BezugswstCalculationResult(final String label, final Collection<ResultRow> rows // , final BedHeightInfo sounding // ,final WstInfo wst | |
41 ) { | |
42 super(label, rows); | |
43 // this.wst = this.wst; //TODO get Peilung and Wasserstand | |
44 // this.sounding = sounding; | |
45 } | |
46 | |
47 @Override | |
48 protected void writeCSVResultMetadata(final ExportContextCSV exportContextCSV) { | |
49 | |
50 // exportContextCSV.writeCSVSoundingMetadata(this.sounding, " "); | |
51 // exportContextCSV.writeBlankLine(); | |
52 // exportContextCSV.writeCSVWaterlevelMetadata(wst); | |
53 // exportContextCSV.writeBlankLine(); | |
54 } | |
55 | |
56 @Override | |
57 protected String getJasperFile() { | |
58 return JASPER_FILE; | |
59 } | |
60 | |
61 protected String[] formatRow(final IExportContext exportContext, final ResultRow row) { | |
62 | |
63 final Collection<String> lines = new ArrayList<>(10); | |
64 | |
65 lines.add(exportContext.formatRowValue(row, GeneralResultType.station)); | |
66 lines.add(exportContext.formatRowValue(row, GeneralResultType.dischargeQwithUnit)); | |
67 // lines.add(exportContext.formatRowValue(row, SInfoResultType.flowdepthDevelopment)); | |
68 | |
69 lines.add(exportContext.formatRowValue(row, GeneralResultType.location)); | |
70 | |
71 return lines.toArray(new String[lines.size()]); | |
72 } | |
73 | |
74 @Override | |
75 public void writeCSVHeader(final ExportContextCSV exportContextCSV, final RiverInfo river) { | |
76 | |
77 final Collection<String> header = new ArrayList<>(11); | |
78 | |
79 header.add(exportContextCSV.formatCsvHeader(GeneralResultType.station)); | |
80 header.add(exportContextCSV.formatCsvHeader(GeneralResultType.dischargeQwithUnit)); | |
81 // header.add(exportContextCSV.msgUnitCSV(SInfoResultType.flowdepthDevelopment, | |
82 // SInfoResultType.flowdepthDevelopment.getUnit())); | |
83 // header.add(exportContextCSV.msgUnitCSV(SInfoResultType.flowdepthDevelopmentPerYear, | |
84 // SInfoResultType.flowdepthDevelopmentPerYear.getUnit())); | |
85 header.add(exportContextCSV.formatCsvHeader(GeneralResultType.location)); | |
86 | |
87 exportContextCSV.writeCSVLine(header.toArray(new String[header.size()])); | |
88 | |
89 } | |
90 | |
91 @Override | |
92 protected String[] formatCSVRow(final ExportContextCSV exportContextCSV, final ResultRow row) { | |
93 | |
94 return this.formatRow(exportContextCSV, row); | |
95 } | |
96 | |
97 @Override | |
98 protected String[] formatPDFRow(final ExportContextPDF exportContextPDF, final ResultRow row) { | |
99 | |
100 return this.formatRow(exportContextPDF, row); | |
101 } | |
102 | |
103 @Override | |
104 protected void addJRTableHeader(final ExportContextPDF exportContextPDF, final MetaAndTableJRDataSource source) { | |
105 /* column headings */ | |
106 exportContextPDF.addJRMetadata(source, "station_header", GeneralResultType.station); | |
107 exportContextPDF.addJRMetadata(source, "TODO_MAKE_JASPER_REPORT...", GeneralResultType.dischargeQwithUnit); | |
108 // exportContextPDF.addJRMetadata(source, "flowdepthdevelopment_header", SInfoResultType.flowdepthDevelopment); | |
109 // exportContextPDF.addJRMetadata(source, "flowdepthdevelopmentperyear_header", | |
110 // SInfoResultType.flowdepthDevelopmentPerYear); | |
111 | |
112 exportContextPDF.addJRMetadata(source, "location_header", GeneralResultType.location); | |
113 | |
114 } | |
115 } |