comparison flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveExporter.java @ 416:340dc41a7ea3

The CSV exports will now have headers. flys-artifacts/trunk@1880 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 10 May 2011 13:18:03 +0000
parents b9175ddea49b
children e0fec407a280
comparison
equal deleted inserted replaced
415:7c018f466d6d 416:340dc41a7ea3
24 24
25 /** The logger used in this exporter.*/ 25 /** The logger used in this exporter.*/
26 private static Logger logger = 26 private static Logger logger =
27 Logger.getLogger(ComputedDischargeCurveExporter.class); 27 Logger.getLogger(ComputedDischargeCurveExporter.class);
28 28
29 public static final String CSV_W_HEADER =
30 "export.computed.discharge.curve.csv.header.w";
31
32 public static final String CSV_Q_HEADER =
33 "export.computed.discharge.curve.csv.header.q";
34
35 public static final String DEFAULT_CSV_W_HEADER = "W [NN + m]";
36 public static final String DEFAULT_CSV_Q_HEADER = "Q [m³/s]";
37
29 38
30 protected List<WQKms> data; 39 protected List<WQKms> data;
31 40
32 41
33 public void init(Document request, OutputStream out, CallContext context) { 42 public void init(Document request, OutputStream out, CallContext context) {
46 55
47 56
48 protected void writeCSVData(CSVWriter writer) { 57 protected void writeCSVData(CSVWriter writer) {
49 logger.info("ComputedDischargeCurveExporter.writeData"); 58 logger.info("ComputedDischargeCurveExporter.writeData");
50 59
60 writeCSVHeader(writer);
61
51 double[] res = new double[3]; 62 double[] res = new double[3];
52 63
53 for (WQKms wqkms: data) { 64 for (WQKms wqkms: data) {
54 int size = wqkms.size(); 65 int size = wqkms.size();
55 66
61 Double.toString(res[1]) 72 Double.toString(res[1])
62 }); 73 });
63 } 74 }
64 } 75 }
65 } 76 }
77
78
79 protected void writeCSVHeader(CSVWriter writer) {
80 logger.debug("ComputedDischargeCurveExporter.writeCSVHeader");
81
82 writer.writeNext(new String[] {
83 msg(CSV_W_HEADER, DEFAULT_CSV_W_HEADER),
84 msg(CSV_Q_HEADER, DEFAULT_CSV_Q_HEADER)
85 });
86 }
66 } 87 }
67 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 88 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org