Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceExporter.java @ 7916:c0843a658474
Adapted bed differences PDF export to CSV export and some cleanup of field names.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Wed, 04 Jun 2014 18:22:14 +0200 |
parents | 931dffefc3dd |
children | 6fef38a526c7 |
comparison
equal
deleted
inserted
replaced
7915:931dffefc3dd | 7916:c0843a658474 |
---|---|
158 access.getYearEpoch())); | 158 access.getYearEpoch())); |
159 | 159 |
160 source.addMetaData("differences", StringUtils.join( | 160 source.addMetaData("differences", StringUtils.join( |
161 access.getDifferenceArtifactNamePairs(), "\n")); | 161 access.getDifferenceArtifactNamePairs(), "\n")); |
162 | 162 |
163 source.addMetaData("unit", msg(CSV_HEADER_DIFF, "cm")); | 163 source.addMetaData("kmheader", |
164 msg(CSV_HEADER_KM, "km")); | |
164 source.addMetaData("diffpairheader", | 165 source.addMetaData("diffpairheader", |
165 msg(CSV_HEADER_DIFF_PAIR, "Difference pair")); | 166 msg(CSV_HEADER_DIFF_PAIR, "Difference pair")); |
167 source.addMetaData("diffheader", msg(CSV_HEADER_DIFF, "cm")); | |
168 source.addMetaData("morph1header", | |
169 msg(CSV_HEADER_MORPH1, "Morph. active width minuend")); | |
170 source.addMetaData("morph2header", | |
171 msg(CSV_HEADER_MORPH2, "Morph. active width subtrahend")); | |
166 } | 172 } |
167 | 173 |
168 | 174 |
169 protected void writeCSVHeader(CSVWriter writer) { | 175 protected void writeCSVHeader(CSVWriter writer) { |
170 logger.debug("writeCSVHeader()"); | 176 logger.debug("writeCSVHeader()"); |
188 | 194 |
189 addMetaData(source); | 195 addMetaData(source); |
190 NumberFormat kmf = Formatter.getCalculationKm(context.getMeta()); | 196 NumberFormat kmf = Formatter.getCalculationKm(context.getMeta()); |
191 NumberFormat mf = Formatter.getMeterFormat(context); | 197 NumberFormat mf = Formatter.getMeterFormat(context); |
192 for (BedDifferencesResult result: results) { | 198 for (BedDifferencesResult result: results) { |
199 BedDiffYearResult yResult = (BedDiffYearResult) result; | |
193 double[][] kms = result.getDifferencesData(); | 200 double[][] kms = result.getDifferencesData(); |
194 String desc = result.getDiffDescription(); | 201 String desc = result.getDiffDescription(); |
202 double[][] morph1 = yResult.getMorphWidth1Data(); | |
203 double[][] morph2 = yResult.getMorphWidth2Data(); | |
195 for (int j = 0; j < kms[0].length; j++) { | 204 for (int j = 0; j < kms[0].length; j++) { |
196 source.addData(new String[] { | 205 source.addData(new String[] { |
197 kmf.format(kms[0][j]), | 206 kmf.format(kms[0][j]), |
207 desc, | |
198 mf.format(kms[1][j]), | 208 mf.format(kms[1][j]), |
199 desc }); | 209 mf.format(morph1[1][j]), |
210 mf.format(morph2[1][j]) | |
211 }); | |
200 } | 212 } |
201 } | 213 } |
202 return source; | 214 return source; |
203 } | 215 } |
204 | 216 |