Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/minfo/SedimentLoadExporter.java @ 6759:6eb2b8087cfa
issue1416: exporter for sedimentload and i18n.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 06 Aug 2013 16:56:45 +0200 |
parents | 09e70f01ed1e |
children | aa1d681ee6eb |
comparison
equal
deleted
inserted
replaced
6758:67182bde34cd | 6759:6eb2b8087cfa |
---|---|
33 import org.dive4elements.river.utils.Formatter; | 33 import org.dive4elements.river.utils.Formatter; |
34 | 34 |
35 import au.com.bytecode.opencsv.CSVWriter; | 35 import au.com.bytecode.opencsv.CSVWriter; |
36 | 36 |
37 | 37 |
38 /** Do CSV export for sediment load calculations (will also be shown in | 38 /** |
39 * Do CSV export for sediment load calculations (will also be shown in | |
39 * client). */ | 40 * client). */ |
40 public class SedimentLoadExporter | 41 public class SedimentLoadExporter |
41 extends AbstractExporter | 42 extends AbstractExporter |
42 { | 43 { |
43 /** Private logger. */ | 44 /** Private logger. */ |
59 public static final String CSV_SAND = | 60 public static final String CSV_SAND = |
60 "export.sedimentload_ls.csv.header.sand"; | 61 "export.sedimentload_ls.csv.header.sand"; |
61 | 62 |
62 public static final String CSV_SUSP_SAND = | 63 public static final String CSV_SUSP_SAND = |
63 "export.sedimentload_ls.csv.header.suspsand"; | 64 "export.sedimentload_ls.csv.header.suspsand"; |
65 | |
66 public static final String CSV_SUSP_SAND_BB = | |
67 "export.sedimentload_ls.csv.header.suspsandbb"; | |
64 | 68 |
65 public static final String CSV_SUSP_SEDIMENT = | 69 public static final String CSV_SUSP_SEDIMENT = |
66 "export.sedimentload_ls.csv.header.suspsediment"; | 70 "export.sedimentload_ls.csv.header.suspsediment"; |
67 | 71 |
68 public static final String CSV_TOTAL = | 72 public static final String CSV_TOTAL = |
107 NumberFormat kmf = Formatter.getCalculationKm(context.getMeta()); | 111 NumberFormat kmf = Formatter.getCalculationKm(context.getMeta()); |
108 NumberFormat valf = Formatter.getFormatter(context.getMeta(), 0, 2); | 112 NumberFormat valf = Formatter.getFormatter(context.getMeta(), 0, 2); |
109 writer.writeNext(new String[] { | 113 writer.writeNext(new String[] { |
110 kmf.format(km), | 114 kmf.format(km), |
111 years, | 115 years, |
112 valf.format(fraction.getTotal()), | 116 valf.format(fraction.getSuspSediment()), |
117 valf.format(fraction.getSuspSand()), | |
118 valf.format(fraction.getSuspSandBed()), | |
113 valf.format(fraction.getSand()), | 119 valf.format(fraction.getSand()), |
114 valf.format(fraction.getFineMiddle()), | 120 valf.format(fraction.getFineMiddle()), |
115 valf.format(fraction.getCoarse()), | 121 valf.format(fraction.getCoarse()), |
116 valf.format(fraction.getSuspSand()), | 122 valf.format(fraction.getTotal()) |
117 //valf.format(fraction.getSuspSandBed()), | |
118 valf.format(fraction.getSuspSediment()) | |
119 }); | 123 }); |
120 } | 124 } |
121 | 125 |
122 /** Writes i18ned header for csv file/stream. */ | 126 /** Writes i18ned header for csv file/stream. */ |
123 protected void writeCSVHeader(CSVWriter writer) { | 127 protected void writeCSVHeader(CSVWriter writer) { |
124 logger.debug("writeCSVHeader()"); | 128 logger.debug("writeCSVHeader()"); |
125 | 129 |
126 List<String> header = new LinkedList<String>(); | 130 List<String> header = new LinkedList<String>(); |
127 if (results != null) { | 131 if (results != null) { |
128 header.add(msg(CSV_KM, "km")); | 132 header.add(msg(CSV_KM, "km")); |
129 header.add(msg(CSV_YEAR, "Jahr")); | 133 header.add(msg(CSV_YEAR, "Jahr")); |
130 header.add(msg(CSV_TOTAL, "Gesamt")); | |
131 header.add(msg(CSV_SAND, "Sand")); | |
132 header.add(msg(CSV_FINEMIDDLE,"Fein")); | |
133 header.add(msg(CSV_COARSE, "Grob")); | |
134 header.add(msg(CSV_SUSP_SAND, "Su.Sand")); | |
135 header.add(msg(CSV_SUSP_SEDIMENT, "Schwebst.")); | 134 header.add(msg(CSV_SUSP_SEDIMENT, "Schwebst.")); |
136 //header.add("Susp.Sand Bett"); | 135 header.add(msg(CSV_SUSP_SAND, "Susp.Sand")); |
136 header.add(msg(CSV_SUSP_SAND_BB, "Susp.Sand(BB)")); | |
137 header.add(msg(CSV_SAND, "Sand")); | |
138 header.add(msg(CSV_FINEMIDDLE, "Kies(f+m)")); | |
139 header.add(msg(CSV_COARSE, "Kies(g)")); | |
140 header.add(msg(CSV_TOTAL, "Gesamt")); | |
137 } | 141 } |
138 writer.writeNext(header.toArray(new String[header.size()])); | 142 writer.writeNext(header.toArray(new String[header.size()])); |
139 } | 143 } |
140 | 144 |
141 /** Store data internally, accepting only SedimentLoadResults[] in | 145 /** Store data internally, accepting only SedimentLoadResults[] in |