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