comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthExporter.java @ 8938:9c02733a1b3c

Work on Sinfo-tkh - exports; using same logic for wst-description as winfo
author gernotbelger
date Tue, 06 Mar 2018 17:09:39 +0100
parents 791714b92b5c
children 5d5d482da3e9
comparison
equal deleted inserted replaced
8937:8596f95673b1 8938:9c02733a1b3c
69 protected Logger getLog() { 69 protected Logger getLog() {
70 return log; 70 return log;
71 } 71 }
72 72
73 @Override 73 @Override
74 protected void writeCSVResultHeader(final CSVWriter writer, final FlowDepthCalculationResult result) { 74 protected void writeCSVResultMetadata(final CSVWriter writer, final FlowDepthCalculationResults results, final FlowDepthCalculationResult result) {
75 75
76 /* first some specific metadata */ 76 /* first some specific metadata */
77 final BedHeightInfo sounding = result.getSounding(); 77 final BedHeightInfo sounding = result.getSounding();
78 final WstInfo wst = result.getWst(); 78 final WstInfo wst = result.getWst();
79 79
102 // "# Jahr/Zeitraum der Wasserspiegellage: " 102 // "# Jahr/Zeitraum der Wasserspiegellage: "
103 writeCSVMetaEntry(writer, SInfoI18NStrings.CSV_META_HEADER_WATERLEVEL_YEAR, Integer.toString(wst.getYear())); 103 writeCSVMetaEntry(writer, SInfoI18NStrings.CSV_META_HEADER_WATERLEVEL_YEAR, Integer.toString(wst.getYear()));
104 } 104 }
105 105
106 @Override 106 @Override
107 protected final void writeCSVMeta(final CSVWriter writer, final FlowDepthCalculationResults results) { 107 protected void writeCSVGlobalMetadata(final CSVWriter writer, final FlowDepthCalculationResults results) {
108 log.info("FlowDepthExporter.writeCSVMeta"); 108 log.info("FlowDepthExporter.writeCSVMeta");
109 109
110 final String calcModeLabel = results.getCalcModeLabel(); 110 final String calcModeLabel = results.getCalcModeLabel();
111 final RiverInfo river = results.getRiver(); 111 final RiverInfo river = results.getRiver();
112 writeCSVMetaEntry(writer, SInfoI18NStrings.CSV_META_HEADER_RESULT, msg(SInfoI18NStrings.CSV_META_HEADER_RESULT_LABEL), river.getName(), calcModeLabel); 112 writeCSVMetaEntry(writer, SInfoI18NStrings.CSV_META_HEADER_RESULT, msg(SInfoI18NStrings.CSV_META_HEADER_RESULT_LABEL), river.getName(), calcModeLabel);
142 * gauge or at a location. 142 * gauge or at a location.
143 * 143 *
144 * @param river 144 * @param river
145 * @param useTkh 145 * @param useTkh
146 */ 146 */
147 @Override 147
148 protected final void writeCSVHeader(final CSVWriter writer, final RiverInfo river) { 148 @Override
149 protected void writeCSVHeader(final CSVWriter writer, final FlowDepthCalculationResults results, final RiverInfo river) {
149 log.info("FlowDepthExporter.writeCSVHeader"); 150 log.info("FlowDepthExporter.writeCSVHeader");
150 151
151 final Collection<String> header = new ArrayList<>(11); 152 final Collection<String> header = new ArrayList<>(11);
152 153
153 header.add(msg(SInfoI18NStrings.CSV_KM_HEADER)); 154 header.add(msg(SInfoI18NStrings.CSV_KM_HEADER));
167 168
168 writer.writeNext(header.toArray(new String[header.size()])); 169 writer.writeNext(header.toArray(new String[header.size()]));
169 } 170 }
170 171
171 @Override 172 @Override
172 protected final String[] formatCSVRow(final FlowDepthRow row) { 173 protected String[] formatCSVRow(final FlowDepthCalculationResults results, final FlowDepthRow row) {
173 return formatFlowDepthRow(row); 174 return formatFlowDepthRow(row);
174 } 175 }
175 176
176 /** 177 /**
177 * Format a row of a flow depth result into an array of string, both used by csv and pdf 178 * Format a row of a flow depth result into an array of string, both used by csv and pdf
275 source.addMetaData("sounding_name_header", msg(CSV_SOUNDING_HEADER)); 276 source.addMetaData("sounding_name_header", msg(CSV_SOUNDING_HEADER));
276 source.addMetaData("location_header", msg(SInfoI18NStrings.CSV_LOCATION_HEADER)); 277 source.addMetaData("location_header", msg(SInfoI18NStrings.CSV_LOCATION_HEADER));
277 } 278 }
278 279
279 @Override 280 @Override
280 protected final String[] formatPDFRow(final FlowDepthRow row) { 281 protected String[] formatPDFRow(final FlowDepthCalculationResults results, final FlowDepthRow row) {
281 return formatFlowDepthRow(row); 282 return formatFlowDepthRow(row);
282 } 283 }
283 } 284 }

http://dive4elements.wald.intevation.org