8854
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
|
2 * Software engineering by Intevation GmbH |
|
3 * |
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
|
6 * documentation coming with Dive4Elements River for details. |
|
7 */ |
|
8 |
|
9 package org.dive4elements.river.artifacts.sinfo.flowdepth; |
|
10 |
|
11 import java.io.OutputStream; |
|
12 import java.text.DateFormat; |
8894
|
13 import java.text.NumberFormat; |
8854
|
14 import java.util.ArrayList; |
|
15 import java.util.Collection; |
|
16 import java.util.Date; |
|
17 import java.util.HashMap; |
|
18 import java.util.Locale; |
|
19 import java.util.Map; |
|
20 |
8877
|
21 import org.apache.commons.lang.StringUtils; |
8894
|
22 import org.apache.commons.lang.math.DoubleRange; |
8854
|
23 import org.apache.log4j.Logger; |
|
24 import org.dive4elements.artifacts.CallMeta; |
|
25 import org.dive4elements.artifacts.common.utils.Config; |
8863
|
26 import org.dive4elements.river.FLYS; |
8854
|
27 import org.dive4elements.river.artifacts.model.CalculationResult; |
|
28 import org.dive4elements.river.artifacts.resources.Resources; |
8894
|
29 import org.dive4elements.river.artifacts.sinfo.util.BedHeightInfo; |
8854
|
30 import org.dive4elements.river.artifacts.sinfo.util.MetaAndTableJRDataSource; |
8894
|
31 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; |
|
32 import org.dive4elements.river.artifacts.sinfo.util.WstInfo; |
8854
|
33 import org.dive4elements.river.exports.AbstractExporter; |
8882
|
34 import org.dive4elements.river.utils.RiverUtils; |
8854
|
35 |
|
36 import au.com.bytecode.opencsv.CSVWriter; |
|
37 import net.sf.jasperreports.engine.JRDataSource; |
|
38 import net.sf.jasperreports.engine.JRException; |
|
39 import net.sf.jasperreports.engine.JasperExportManager; |
|
40 import net.sf.jasperreports.engine.JasperFillManager; |
|
41 import net.sf.jasperreports.engine.JasperPrint; |
|
42 |
|
43 /** |
|
44 * Generates different output formats (csv, pdf) of data that resulted from a flow depths computation. |
|
45 * |
|
46 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
|
47 * @author Gernot Belger |
|
48 */ |
|
49 // REMARK: must be public because its registered in generators.xml |
|
50 public class FlowDepthExporter extends AbstractExporter { |
|
51 |
8877
|
52 /** The log used in this exporter. */ |
8854
|
53 private static Logger log = Logger.getLogger(FlowDepthExporter.class); |
|
54 |
|
55 private static final String CSV_KM_HEADER = "sinfo.export.flow_depth.csv.header.km"; |
|
56 private static final String CSV_FLOWDEPTH_HEADER = "sinfo.export.flow_depth.csv.header.flowdepth"; |
|
57 private static final String CSV_FLOWDEPTHTKH_HEADER = "sinfo.export.flow_depth.csv.header.flowdepthTkh"; |
|
58 private static final String CSV_TKH_HEADER = "sinfo.export.flow_depth.csv.header.tkh"; |
|
59 private static final String CSV_WATERLEVEL_HEADER = "sinfo.export.flow_depth.csv.header.waterlevel"; |
|
60 private static final String CSV_DISCHARGE_HEADER = "sinfo.export.flow_depth.csv.header.discharge"; |
|
61 private static final String CSV_LABEL_HEADER = "sinfo.export.flow_depth.csv.header.label"; |
|
62 private static final String CSV_GAUGE_HEADER = "sinfo.export.flow_depth.csv.header.gauge"; |
|
63 private static final String CSV_MEAN_BED_HEIGHT_HEADER = "sinfo.export.flow_depth.csv.header.mean_bed_height"; |
8863
|
64 private static final String CSV_MEAN_BED_HEIGHT_HEADER_SHORT = "sinfo.export.flow_depth.csv.header.mean_bed_height.short"; |
8854
|
65 private static final String CSV_SOUNDING_HEADER = "sinfo.export.flow_depth.csv.header.sounding"; |
|
66 private static final String CSV_LOCATION_HEADER = "sinfo.export.flow_depth.csv.header.location"; |
|
67 |
8877
|
68 private static final String CSV_META_HEADER_RESULT = "sinfo.export.flow_depth.csv.meta.header.result"; |
8854
|
69 |
8877
|
70 private static final String CSV_META_HEADER_RESULT_LABEL = "sinfo.export.flow_depth.csv.meta.header.result.label"; |
8863
|
71 |
8877
|
72 private static final String CSV_META_VERSION = "sinfo.export.flow_depth.csv.meta.version"; |
|
73 |
|
74 private static final String CSV_META_VERSION_LABEL = "sinfo.export.flow_depth.csv.meta.version.label"; |
|
75 |
|
76 private static final String CSV_META_USER = "sinfo.export.flow_depth.csv.meta.user"; |
|
77 |
|
78 private static final String CSV_META_USER_LABEL = "sinfo.export.flow_depth.csv.meta.user.label"; |
|
79 |
|
80 private static final String CSV_META_CREATION = "sinfo.export.flow_depth.csv.meta.creation"; |
|
81 |
|
82 private static final String CSV_META_CREATION_LABEL = "sinfo.export.flow_depth.csv.meta.creation.label"; |
|
83 |
|
84 private static final String CSV_META_RIVER = "sinfo.export.flow_depth.csv.meta.river"; |
|
85 |
|
86 private static final String CSV_META_RIVER_LABEL = "sinfo.export.flow_depth.csv.meta.river.label"; |
|
87 |
|
88 private static final String CSV_META_HEADER_SOUNDING = "sinfo.export.flow_depth.csv.meta.header.sounding"; |
|
89 |
|
90 private static final String CSV_META_HEADER_SOUNDING_YEAR = "sinfo.export.flow_depth.csv.meta.header.sounding.year"; |
|
91 |
|
92 private static final String CSV_META_HEADER_SOUNDING_TYPE = "sinfo.export.flow_depth.csv.meta.header.sounding.type"; |
|
93 |
8882
|
94 private static final String CSV_META_HEADER_SOUNDING_EVALUATOR = "sinfo.export.flow_depth.csv.meta.header.sounding.evaluator"; |
|
95 |
8877
|
96 private static final String CSV_META_HEADER_SOUNDING_PRJ = "sinfo.export.flow_depth.csv.meta.header.sounding.prj"; |
|
97 |
|
98 private static final String CSV_META_HEADER_SOUNDING_ELEVATIOIN_MODEL = "sinfo.export.flow_depth.csv.meta.header.sounding.elevationmodel"; |
|
99 |
|
100 private static final String CSV_META_HEADER_SOUNDING_ELEVATIOIN_MODEL_ORIGINAL = "sinfo.export.flow_depth.csv.meta.header.sounding.elevationmodel.original"; |
|
101 |
|
102 private static final String CSV_META_HEADER_WATERLEVEL = "sinfo.export.flow_depth.csv.meta.header.waterlevel"; |
|
103 |
|
104 private static final String CSV_META_HEADER_WATERLEVEL_NAME = "sinfo.export.flow_depth.csv.meta.header.waterlevel.name"; |
|
105 |
|
106 private static final String CSV_META_HEADER_WATERLEVEL_GAUGE = "sinfo.export.flow_depth.csv.meta.header.waterlevel.gauge"; |
|
107 |
|
108 private static final String CSV_META_HEADER_WATERLEVEL_YEAR = "sinfo.export.flow_depth.csv.meta.header.waterlevel.year"; |
|
109 |
|
110 private static final String CSV_META_RANGE = "sinfo.export.flow_depth.csv.meta.range"; |
|
111 |
|
112 private static final String CSV_META_RANGE_LABEL = "sinfo.export.flow_depth.csv.meta.range.label"; |
|
113 |
8863
|
114 private static final String CSV_META_HEIGHT_UNIT_RIVER = "sinfo.export.flow_depth.csv.meta.height_unit.river"; |
8877
|
115 |
|
116 private static final String JASPER_FILE = "/jasper/sinfo.flowdepth.jasper"; |
8863
|
117 |
|
118 private static final String UNIT_M = "m"; |
|
119 |
|
120 private static final String UNIT_CM = "cm"; |
|
121 |
|
122 private static final String UNIT_CUBIC_M = "m³/s"; |
8854
|
123 |
8877
|
124 /** The storage that contains the current calculation result. */ |
8854
|
125 private FlowDepthCalculationResults data = null; |
|
126 |
8877
|
127 /** |
|
128 * Formats header with unit |
|
129 */ |
|
130 private String msgUnit(final String key, final String unit) { |
|
131 |
|
132 final String msg = msg(key); |
|
133 return String.format("%s [%s]", msg, unit); |
8863
|
134 } |
8877
|
135 |
8854
|
136 @Override |
8877
|
137 protected void addData(final Object d) { |
|
138 /* reset */ |
|
139 this.data = null; |
8854
|
140 |
|
141 if (d instanceof CalculationResult) { |
|
142 |
8877
|
143 final Object dat = ((CalculationResult) d).getData(); |
|
144 if (dat != null) |
|
145 this.data = (FlowDepthCalculationResults) dat; |
8854
|
146 } |
|
147 } |
8877
|
148 |
8854
|
149 @Override |
8877
|
150 protected void writeCSVData(final CSVWriter writer) { |
8854
|
151 log.info("FlowDepthExporter.writeCSVData"); |
|
152 |
|
153 /* fetch calculation results */ |
8877
|
154 final FlowDepthCalculationResults results = this.data; |
8854
|
155 |
8863
|
156 final boolean useTkh = results.isUseTkh(); |
8894
|
157 final RiverInfo river = results.getRiver(); |
8854
|
158 |
8863
|
159 /* write as csv */ |
8854
|
160 writeCSVMeta(writer, results); |
8863
|
161 writeCSVHeader(writer, river, useTkh); |
8854
|
162 |
|
163 for (final FlowDepthCalculationResult result : results.getResults()) { |
8877
|
164 writeCSVFlowDepthResult(writer, result, useTkh); |
|
165 } |
8854
|
166 } |
|
167 |
8884
|
168 private void writeCSVFlowDepthResult(final CSVWriter writer, final FlowDepthCalculationResult result, final boolean useTkh) { |
8877
|
169 |
|
170 /* first some specific metadata */ |
|
171 final BedHeightInfo sounding = result.getSounding(); |
|
172 final WstInfo wst = result.getWst(); |
|
173 |
|
174 // "##METADATEN PEILUNG" |
|
175 writeCSVMetaEntry(writer, CSV_META_HEADER_SOUNDING); |
|
176 |
|
177 // "# Jahr der Peilung: " |
|
178 writeCSVMetaEntry(writer, CSV_META_HEADER_SOUNDING_YEAR, Integer.toString(sounding.getYear())); |
|
179 // "# Aufnahmeart: " |
|
180 writeCSVMetaEntry(writer, CSV_META_HEADER_SOUNDING_TYPE, sounding.getType()); |
8882
|
181 // "# Auswerter: " |
|
182 writeCSVMetaEntry(writer, CSV_META_HEADER_SOUNDING_EVALUATOR, sounding.getEvaluationBy()); |
8877
|
183 // "# Lagesystem: " |
|
184 writeCSVMetaEntry(writer, CSV_META_HEADER_SOUNDING_PRJ, sounding.getLocationSystem()); |
|
185 // "# Höhensystem: " |
8879
|
186 writeCSVMetaEntry(writer, CSV_META_HEADER_SOUNDING_ELEVATIOIN_MODEL, sounding.getCurElevationModelUnit()); |
8877
|
187 // "# ursprüngliches Höhensystem: " |
8884
|
188 writeCSVMetaEntry(writer, CSV_META_HEADER_SOUNDING_ELEVATIOIN_MODEL_ORIGINAL, sounding.getOldElevationModelUnit()); |
8877
|
189 |
|
190 // "##METADATEN WASSERSPIEGELLAGE" |
|
191 writeCSVMetaEntry(writer, CSV_META_HEADER_WATERLEVEL); |
|
192 // "# Bezeichnung der Wasserspiegellage: " |
|
193 writeCSVMetaEntry(writer, CSV_META_HEADER_WATERLEVEL_NAME, wst.getLabel()); |
8879
|
194 // "# Bezugspegel: " |
|
195 writeCSVMetaEntry(writer, CSV_META_HEADER_WATERLEVEL_GAUGE, wst.getGauge()); |
8877
|
196 // "# Jahr/Zeitraum der Wasserspiegellage: " |
|
197 writeCSVMetaEntry(writer, CSV_META_HEADER_WATERLEVEL_YEAR, Integer.toString(wst.getYear())); |
|
198 |
|
199 /* nwo the value rows */ |
8854
|
200 final Collection<FlowDepthRow> rows = result.getRows(); |
|
201 for (final FlowDepthRow flowDepthRow : rows) { |
8877
|
202 writeCSVFlowDepthRow(writer, flowDepthRow, useTkh); |
|
203 } |
|
204 } |
8854
|
205 |
8877
|
206 private void writeCSVMeta(final CSVWriter writer, final FlowDepthCalculationResults results) { |
8854
|
207 log.info("FlowDepthExporter.writeCSVMeta"); |
|
208 |
8863
|
209 final String calcModeLabel = results.getCalcModeLabel(); |
8894
|
210 final RiverInfo river = results.getRiver(); |
8884
|
211 writeCSVMetaEntry(writer, CSV_META_HEADER_RESULT, msg(CSV_META_HEADER_RESULT_LABEL), river.getName(), calcModeLabel); |
8854
|
212 |
8877
|
213 // "# FLYS-Version: " |
|
214 writeCSVMetaEntry(writer, CSV_META_VERSION, msg(CSV_META_VERSION_LABEL), FLYS.VERSION); |
8854
|
215 |
8877
|
216 // "# Bearbeiter: " |
|
217 writeCSVMetaEntry(writer, CSV_META_USER, msg(CSV_META_USER_LABEL), results.getUser()); |
8854
|
218 |
|
219 // "# Datum der Erstellung: " |
8877
|
220 final Locale locale = Resources.getLocale(this.context.getMeta()); |
8854
|
221 final DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, locale); |
8877
|
222 writeCSVMetaEntry(writer, CSV_META_CREATION, msg(CSV_META_CREATION_LABEL), df.format(new Date())); |
8854
|
223 |
|
224 // "# Gewässer: " |
8877
|
225 writeCSVMetaEntry(writer, CSV_META_RIVER, msg(CSV_META_RIVER_LABEL), river.getName()); |
8854
|
226 |
|
227 // "# Höhensystem des Flusses: " |
8894
|
228 writeCSVMetaEntry(writer, CSV_META_HEIGHT_UNIT_RIVER, river.getWstUnit()); |
8854
|
229 |
|
230 // "# Ort/Bereich (km): " |
8894
|
231 final DoubleRange calcRange = results.getCalcRange(); |
|
232 writeCSVMetaEntry(writer, CSV_META_RANGE, msg(CSV_META_RANGE_LABEL), getKmFormatter().format(calcRange.getMinimumDouble()), |
|
233 getKmFormatter().format(calcRange.getMaximumDouble())); |
8854
|
234 |
|
235 writer.writeNext(new String[] { "" }); |
|
236 } |
|
237 |
8877
|
238 private void writeCSVMetaEntry(final CSVWriter writer, final String message, final Object... messageArgs) { |
8854
|
239 |
8877
|
240 final CallMeta meta = this.context.getMeta(); |
|
241 |
|
242 writer.writeNext(new String[] { Resources.getMsg(meta, message, message, messageArgs) }); |
8854
|
243 } |
8877
|
244 |
|
245 /** |
8854
|
246 * Write the header, with different headings depending on whether at a |
|
247 * gauge or at a location. |
8877
|
248 * |
|
249 * @param river |
|
250 * @param useTkh |
8854
|
251 */ |
8894
|
252 private void writeCSVHeader(final CSVWriter writer, final RiverInfo river, final boolean useTkh) { |
8854
|
253 log.info("FlowDepthExporter.writeCSVHeader"); |
|
254 |
|
255 final Collection<String> header = new ArrayList<>(11); |
8877
|
256 |
8863
|
257 header.add(msg(CSV_KM_HEADER)); |
|
258 header.add(msgUnit(CSV_FLOWDEPTH_HEADER, UNIT_M)); |
8877
|
259 if (useTkh) { |
|
260 header.add(msgUnit(CSV_FLOWDEPTHTKH_HEADER, UNIT_M)); |
|
261 header.add(msgUnit(CSV_TKH_HEADER, UNIT_CM)); |
8854
|
262 } |
8863
|
263 |
8894
|
264 header.add(msgUnit(CSV_WATERLEVEL_HEADER, river.getWstUnit())); |
8863
|
265 header.add(msgUnit(CSV_DISCHARGE_HEADER, UNIT_CUBIC_M)); |
8854
|
266 header.add(msg(CSV_LABEL_HEADER)); |
|
267 header.add(msg(CSV_GAUGE_HEADER)); |
8894
|
268 header.add(msgUnit(CSV_MEAN_BED_HEIGHT_HEADER, river.getWstUnit())); |
8854
|
269 header.add(msg(CSV_SOUNDING_HEADER)); |
|
270 header.add(msg(CSV_LOCATION_HEADER)); |
|
271 |
8877
|
272 writer.writeNext(header.toArray(new String[header.size()])); |
8854
|
273 } |
|
274 |
|
275 /** |
|
276 * Format a row of a flow depth result into an array of string, both used by csv and pdf |
8877
|
277 * |
|
278 * @param useTkh |
8854
|
279 */ |
8877
|
280 private String[] formatFlowDepthRow(final FlowDepthRow row, final boolean useTkh) { |
8854
|
281 |
8877
|
282 final Collection<String> lines = new ArrayList<>(11); |
8854
|
283 |
8877
|
284 // Fluss-km |
|
285 lines.add(getKmFormatter().format(row.getStation())); |
|
286 |
|
287 // Fließtiefe [m] |
|
288 lines.add(getFlowDepthFormatter().format(row.getFlowDepth())); |
|
289 |
|
290 if (useTkh) { |
|
291 // Fließtiefe mit TKH [m] |
|
292 lines.add(getFlowDepthFormatter().format(row.getFlowDepthWithTkh())); |
|
293 |
|
294 // TKH [cm] |
|
295 lines.add(getTkhFormatter().format(row.getTkh())); |
|
296 } |
|
297 |
|
298 // Wasserstand [NN + m] |
|
299 lines.add(getW2Formatter().format(row.getWaterlevel())); |
|
300 |
|
301 // Q [m³/s] |
|
302 final double discharge = row.getDischarge(); |
8884
|
303 if (Double.isNaN(discharge)) |
8877
|
304 lines.add(StringUtils.EMPTY); |
8884
|
305 else { |
8882
|
306 final double roundedDischarge = RiverUtils.roundQ(discharge); |
|
307 lines.add(getQFormatter().format(roundedDischarge)); |
|
308 } |
8877
|
309 |
|
310 // Bezeichnung |
|
311 lines.add(row.getWaterlevelLabel()); |
|
312 |
|
313 // Bezugspegel |
|
314 lines.add(row.getGauge()); |
|
315 |
|
316 // Mittlere Sohlhöhe [NN + m] |
|
317 lines.add(getMeanBedHeighFormatter().format(row.getMeanBedHeight())); |
|
318 |
|
319 // Peilung/Epoche |
|
320 lines.add(row.getSoundageLabel()); |
|
321 |
|
322 // Lage |
|
323 lines.add(row.getLocation()); |
|
324 |
|
325 return lines.toArray(new String[lines.size()]); |
8854
|
326 } |
8877
|
327 |
8854
|
328 /** |
|
329 * Write "rows" of csv data from wqkms with writer. |
8877
|
330 * |
|
331 * @param useTkh |
8854
|
332 */ |
8877
|
333 private void writeCSVFlowDepthRow(final CSVWriter writer, final FlowDepthRow row, final boolean useTkh) { |
8854
|
334 log.debug("FlowDepthExporter.writeCSVFlowDepthRow"); |
|
335 |
|
336 final String[] formattedRow = formatFlowDepthRow(row, useTkh); |
8877
|
337 writer.writeNext(formattedRow); |
8854
|
338 } |
|
339 |
8877
|
340 @Override |
|
341 protected void writePDF(final OutputStream outStream) { |
8854
|
342 log.debug("write PDF"); |
8877
|
343 |
8854
|
344 final JRDataSource source = createJRData(); |
|
345 |
|
346 final String confPath = Config.getConfigDirectory().toString(); |
|
347 |
8877
|
348 // FIXME: distinguish between with and without tkh: we need two jasper reports! |
8854
|
349 |
8877
|
350 final Map<String, Object> parameters = new HashMap<>(); |
8854
|
351 parameters.put("ReportTitle", "Exported Data"); |
|
352 try { |
8877
|
353 final JasperPrint print = JasperFillManager.fillReport(confPath + JASPER_FILE, parameters, source); |
8854
|
354 JasperExportManager.exportReportToPdfStream(print, outStream); |
|
355 } |
8877
|
356 catch (final JRException je) { |
8854
|
357 log.warn("Error generating PDF Report!", je); |
|
358 } |
|
359 } |
|
360 |
|
361 private JRDataSource createJRData() { |
8877
|
362 |
8854
|
363 /* fetch calculation results */ |
8877
|
364 final FlowDepthCalculationResults results = this.data; |
|
365 |
|
366 final MetaAndTableJRDataSource source = new MetaAndTableJRDataSource(); |
|
367 |
8854
|
368 addJRMetaData(source, results); |
|
369 |
|
370 final boolean useTkh = results.isUseTkh(); |
8877
|
371 |
8854
|
372 for (final FlowDepthCalculationResult result : results.getResults()) { |
8877
|
373 addJRTableData(source, result, useTkh); |
|
374 } |
8854
|
375 |
|
376 return source; |
|
377 } |
|
378 |
8877
|
379 private void addJRMetaData(final MetaAndTableJRDataSource source, final FlowDepthCalculationResults results) { |
8854
|
380 |
8894
|
381 final RiverInfo river = results.getRiver(); |
|
382 final String wstUnitName = river.getWstUnit(); |
8863
|
383 |
8877
|
384 /* general metadata */ |
|
385 source.addMetaData("header", msg(CSV_META_HEADER_RESULT_LABEL)); |
|
386 source.addMetaData("calcMode", results.getCalcModeLabel()); |
|
387 |
|
388 source.addMetaData("version_label", msg(CSV_META_VERSION_LABEL)); |
8863
|
389 source.addMetaData("version", FLYS.VERSION); |
|
390 |
|
391 source.addMetaData("user_label", msg(CSV_META_USER_LABEL)); |
|
392 source.addMetaData("user", results.getUser()); |
8877
|
393 |
|
394 final Locale locale = Resources.getLocale(this.context.getMeta()); |
8854
|
395 final DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, locale); |
8863
|
396 source.addMetaData("date_label", msg(CSV_META_CREATION_LABEL)); |
8854
|
397 source.addMetaData("date", df.format(new Date())); |
|
398 |
8877
|
399 source.addMetaData("river_label", msg(CSV_META_RIVER_LABEL)); |
8863
|
400 source.addMetaData("river", river.getName()); |
8854
|
401 |
8894
|
402 final DoubleRange calcRange = results.getCalcRange(); |
|
403 final NumberFormat kmFormatter = getKmFormatter(); |
|
404 final String rangeValue = String.format("%s - %s", kmFormatter.format(calcRange.getMinimumDouble()), kmFormatter.format(calcRange.getMaximumDouble())); |
8863
|
405 source.addMetaData("range_label", msg(CSV_META_RANGE_LABEL)); |
|
406 source.addMetaData("range", rangeValue); |
8854
|
407 |
8863
|
408 /* column headings */ |
|
409 source.addMetaData("station_header", msg(CSV_KM_HEADER)); |
|
410 source.addMetaData("flowdepth_header", msg(CSV_FLOWDEPTH_HEADER)); |
|
411 source.addMetaData("flowdepth_tkh_header", msg(CSV_FLOWDEPTHTKH_HEADER)); |
|
412 source.addMetaData("tkh_header", msg(CSV_TKH_HEADER)); |
|
413 source.addMetaData("waterlevel_header", msg(CSV_WATERLEVEL_HEADER)); |
|
414 source.addMetaData("river_unit", wstUnitName); |
|
415 source.addMetaData("discharge_header", msg(CSV_DISCHARGE_HEADER)); |
|
416 source.addMetaData("waterlevel_name_header", msg(CSV_LABEL_HEADER)); |
|
417 source.addMetaData("gauge_header", msg(CSV_GAUGE_HEADER)); |
|
418 source.addMetaData("bedheight_header", msg(CSV_MEAN_BED_HEIGHT_HEADER_SHORT)); |
|
419 source.addMetaData("sounding_name_header", msg(CSV_SOUNDING_HEADER)); |
|
420 source.addMetaData("location_header", msg(CSV_LOCATION_HEADER)); |
8854
|
421 } |
|
422 |
8884
|
423 private void addJRTableData(final MetaAndTableJRDataSource source, final FlowDepthCalculationResult result, final boolean useTkh) { |
8863
|
424 |
8877
|
425 final Collection<FlowDepthRow> rows = result.getRows(); |
|
426 |
|
427 for (final FlowDepthRow row : rows) { |
|
428 |
|
429 final String[] formattedRow = formatFlowDepthRow(row, useTkh); |
|
430 source.addData(formattedRow); |
|
431 } |
|
432 } |
|
433 } |