Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculationHistoricalResult.java @ 9319:c36befc9011c
Salix: Fixed ArrrayoutOfBoundsException; minor cleanup
author | gernotbelger |
---|---|
date | Fri, 27 Jul 2018 10:18:18 +0200 |
parents | 72b3270e1568 |
children | b3d3c958a594 |
rev | line source |
---|---|
9249 | 1 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde |
2 * Software engineering by | |
3 * Björnsen Beratende Ingenieure GmbH | |
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt | |
5 * | |
6 * This file is Free Software under the GNU AGPL (>=v3) | |
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the | |
8 * documentation coming with Dive4Elements River for details. | |
9 */ | |
10 package org.dive4elements.river.artifacts.uinfo.salix; | |
11 | |
12 import java.util.Collection; | |
13 | |
14 import org.dive4elements.river.artifacts.common.ExportContextCSV; | |
15 import org.dive4elements.river.artifacts.common.IExportContext; | |
16 import org.dive4elements.river.artifacts.common.ResultRow; | |
17 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; | |
18 import org.dive4elements.river.artifacts.uinfo.commons.UInfoResultType; | |
19 | |
20 /** | |
21 * @author Domenico Nardi Tironi | |
22 */ | |
23 final class SalixLineCalculationHistoricalResult extends SalixLineCalculationNoScenarioResult { | |
24 | |
25 private static final long serialVersionUID = 1L; | |
26 | |
9316
72b3270e1568
U-Info salix line with regional and supraregional scenario calculation and chart display
mschaefer
parents:
9249
diff
changeset
|
27 public SalixLineCalculationHistoricalResult(final String label, final Collection<ResultRow> rows) { |
72b3270e1568
U-Info salix line with regional and supraregional scenario calculation and chart display
mschaefer
parents:
9249
diff
changeset
|
28 super(label, rows); |
9249 | 29 } |
30 | |
31 @Override | |
32 public void writeCSVHeader(final ExportContextCSV exportContextCSV, final RiverInfo river) { | |
33 | |
34 final Collection<String> header = super.writeNoScenarioHeader(exportContextCSV); | |
35 | |
36 header.add(exportContextCSV.formatCsvHeader(UInfoResultType.salixlinehist)); | |
37 header.add(exportContextCSV.formatCsvHeader(UInfoResultType.salix_line_scenario_dwspl)); | |
38 | |
39 exportContextCSV.writeCSVLine(header.toArray(new String[header.size()])); | |
40 } | |
41 | |
42 @Override | |
43 protected void writeCSVResultMetadata(final ExportContextCSV exportContextCSV) { | |
44 writeHistoricalViewCSVMetadata(exportContextCSV); | |
45 exportContextCSV.writeBlankLine(); | |
46 } | |
47 | |
48 @Override | |
9316
72b3270e1568
U-Info salix line with regional and supraregional scenario calculation and chart display
mschaefer
parents:
9249
diff
changeset
|
49 protected String[] formatRow(final IExportContext context, final ResultRow row) { |
9249 | 50 |
51 final Collection<String> lines = super.getNoScenarioFormat(row, context); | |
52 | |
53 if (context instanceof ExportContextCSV) { // enum gespart - pdf-export hat ja nur die drei spalten | |
54 lines.add(context.formatRowValue(row, UInfoResultType.salixlinehist)); | |
55 lines.add(context.formatRowValue(row, UInfoResultType.salix_line_scenario_dwspl)); | |
56 | |
57 } | |
58 return lines.toArray(new String[lines.size()]); | |
59 } | |
60 | |
61 private void writeHistoricalViewCSVMetadata(final ExportContextCSV exportContextCSV) { | |
62 final String main = "uinfo.export.csv.meta.header.salix.historical"; | |
63 // "##Historische Betrachtung" | |
64 exportContextCSV.writeCSVMetaEntry(main); | |
65 | |
66 final String mainSub = "uinfo.export.csv.meta.header.salix"; | |
67 // "# Teilabschnitt: " | |
68 exportContextCSV.writeCSVMetaEntry(mainSub + ".teilabschnitt"); | |
69 | |
70 // "# Historischer Zeitpunkt: " | |
71 exportContextCSV.writeCSVMetaEntry(main + ".zeitpunkt"); | |
72 } | |
73 } |