Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveExporter.java @ 2631:87085ccea466
Issue 528, 637.
Added columns for 'W at gauge' and fixed column header.
flys-artifacts/trunk@4227 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 13 Apr 2012 07:44:25 +0000 |
parents | 26cd4dfafdf1 |
children | e63969c173e9 |
comparison
equal
deleted
inserted
replaced
2630:0fa2722abf5b | 2631:87085ccea466 |
---|---|
54 | 54 |
55 public static final String RC_CSV_W_M_HEADER = | 55 public static final String RC_CSV_W_M_HEADER = |
56 "export.reference_curve.csv.header.w.m"; | 56 "export.reference_curve.csv.header.w.m"; |
57 | 57 |
58 public static final String RC_CSV_Q_HEADER = | 58 public static final String RC_CSV_Q_HEADER = |
59 "export.reference_curve.csv.header.q"; | 59 "export.reference_curve.csv.header.w.q"; |
60 | 60 |
61 public static final String CSV_LOCATION_HEADER = | 61 public static final String CSV_LOCATION_HEADER = |
62 "export.waterlevel.csv.header.location"; | 62 "export.waterlevel.csv.header.location"; |
63 | 63 |
64 public static final String DEFAULT_CSV_LOCATION_HEADER = "Lage"; | 64 public static final String DEFAULT_CSV_LOCATION_HEADER = "Lage"; |
65 | 65 |
66 public static final String RC_DEFAULT_CSV_KM_HEADER = "Fluss-Km"; | 66 public static final String RC_DEFAULT_CSV_KM_HEADER = "Fluss-Km"; |
67 public static final String RC_DEFAULT_CSV_W_M_HEADER = "W (m + NHN)"; | 67 public static final String RC_DEFAULT_CSV_W_M_HEADER = "W (m + NHN)"; |
68 public static final String RC_DEFAULT_CSV_W_CM_HEADER = "W (cm am Pegel)"; | 68 public static final String RC_DEFAULT_CSV_W_CM_HEADER = "W (cm am Pegel)"; |
69 public static final String RC_DEFAULT_CSV_Q_HEADER = "gleichw. Q (m/s)"; | 69 public static final String RC_DEFAULT_CSV_Q_HEADER = "gleichw. Q (m\u00b3/s)"; |
70 | 70 |
71 public static final String PDF_HEADER_MODE = "export.reference_curve.pdf.mode"; | 71 public static final String PDF_HEADER_MODE = "export.reference_curve.pdf.mode"; |
72 public static final String JASPER_FILE = "export.reference_curve.pdf.file"; | 72 public static final String JASPER_FILE = "export.reference_curve.pdf.file"; |
73 public static final String JASPER_FILE_GAUGE = "export.reference_curve.pdf.file.gauge"; | |
74 public static final String JASPER_FILE_GAUGE_END = "export.reference_curve.pdf.file.gauge.end"; | |
75 public static final String JASPER_FILE_GAUGE_START_END = "export.reference_curve.pdf.file.gauge.start.end"; | |
73 | 76 |
74 /** The storage that contains all WKms objects for the different facets. */ | 77 /** The storage that contains all WKms objects for the different facets. */ |
75 protected List<WWQQ[]> data; | 78 protected List<WWQQ[]> data; |
76 | 79 |
77 protected boolean startAtGauge = false; | 80 protected boolean startAtGauge = false; |
255 | 258 |
256 @Override | 259 @Override |
257 protected void writePDF(OutputStream out) { | 260 protected void writePDF(OutputStream out) { |
258 WWQQJRDataSource source = createJRData(); | 261 WWQQJRDataSource source = createJRData(); |
259 | 262 |
263 String filename = JASPER_FILE; | |
264 if (startAtGauge && endAtGauge) { | |
265 filename = JASPER_FILE_GAUGE_START_END; | |
266 } | |
267 else if (startAtGauge) { | |
268 filename = JASPER_FILE_GAUGE; | |
269 } | |
270 else if (endAtGauge) { | |
271 filename = JASPER_FILE_GAUGE_END; | |
272 } | |
273 | |
260 String jasperFile = Resources.getMsg( | 274 String jasperFile = Resources.getMsg( |
261 context.getMeta(), | 275 context.getMeta(), |
262 JASPER_FILE, | 276 filename, |
263 "/jasper/reference_en.jasper"); | 277 "/jasper/reference_en.jasper"); |
264 String confPath = Config.getConfigDirectory().toString(); | 278 String confPath = Config.getConfigDirectory().toString(); |
265 | 279 |
266 Map parameters = new HashMap(); | 280 Map parameters = new HashMap(); |
267 parameters.put("ReportTitle", "Exported Data"); | 281 parameters.put("ReportTitle", "Exported Data"); |
324 flys, ww.getStartKm()); | 338 flys, ww.getStartKm()); |
325 | 339 |
326 String endLocationDescription = FLYSUtils.getLocationDescription( | 340 String endLocationDescription = FLYSUtils.getLocationDescription( |
327 flys, ww.getEndKm()); | 341 flys, ww.getEndKm()); |
328 | 342 |
329 // TODO missing 'relative' W(cm). | |
330 for (int i = 0; i < size; i ++) { | 343 for (int i = 0; i < size; i ++) { |
344 String start = "-"; | |
345 String end = "-"; | |
346 if (startAtGauge) { | |
347 start = wf.format(ww.getRelHeight1Cm(i)); | |
348 } | |
349 if (ww.endAtGauge()) { | |
350 end = wf.format(ww.getRelHeight2Cm(i)); | |
351 } | |
331 source.addData(new String[] { | 352 source.addData(new String[] { |
332 kmf.format(ww.getStartKm()), | 353 kmf.format(ww.getStartKm()), |
333 startLocationDescription, | 354 startLocationDescription, |
334 wf.format(ww.getW1(i)), | 355 wf.format(ww.getW1(i)), |
335 qf.format(ww.getQ1(i)), // "Q" | 356 qf.format(ww.getQ1(i)), // "Q" |
336 kmf.format(ww.getEndKm()), | 357 kmf.format(ww.getEndKm()), |
337 endLocationDescription, | 358 endLocationDescription, |
338 wf.format(ww.getW2(i)), | 359 wf.format(ww.getW2(i)), |
339 qf.format(ww.getQ2(i)) // "Q" | 360 qf.format(ww.getQ2(i)), // "Q" |
361 start, | |
362 end | |
340 }); | 363 }); |
341 } | 364 } |
342 } | 365 } |
343 } | 366 } |
344 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 367 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |