Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java @ 2063:97a25b54eea3
Part 1 of #125: added a description for a location to the WaterlevelExport.
flys-artifacts/trunk@3557 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 02 Jan 2012 08:50:50 +0000 |
parents | d13be39cfd1d |
children | 2f5628f0de0e |
comparison
equal
deleted
inserted
replaced
2062:ed6c6d437875 | 2063:97a25b54eea3 |
---|---|
50 "export.waterlevel.csv.header.w"; | 50 "export.waterlevel.csv.header.w"; |
51 | 51 |
52 public static final String CSV_Q_HEADER = | 52 public static final String CSV_Q_HEADER = |
53 "export.waterlevel.csv.header.q"; | 53 "export.waterlevel.csv.header.q"; |
54 | 54 |
55 public static final String CSV_Q_DESC_HEADER = | |
56 "export.waterlevel.csv.header.q.desc"; | |
57 | |
58 public static final String CSV_LOCATION_HEADER = | |
59 "export.waterlevel.csv.header.location"; | |
60 | |
61 public static final String CSV_GAUGE_HEADER = | |
62 "export.waterlevel.csv.header.gauge"; | |
63 | |
55 public static final String CSV_META_RESULT = | 64 public static final String CSV_META_RESULT = |
56 "export.waterlevel.csv.meta.result"; | 65 "export.waterlevel.csv.meta.result"; |
57 | 66 |
58 public static final String CSV_META_CREATION = | 67 public static final String CSV_META_CREATION = |
59 "export.waterlevel.csv.meta.creation"; | 68 "export.waterlevel.csv.meta.creation"; |
78 | 87 |
79 | 88 |
80 public static final Pattern NUMBERS_PATTERN = | 89 public static final Pattern NUMBERS_PATTERN = |
81 Pattern.compile("\\D*(\\d++.\\d*)\\D*"); | 90 Pattern.compile("\\D*(\\d++.\\d*)\\D*"); |
82 | 91 |
83 public static final String DEFAULT_CSV_KM_HEADER = "Fluss-Km"; | 92 public static final String DEFAULT_CSV_KM_HEADER = "Fluss-Km"; |
84 public static final String DEFAULT_CSV_W_HEADER = "W [NN + m]"; | 93 public static final String DEFAULT_CSV_W_HEADER = "W [NN + m]"; |
85 public static final String DEFAULT_CSV_Q_HEADER = "Q [m\u00b3/s]"; | 94 public static final String DEFAULT_CSV_Q_HEADER = "Q [m\u00b3/s]"; |
95 public static final String DEFAULT_CSV_Q_DESC_HEADER = "Bezeichnung"; | |
96 public static final String DEFAULT_CSV_LOCATION_HEADER = "Lage"; | |
97 public static final String DEFAULT_CSV_GAUGE_HEADER = "Bezugspegel"; | |
86 | 98 |
87 | 99 |
88 /** The storage that contains all WQKms objects for the different facets.*/ | 100 /** The storage that contains all WQKms objects for the different facets.*/ |
89 protected List<WQKms[]> data; | 101 protected List<WQKms[]> data; |
90 | 102 |
302 logger.info("WaterlevelExporter.writeCSVHeader"); | 314 logger.info("WaterlevelExporter.writeCSVHeader"); |
303 | 315 |
304 writer.writeNext(new String[] { | 316 writer.writeNext(new String[] { |
305 msg(CSV_KM_HEADER, DEFAULT_CSV_KM_HEADER), | 317 msg(CSV_KM_HEADER, DEFAULT_CSV_KM_HEADER), |
306 msg(CSV_W_HEADER, DEFAULT_CSV_W_HEADER), | 318 msg(CSV_W_HEADER, DEFAULT_CSV_W_HEADER), |
307 msg(CSV_Q_HEADER, DEFAULT_CSV_Q_HEADER) | 319 msg(CSV_Q_HEADER, DEFAULT_CSV_Q_HEADER), |
320 msg(CSV_Q_DESC_HEADER, DEFAULT_CSV_Q_DESC_HEADER), | |
321 msg(CSV_LOCATION_HEADER, DEFAULT_CSV_LOCATION_HEADER), | |
322 msg(CSV_GAUGE_HEADER, DEFAULT_CSV_GAUGE_HEADER) | |
308 }); | 323 }); |
309 } | 324 } |
310 | 325 |
311 | 326 |
312 protected void wQKms2CSV(CSVWriter writer, WQKms wqkms) { | 327 protected void wQKms2CSV(CSVWriter writer, WQKms wqkms) { |
317 NumberFormat qf = getQFormatter(); | 332 NumberFormat qf = getQFormatter(); |
318 | 333 |
319 int size = wqkms.size(); | 334 int size = wqkms.size(); |
320 double[] result = new double[3]; | 335 double[] result = new double[3]; |
321 | 336 |
337 FLYSArtifact flys = (FLYSArtifact) master; | |
338 | |
322 for (int i = 0; i < size; i ++) { | 339 for (int i = 0; i < size; i ++) { |
323 result = wqkms.get(i, result); | 340 result = wqkms.get(i, result); |
324 | 341 |
325 writer.writeNext(new String[] { | 342 writer.writeNext(new String[] { |
326 kmf.format(result[2]), | 343 kmf.format(result[2]), |
327 wf.format(result[0]), | 344 wf.format(result[0]), |
328 qf.format(result[1]) | 345 qf.format(result[1]), |
346 "", // Bezeichnung | |
347 FLYSUtils.getLocationDescription(flys, result[2]), | |
348 "" // Bezugspegel | |
329 }); | 349 }); |
330 } | 350 } |
331 } | 351 } |
332 | 352 |
333 | 353 |