Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculationSupraRegionalResult.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 |
---|---|
9243 | 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.text.NumberFormat; | |
13 import java.util.Collection; | |
14 | |
15 import org.dive4elements.river.artifacts.common.ExportContextCSV; | |
16 import org.dive4elements.river.artifacts.common.IExportContext; | |
17 import org.dive4elements.river.artifacts.common.ResultRow; | |
18 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; | |
19 import org.dive4elements.river.artifacts.uinfo.commons.UInfoResultType; | |
20 | |
21 /** | |
22 * @author Domenico Nardi Tironi | |
23 */ | |
24 final class SalixLineCalculationSupraRegionalResult extends SalixLineCalculationNoScenarioResult { | |
25 | |
26 private static final long serialVersionUID = 1L; | |
27 | |
9316
72b3270e1568
U-Info salix line with regional and supraregional scenario calculation and chart display
mschaefer
parents:
9243
diff
changeset
|
28 public SalixLineCalculationSupraRegionalResult(final String label, final Collection<ResultRow> rows) { |
72b3270e1568
U-Info salix line with regional and supraregional scenario calculation and chart display
mschaefer
parents:
9243
diff
changeset
|
29 super(label, rows); |
9243 | 30 } |
31 | |
32 @Override | |
33 public void writeCSVHeader(final ExportContextCSV exportContextCSV, final RiverInfo river) { | |
34 | |
35 final Collection<String> header = super.writeNoScenarioHeader(exportContextCSV); | |
36 | |
37 header.add(exportContextCSV.formatCsvHeader(UInfoResultType.salix_line_scenario)); | |
38 header.add(exportContextCSV.formatCsvHeader(UInfoResultType.salix_line_scenario_dwspl)); | |
39 | |
40 exportContextCSV.writeCSVLine(header.toArray(new String[header.size()])); | |
41 } | |
42 | |
43 @Override | |
44 protected void writeCSVResultMetadata(final ExportContextCSV exportContextCSV) { | |
45 writeExtendedRegionalEffectsCSVMetadata(exportContextCSV); | |
46 exportContextCSV.writeBlankLine(); | |
47 | |
48 } | |
49 | |
50 @Override | |
9316
72b3270e1568
U-Info salix line with regional and supraregional scenario calculation and chart display
mschaefer
parents:
9243
diff
changeset
|
51 protected String[] formatRow(final IExportContext context, final ResultRow row) { |
9243 | 52 |
53 final Collection<String> lines = super.getNoScenarioFormat(row, context); | |
54 | |
55 if (context instanceof ExportContextCSV) { // enum gespart - pdf-export hat ja nur die drei spalten | |
56 final NumberFormat formatter = ((ExportContextCSV) context).getSalixScenFormatter(); | |
57 | |
58 lines.add(context.formatRowValue(row, UInfoResultType.salix_line_scenario)); | |
59 lines.add(context.formatRowValue(row, UInfoResultType.salix_line_scenario_dwspl)); | |
60 | |
61 } | |
62 return lines.toArray(new String[lines.size()]); | |
63 } | |
64 | |
65 private void writeExtendedRegionalEffectsCSVMetadata(final ExportContextCSV exportContextCSV) { | |
66 final String main = "uinfo.export.csv.meta.header.salix.regionalextended"; | |
67 // "##Überregional wirkende Eingriffe" | |
68 exportContextCSV.writeCSVMetaEntry(main); | |
69 | |
70 writeRegionalCommonCSVMeta(exportContextCSV); | |
71 } | |
72 } |