comparison flys-artifacts/src/main/java/de/intevation/flys/exports/DeltaWtExporter.java @ 2792:fe987587ebc9

Merged revisions 4539-4540,4543,4545-4546 via svnmerge from file:///home/clients/bsh/bsh-generischer-viewer/Material/SVN/flys-artifacts/trunk ........ r4539 | teichmann | 2012-05-27 20:02:13 +0200 (So, 27 Mai 2012) | 1 line FixA: Added forgotten csv/report facets/generators to conf. ........ r4540 | teichmann | 2012-05-27 20:11:31 +0200 (So, 27 Mai 2012) | 1 line FixA: Fixed class cast bug in report facet. ........ r4543 | teichmann | 2012-05-28 20:35:01 +0200 (Mo, 28 Mai 2012) | 1 line FixA: Added facet to return delta w/t as CSV ........ r4545 | teichmann | 2012-05-28 22:59:27 +0200 (Mo, 28 Mai 2012) | 1 line FixA: Made Delta W/t calculation finally work ........ r4546 | teichmann | 2012-05-28 23:34:24 +0200 (Mo, 28 Mai 2012) | 1 line FixA: corrected fitting (Q->W instead W->Q). ........ flys-artifacts/tags/2.7@4547 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 29 May 2012 04:58:29 +0000
parents e63969c173e9
children
comparison
equal deleted inserted replaced
2791:c9815016a3bb 2792:fe987587ebc9
47 public static final String CSV_T_DESC_HEADER = 47 public static final String CSV_T_DESC_HEADER =
48 "export.fixings.deltawt.csv.header.description"; 48 "export.fixings.deltawt.csv.header.description";
49 49
50 public static final String DEFAULT_CSV_KM_HEADER = "km"; 50 public static final String DEFAULT_CSV_KM_HEADER = "km";
51 51
52 public static final String DEFAULT_CSV_DELTA_W_HEADER = "\u0394 W"; 52 public static final String DEFAULT_CSV_DELTA_W_HEADER = "\u0394 W [cm]";
53 53
54 public static final String DEFAULT_CSV_T_HEADER = "Datum"; 54 public static final String DEFAULT_CSV_T_HEADER = "Datum";
55 55
56 public static final String DEFAULT_CSV_T_DESC_HEADER = "Beschreibung"; 56 public static final String DEFAULT_CSV_T_DESC_HEADER = "Beschreibung";
57 57
96 FixResult result = (FixResult)data; 96 FixResult result = (FixResult)data;
97 deltaWTsKMs.add(result.getDeltaWTsKM()); 97 deltaWTsKMs.add(result.getDeltaWTsKM());
98 } 98 }
99 99
100 @Override 100 @Override
101 protected void writeCSVData(CSVWriter writer) { 101 protected void writeCSVData(CSVWriter writer) throws IOException {
102
103 boolean debug = log.isDebugEnabled();
102 104
103 writeCSVHeader(writer); 105 writeCSVHeader(writer);
104 106
105 NumberFormat kmF = getKMFormatter(); 107 NumberFormat kmF = getKMFormatter();
106 NumberFormat dwF = getDeltaWFormatter(); 108 NumberFormat dwF = getDeltaWFormatter();
107 109
108 CallMeta meta = context.getMeta(); 110 CallMeta meta = context.getMeta();
109 Locale locale = Resources.getLocale(meta); 111 Locale locale = Resources.getLocale(meta);
110 DateFormat dF = DateFormat.getDateInstance(DateFormat.SHORT, locale); 112 DateFormat dF = DateFormat.getDateInstance(DateFormat.SHORT, locale);
111 113
114 if (debug) {
115 log.debug("DeltaWTsKMs: " + deltaWTsKMs.size());
116 }
117
112 for (DeltaWTsKM deltaWTsKM: deltaWTsKMs) { 118 for (DeltaWTsKM deltaWTsKM: deltaWTsKMs) {
113 List<DeltaWTsKM.KM> dkms = deltaWTsKM.getKms(); 119 List<DeltaWTsKM.KM> dkms = deltaWTsKM.getKms();
120 if (debug) {
121 log.debug("DeltaWTsKM.KM: " + dkms.size());
122 }
114 for (DeltaWTsKM.KM dkm: dkms) { 123 for (DeltaWTsKM.KM dkm: dkms) {
115 double km = dkm.getKm(); 124 double km = dkm.getKm();
116 String kmS = kmF.format(km); 125 String kmS = kmF.format(km);
117 List<DeltaWT> deltaWTs = dkm.getDeltaWTs(); 126 List<DeltaWT> deltaWTs = dkm.getDeltaWTs();
127 if (debug) {
128 log.debug("deltaWTs: " + deltaWTs.size());
129 }
118 for (DeltaWT dwt: deltaWTs) { 130 for (DeltaWT dwt: deltaWTs) {
119 double deltaW = dwt.getDeltaW(); 131 double deltaW = dwt.getDeltaW();
120 Date date = dwt.getDate(); 132 Date date = dwt.getDate();
121 String desc = dwt.getDescription(); 133 String desc = dwt.getDescription();
122 134
129 dateS, 141 dateS,
130 desc != null ? desc : "" }); 142 desc != null ? desc : "" });
131 } 143 }
132 } 144 }
133 } 145 }
146 writer.flush();
134 } 147 }
135 148
136 149
137 protected NumberFormat getKMFormatter() { 150 protected NumberFormat getKMFormatter() {
138 return Formatter.getFixDeltaWKM(context); 151 return Formatter.getFixDeltaWKM(context);

http://dive4elements.wald.intevation.org