comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/AbstractSInfoExporter.java @ 8953:c40db8e8dcae

SINFO - Flow depth development - implemented exporters
author gernotbelger
date Mon, 19 Mar 2018 14:01:21 +0100
parents a4f1ac81f26d
children 7c1611b5a59e
comparison
equal deleted inserted replaced
8952:1a8f19f3b776 8953:c40db8e8dcae
81 this.data = result; 81 this.data = result;
82 } 82 }
83 } 83 }
84 } 84 }
85 85
86 /**
87 * Formats header with unit and label: msg [unit] (label)
88 */
89 protected final String msgUnitLabel(final String key, final String unit, final String label) {
90 final String msg = msg(key);
91 return String.format("%s [%s] (%s)", msg, unit, label);
92 }
93
86 @Override 94 @Override
87 protected final void writeCSVData(final CSVWriter writer) { 95 protected final void writeCSVData(final CSVWriter writer) {
88 getLog().info("writeCSVData"); 96 getLog().info("writeCSVData");
89 97
90 /* fetch calculation results */ 98 /* fetch calculation results */
226 writeCSVMetaEntry(writer, SInfoI18NStrings.CSV_META_RANGE, msg(SInfoI18NStrings.CSV_META_RANGE_LABEL), 234 writeCSVMetaEntry(writer, SInfoI18NStrings.CSV_META_RANGE, msg(SInfoI18NStrings.CSV_META_RANGE_LABEL),
227 getKmFormatter().format(calcRange.getMinimumDouble()), getKmFormatter().format(calcRange.getMaximumDouble())); 235 getKmFormatter().format(calcRange.getMinimumDouble()), getKmFormatter().format(calcRange.getMaximumDouble()));
228 } 236 }
229 237
230 protected final void writeCSVSoundingMetadata(final CSVWriter writer, final BedHeightInfo sounding) { 238 protected final void writeCSVSoundingMetadata(final CSVWriter writer, final BedHeightInfo sounding) {
239 writeCSVSoundingMetadata(writer, sounding, CSV_META_HEADER_SOUNDING);
240 }
241
242 protected final void writeCSVSoundingMetadata(final CSVWriter writer, final BedHeightInfo sounding, final String mainLabel) {
231 // "##METADATEN PEILUNG" 243 // "##METADATEN PEILUNG"
232 writeCSVMetaEntry(writer, CSV_META_HEADER_SOUNDING); 244 writeCSVMetaEntry(writer, mainLabel);
233 245
234 // "# Jahr der Peilung: " 246 // "# Jahr der Peilung: "
235 writeCSVMetaEntry(writer, CSV_META_HEADER_SOUNDING_YEAR, Integer.toString(sounding.getYear())); 247 writeCSVMetaEntry(writer, CSV_META_HEADER_SOUNDING_YEAR, Integer.toString(sounding.getYear()));
236 // "# Aufnahmeart: " 248 // "# Aufnahmeart: "
237 writeCSVMetaEntry(writer, CSV_META_HEADER_SOUNDING_TYPE, sounding.getType()); 249 writeCSVMetaEntry(writer, CSV_META_HEADER_SOUNDING_TYPE, sounding.getType());
244 // "# ursprüngliches Höhensystem: " 256 // "# ursprüngliches Höhensystem: "
245 writeCSVMetaEntry(writer, CSV_META_HEADER_SOUNDING_ELEVATIOIN_MODEL_ORIGINAL, sounding.getOldElevationModelUnit()); 257 writeCSVMetaEntry(writer, CSV_META_HEADER_SOUNDING_ELEVATIOIN_MODEL_ORIGINAL, sounding.getOldElevationModelUnit());
246 } 258 }
247 259
248 protected final void writeCSVWaterlevelMetadata(final CSVWriter writer, final WstInfo wst) { 260 protected final void writeCSVWaterlevelMetadata(final CSVWriter writer, final WstInfo wst) {
261 writeCSVWaterlevelMetadata(writer, wst, SInfoI18NStrings.CSV_META_HEADER_WATERLEVEL);
262 }
263
264 protected final void writeCSVWaterlevelMetadata(final CSVWriter writer, final WstInfo wst, final String mainLabel) {
249 // "##METADATEN WASSERSPIEGELLAGE" 265 // "##METADATEN WASSERSPIEGELLAGE"
250 writeCSVMetaEntry(writer, SInfoI18NStrings.CSV_META_HEADER_WATERLEVEL); 266 writeCSVMetaEntry(writer, mainLabel);
251 267
252 // "# Bezeichnung der Wasserspiegellage: " 268 // "# Bezeichnung der Wasserspiegellage: "
253 writeCSVMetaEntry(writer, SInfoI18NStrings.CSV_META_HEADER_WATERLEVEL_NAME, wst.getLabel()); 269 writeCSVMetaEntry(writer, SInfoI18NStrings.CSV_META_HEADER_WATERLEVEL_NAME, wst.getLabel());
254 270
255 // "# Bezugspegel: " 271 // "# Bezugspegel: "

http://dive4elements.wald.intevation.org