Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthdev/FlowDepthDevelopmentCalculationResult.java @ 9195:a4121ec450d6
'ca.'-issue
ExportContextCSV+PDF separated
uinfo.inundationduration url export
author | gernotbelger |
---|---|
date | Fri, 29 Jun 2018 14:52:54 +0200 |
parents | 23945061daec |
children | 740d65e4aa14 |
comparison
equal
deleted
inserted
replaced
9191:f692f5a0536a | 9195:a4121ec450d6 |
---|---|
12 import java.util.ArrayList; | 12 import java.util.ArrayList; |
13 import java.util.Collection; | 13 import java.util.Collection; |
14 | 14 |
15 import org.dive4elements.river.artifacts.common.AbstractCalculationExportableResult; | 15 import org.dive4elements.river.artifacts.common.AbstractCalculationExportableResult; |
16 import org.dive4elements.river.artifacts.common.ExportContextCSV; | 16 import org.dive4elements.river.artifacts.common.ExportContextCSV; |
17 import org.dive4elements.river.artifacts.common.ExportContextPDF; | |
17 import org.dive4elements.river.artifacts.common.GeneralResultType; | 18 import org.dive4elements.river.artifacts.common.GeneralResultType; |
19 import org.dive4elements.river.artifacts.common.IExportContext; | |
18 import org.dive4elements.river.artifacts.common.MetaAndTableJRDataSource; | 20 import org.dive4elements.river.artifacts.common.MetaAndTableJRDataSource; |
19 import org.dive4elements.river.artifacts.common.ResultRow; | 21 import org.dive4elements.river.artifacts.common.ResultRow; |
20 import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType; | 22 import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType; |
21 import org.dive4elements.river.artifacts.sinfo.util.BedHeightInfo; | 23 import org.dive4elements.river.artifacts.sinfo.util.BedHeightInfo; |
22 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; | 24 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; |
25 /** | 27 /** |
26 * Contains the results of a {@link FloodDurationCalculation}. | 28 * Contains the results of a {@link FloodDurationCalculation}. |
27 * | 29 * |
28 * @author Gernot Belger | 30 * @author Gernot Belger |
29 */ | 31 */ |
30 final class FlowDepthDevelopmentCalculationResult extends AbstractCalculationExportableResult<FlowDepthDevelopmentCalculationResults> { | 32 final class FlowDepthDevelopmentCalculationResult extends AbstractCalculationExportableResult { |
31 | 33 |
32 private static final long serialVersionUID = 1L; | 34 private static final long serialVersionUID = 1L; |
33 | 35 |
34 private static final String CSV_META_HEADER_SOUNDING_CURRENT = "sinfo.export.csv.meta.header.sounding.current"; | 36 private static final String CSV_META_HEADER_SOUNDING_CURRENT = "sinfo.export.csv.meta.header.sounding.current"; |
35 | 37 |
107 append(this.historicalSounding.getDescription()). // | 109 append(this.historicalSounding.getDescription()). // |
108 toString(); | 110 toString(); |
109 } | 111 } |
110 | 112 |
111 @Override | 113 @Override |
112 protected void writeCSVResultMetadata(final ExportContextCSV exportContextCSV, final FlowDepthDevelopmentCalculationResults results) { | 114 protected void writeCSVResultMetadata(final ExportContextCSV exportContextCSV) { |
113 | 115 |
114 exportContextCSV.writeCSVSoundingMetadata(getCurrentSounding(), CSV_META_HEADER_SOUNDING_CURRENT); | 116 exportContextCSV.writeCSVSoundingMetadata(getCurrentSounding(), CSV_META_HEADER_SOUNDING_CURRENT); |
115 exportContextCSV.writeBlankLine(); | 117 exportContextCSV.writeBlankLine(); |
116 exportContextCSV.writeCSVWaterlevelMetadata(getCurrentWst(), CSV_META_HEADER_WATERLEVEL_CURRENT); | 118 exportContextCSV.writeCSVWaterlevelMetadata(getCurrentWst(), CSV_META_HEADER_WATERLEVEL_CURRENT); |
117 exportContextCSV.writeBlankLine(); | 119 exportContextCSV.writeBlankLine(); |
125 @Override | 127 @Override |
126 protected String getJasperFile() { | 128 protected String getJasperFile() { |
127 return JASPER_FILE; | 129 return JASPER_FILE; |
128 } | 130 } |
129 | 131 |
130 protected String[] formatRow(final ExportContextCSV exportContextCSV, final FlowDepthDevelopmentCalculationResults results, final ResultRow row) { | 132 protected String[] formatRow(final IExportContext exportContext, final ResultRow row) { |
131 | 133 |
132 final Collection<String> lines = new ArrayList<>(10); | 134 final Collection<String> lines = new ArrayList<>(10); |
133 | 135 |
134 lines.add(exportContextCSV.formatRowValue(row, GeneralResultType.station)); | 136 lines.add(exportContext.formatRowValue(row, GeneralResultType.station)); |
135 lines.add(exportContextCSV.formatRowValue(row, SInfoResultType.flowdepthDevelopment)); | 137 lines.add(exportContext.formatRowValue(row, SInfoResultType.flowdepthDevelopment)); |
136 lines.add(exportContextCSV.formatRowValue(row, SInfoResultType.flowdepthDevelopmentPerYear)); | 138 lines.add(exportContext.formatRowValue(row, SInfoResultType.flowdepthDevelopmentPerYear)); |
137 lines.add(exportContextCSV.formatRowValue(row, SInfoResultType.waterlevelDifference)); | 139 lines.add(exportContext.formatRowValue(row, SInfoResultType.waterlevelDifference)); |
138 lines.add(exportContextCSV.formatRowValue(row, SInfoResultType.bedHeightDifference)); | 140 lines.add(exportContext.formatRowValue(row, SInfoResultType.bedHeightDifference)); |
139 lines.add(exportContextCSV.formatRowValue(row, SInfoResultType.flowdepthCurrent)); | 141 lines.add(exportContext.formatRowValue(row, SInfoResultType.flowdepthCurrent)); |
140 lines.add(exportContextCSV.formatRowValue(row, SInfoResultType.flowdepthHistorical)); | 142 lines.add(exportContext.formatRowValue(row, SInfoResultType.flowdepthHistorical)); |
141 lines.add(exportContextCSV.formatRowValue(row, SInfoResultType.location)); | 143 lines.add(exportContext.formatRowValue(row, SInfoResultType.location)); |
142 | 144 |
143 return lines.toArray(new String[lines.size()]); | 145 return lines.toArray(new String[lines.size()]); |
144 } | 146 } |
145 | 147 |
146 @Override | 148 @Override |
147 public void writeCSVHeader(final ExportContextCSV exportContextCSV, final FlowDepthDevelopmentCalculationResults results, final RiverInfo river) { | 149 public void writeCSVHeader(final ExportContextCSV exportContextCSV, final RiverInfo river) { |
148 | 150 |
149 final Collection<String> header = new ArrayList<>(11); | 151 final Collection<String> header = new ArrayList<>(11); |
150 | 152 |
151 header.add(exportContextCSV.formatCsvHeader(GeneralResultType.station)); | 153 header.add(exportContextCSV.formatCsvHeader(GeneralResultType.station)); |
152 header.add(exportContextCSV.msgUnitCSV(SInfoResultType.flowdepthDevelopment, SInfoResultType.flowdepthDevelopment.getUnit())); | 154 header.add(exportContextCSV.msgUnitCSV(SInfoResultType.flowdepthDevelopment, SInfoResultType.flowdepthDevelopment.getUnit())); |
160 exportContextCSV.writeCSVLine(header.toArray(new String[header.size()])); | 162 exportContextCSV.writeCSVLine(header.toArray(new String[header.size()])); |
161 | 163 |
162 } | 164 } |
163 | 165 |
164 @Override | 166 @Override |
165 protected String[] formatCSVRow(final ExportContextCSV exportContextCSV, final FlowDepthDevelopmentCalculationResults results, final ResultRow row) { | 167 protected String[] formatCSVRow(final ExportContextCSV exportContextCSV, final ResultRow row) { |
166 | 168 |
167 return this.formatRow(exportContextCSV, results, row); | 169 return this.formatRow(exportContextCSV, row); |
168 } | 170 } |
169 | 171 |
170 @Override | 172 @Override |
171 protected String[] formatPDFRow(final ExportContextCSV exportContextPDF, final FlowDepthDevelopmentCalculationResults results, final ResultRow row) { | 173 protected String[] formatPDFRow(final ExportContextPDF exportContextPDF, final ResultRow row) { |
172 | 174 |
173 return this.formatRow(exportContextPDF, results, row); | 175 return this.formatRow(exportContextPDF, row); |
174 } | 176 } |
175 | 177 |
176 @Override | 178 @Override |
177 protected void addJRTableHeader(final ExportContextCSV exportContextPDF, final MetaAndTableJRDataSource source, | 179 protected void addJRTableHeader(final ExportContextPDF exportContextPDF, final MetaAndTableJRDataSource source) { |
178 final FlowDepthDevelopmentCalculationResults results) { | |
179 /* column headings */ | 180 /* column headings */ |
180 exportContextPDF.addJRMetadata(source, "station_header", GeneralResultType.station); | 181 exportContextPDF.addJRMetadata(source, "station_header", GeneralResultType.station); |
181 exportContextPDF.addJRMetadata(source, "flowdepthdevelopment_header", SInfoResultType.flowdepthDevelopment); | 182 exportContextPDF.addJRMetadata(source, "flowdepthdevelopment_header", SInfoResultType.flowdepthDevelopment); |
182 exportContextPDF.addJRMetadata(source, "flowdepthdevelopmentperyear_header", SInfoResultType.flowdepthDevelopmentPerYear); | 183 exportContextPDF.addJRMetadata(source, "flowdepthdevelopmentperyear_header", SInfoResultType.flowdepthDevelopmentPerYear); |
183 | 184 |