Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveExporter.java @ 2272:4a8b519b64bd
Extend reference curve export to include km location as string.
flys-artifacts/trunk@3929 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Mon, 06 Feb 2012 14:22:26 +0000 |
parents | e92545d2069e |
children | 5a00269406f3 |
comparison
equal
deleted
inserted
replaced
2271:3973a2451cf7 | 2272:4a8b519b64bd |
---|---|
24 | 24 |
25 import de.intevation.artifacts.CallContext; | 25 import de.intevation.artifacts.CallContext; |
26 import de.intevation.artifacts.CallMeta; | 26 import de.intevation.artifacts.CallMeta; |
27 import de.intevation.artifacts.common.utils.Config; | 27 import de.intevation.artifacts.common.utils.Config; |
28 | 28 |
29 import de.intevation.flys.artifacts.FLYSArtifact; | |
29 import de.intevation.flys.artifacts.WINFOArtifact; | 30 import de.intevation.flys.artifacts.WINFOArtifact; |
30 | 31 |
31 import de.intevation.flys.artifacts.model.CalculationResult; | 32 import de.intevation.flys.artifacts.model.CalculationResult; |
32 import de.intevation.flys.artifacts.model.WW; | 33 import de.intevation.flys.artifacts.model.WW; |
33 import de.intevation.flys.artifacts.model.WKmsJRDataSource; | 34 import de.intevation.flys.artifacts.model.WKmsJRDataSource; |
51 public static final String RC_CSV_W_HEADER = | 52 public static final String RC_CSV_W_HEADER = |
52 "export.reference_curve.csv.header.w"; | 53 "export.reference_curve.csv.header.w"; |
53 | 54 |
54 public static final String RC_CSV_Q_HEADER = | 55 public static final String RC_CSV_Q_HEADER = |
55 "export.reference_curve.csv.header.q"; | 56 "export.reference_curve.csv.header.q"; |
57 | |
58 public static final String CSV_LOCATION_HEADER = | |
59 "export.waterlevel.csv.header.location"; | |
60 | |
61 public static final String DEFAULT_CSV_LOCATION_HEADER = "Lage"; | |
56 | 62 |
57 /* | 63 /* |
58 For each Bezugs and Ziel-ort (of which there might be multiples): | 64 For each Bezugs and Ziel-ort (of which there might be multiples): |
59 Lage, Bezeichnung, Q, W (cm), W(NN+m). | 65 Lage, Bezeichnung, Q, W (cm), W(NN+m). |
60 */ | 66 */ |
150 protected void writeCSVHeader(CSVWriter writer) { | 156 protected void writeCSVHeader(CSVWriter writer) { |
151 logger.info("ReferenceCurveExporter.writeCSVHeader"); | 157 logger.info("ReferenceCurveExporter.writeCSVHeader"); |
152 | 158 |
153 writer.writeNext(new String[] { | 159 writer.writeNext(new String[] { |
154 msg(RC_CSV_KM_HEADER, RC_DEFAULT_CSV_KM_HEADER), | 160 msg(RC_CSV_KM_HEADER, RC_DEFAULT_CSV_KM_HEADER), |
161 msg(CSV_LOCATION_HEADER, DEFAULT_CSV_LOCATION_HEADER), | |
155 msg(RC_CSV_W_HEADER, RC_DEFAULT_CSV_W_HEADER), | 162 msg(RC_CSV_W_HEADER, RC_DEFAULT_CSV_W_HEADER), |
156 msg(RC_CSV_Q_HEADER, RC_DEFAULT_CSV_Q_HEADER), | 163 msg(RC_CSV_Q_HEADER, RC_DEFAULT_CSV_Q_HEADER), |
157 msg(RC_CSV_KM_HEADER, RC_DEFAULT_CSV_KM_HEADER), | 164 msg(RC_CSV_KM_HEADER, RC_DEFAULT_CSV_KM_HEADER), |
165 msg(CSV_LOCATION_HEADER, DEFAULT_CSV_LOCATION_HEADER), | |
158 msg(RC_CSV_W_HEADER, RC_DEFAULT_CSV_W_HEADER), | 166 msg(RC_CSV_W_HEADER, RC_DEFAULT_CSV_W_HEADER), |
159 msg(RC_CSV_Q_HEADER, RC_DEFAULT_CSV_Q_HEADER), | 167 msg(RC_CSV_Q_HEADER, RC_DEFAULT_CSV_Q_HEADER), |
160 }); | 168 }); |
161 } | 169 } |
162 | 170 |
166 | 174 |
167 NumberFormat kmf = getKmFormatter(); | 175 NumberFormat kmf = getKmFormatter(); |
168 NumberFormat wf = getWFormatter(); | 176 NumberFormat wf = getWFormatter(); |
169 int size = ww.size(); | 177 int size = ww.size(); |
170 | 178 |
179 FLYSArtifact flys = (FLYSArtifact) master; | |
180 | |
181 String startLocationDescription = FLYSUtils.getLocationDescription( | |
182 flys, ww.getStartKm()); | |
183 | |
184 String endLocationDescription = FLYSUtils.getLocationDescription( | |
185 flys, ww.getEndKm()); | |
186 | |
171 for (int i = 0; i < size; i ++) { | 187 for (int i = 0; i < size; i ++) { |
172 | |
173 // TODO: start/end ... start/end .. | |
174 writer.writeNext(new String[] { | 188 writer.writeNext(new String[] { |
175 kmf.format(ww.getStartKm()), | 189 kmf.format(ww.getStartKm()), |
190 startLocationDescription, | |
176 wf.format(ww.getW1(i)), | 191 wf.format(ww.getW1(i)), |
177 "", // "Q" | 192 "", // "Q" |
178 kmf.format(ww.getEndKm()), | 193 kmf.format(ww.getEndKm()), |
194 endLocationDescription, | |
179 wf.format(ww.getW2(i)), | 195 wf.format(ww.getW2(i)), |
180 "" // "Q" | 196 "" // "Q" |
181 }); | 197 }); |
182 } | 198 } |
183 } | 199 } |