Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculationResult.java @ 9202:b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
author | mschaefer |
---|---|
date | Mon, 02 Jul 2018 07:33:53 +0200 |
parents | a4121ec450d6 |
children | 3dae6b78e1da |
rev | line source |
---|---|
9145 | 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.sinfo.flood_duration; | |
11 | |
9150
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9145
diff
changeset
|
12 import java.util.ArrayList; |
9145 | 13 import java.util.Collection; |
9202
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
14 import java.util.Collections; |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
15 import java.util.List; |
9145 | 16 |
9176
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
17 import org.dive4elements.river.artifacts.common.AbstractCalculationExportableResult; |
9150
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9145
diff
changeset
|
18 import org.dive4elements.river.artifacts.common.ExportContextCSV; |
9195 | 19 import org.dive4elements.river.artifacts.common.ExportContextPDF; |
9150
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9145
diff
changeset
|
20 import org.dive4elements.river.artifacts.common.GeneralResultType; |
9195 | 21 import org.dive4elements.river.artifacts.common.IExportContext; |
9202
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
22 import org.dive4elements.river.artifacts.common.IResultType; |
9150
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9145
diff
changeset
|
23 import org.dive4elements.river.artifacts.common.MetaAndTableJRDataSource; |
9145 | 24 import org.dive4elements.river.artifacts.common.ResultRow; |
9202
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
25 import org.dive4elements.river.artifacts.sinfo.common.SInfoI18NStrings; |
9150
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9145
diff
changeset
|
26 import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType; |
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9145
diff
changeset
|
27 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; |
9145 | 28 |
9202
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
29 import gnu.trove.TDoubleArrayList; |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
30 |
9145 | 31 /** |
9176
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
32 * Contains the result of a {@link FloodDurationCalculation}. |
9145 | 33 * |
34 * @author Gernot Belger | |
35 */ | |
9202
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
36 public final class FloodDurationCalculationResult extends AbstractCalculationExportableResult { |
9145 | 37 |
38 private static final long serialVersionUID = 1L; | |
9150
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9145
diff
changeset
|
39 |
9176
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
40 private static final String JASPER_FILE = "/jasper/templates/sinfo.floodduration.jrxml"; |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
41 |
9202
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
42 private final String[] mainvalueLabels; |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
43 |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
44 public FloodDurationCalculationResult(final String label, final String[] mainvalueLabels, final Collection<ResultRow> rows) { |
9176
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
45 super(label, rows); |
9202
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
46 this.mainvalueLabels = mainvalueLabels; |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
47 } |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
48 |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
49 /** |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
50 * The label of one of the optional main values, or null |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
51 */ |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
52 public String getMainValueLabel(final int index) { |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
53 if (index <= this.mainvalueLabels.length - 1) |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
54 return this.mainvalueLabels[index]; |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
55 else |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
56 return null; |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
57 } |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
58 |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
59 /** |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
60 * Collection of the result rows containing only the rows describing an infrastructure |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
61 */ |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
62 @Override |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
63 public Collection<ResultRow> getRows() { |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
64 final List<ResultRow> infrasOnlyRows = new ArrayList<>(); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
65 for (final ResultRow row : this.rows) |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
66 if (row.getValue(SInfoResultType.infrastructuretype) != null) |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
67 infrasOnlyRows.add(row); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
68 return Collections.unmodifiableCollection(infrasOnlyRows); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
69 } |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
70 |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
71 /** |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
72 * Fetches the km-longitudinal section of the infrastructures and one of their result fields |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
73 */ |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
74 public final double[][] fetchInfrastructurePoints(final IResultType type) { |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
75 final TDoubleArrayList xPoints = new TDoubleArrayList(this.rows.size()); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
76 final TDoubleArrayList yPoints = new TDoubleArrayList(this.rows.size()); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
77 for (final ResultRow row : this.rows) { |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
78 if (row.getValue(SInfoResultType.infrastructuretype) != null) { |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
79 xPoints.add(row.getDoubleValue(GeneralResultType.station)); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
80 yPoints.add(row.getDoubleValue(type)); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
81 } |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
82 } |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
83 return new double[][] { xPoints.toNativeArray(), yPoints.toNativeArray() }; |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
84 } |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
85 |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
86 /** |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
87 * Fetches the km-longitudinal section of a main value |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
88 */ |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
89 public final double[][] fetchMainValuePoints(final IResultType type) { |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
90 final TDoubleArrayList xPoints = new TDoubleArrayList(this.rows.size()); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
91 final TDoubleArrayList yPoints = new TDoubleArrayList(this.rows.size()); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
92 // final IResultType check = new IResultType[] { SInfoResultType.mainValue1Duration, SInfoResultType.mainValue2Duration, |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
93 // SInfoResultType.mainValue3Duration }[index]; |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
94 for (final ResultRow row : this.rows) { |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
95 // if (!Double.isNaN(row.getDoubleValue(check))) { |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
96 xPoints.add(row.getDoubleValue(GeneralResultType.station)); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
97 yPoints.add(row.getDoubleValue(type)); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
98 // } |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
99 } |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
100 return new double[][] { xPoints.toNativeArray(), yPoints.toNativeArray() }; |
9150
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9145
diff
changeset
|
101 } |
9145 | 102 |
9176
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
103 @Override |
9195 | 104 protected void writeCSVResultMetadata(final ExportContextCSV exportContextCSV) { |
9202
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
105 if (this.mainvalueLabels.length >= 1) { |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
106 // "##METADATEN WASSERSPIEGELLAGE" |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
107 exportContextCSV.writeCSVMetaEntry(SInfoI18NStrings.CSV_META_HEADER_WATERLEVEL); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
108 for (int i = 1; i <= this.mainvalueLabels.length; i++) { |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
109 // "# Bezeichnung der Wasserspiegellage: " |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
110 final String label = this.getMainValueLabel(i - 1); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
111 exportContextCSV.writeCSVMetaEntry(SInfoI18NStrings.CSV_META_HEADER_WATERLEVEL_NAME, String.format("%d: %s", i, label)); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
112 } |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
113 // "# Bezugspegel: " |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
114 exportContextCSV.writeCSVMetaEntry(SInfoI18NStrings.CSV_META_HEADER_WATERLEVEL_GAUGE, "TODO: gauge"); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
115 } |
9176
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
116 } |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
117 |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
118 @Override |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
119 protected String getJasperFile() { |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
120 // TODO Variante mit Wasserspiegellage(n) |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
121 return JASPER_FILE; |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
122 } |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
123 |
9195 | 124 protected String[] formatRow(final IExportContext exportContextCSV, final ResultRow row) { |
9176
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
125 |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
126 final Collection<String> lines = new ArrayList<>(10); |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
127 |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
128 lines.add(exportContextCSV.formatRowValue(row, GeneralResultType.station)); |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
129 lines.add(exportContextCSV.formatRowValue(row, SInfoResultType.riverside)); |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
130 lines.add(exportContextCSV.formatRowValue(row, SInfoResultType.floodDuration)); |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
131 lines.add(exportContextCSV.formatRowValue(row, SInfoResultType.floodDischarge)); |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
132 lines.add(exportContextCSV.formatRowValue(row, SInfoResultType.infrastructureHeight)); |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
133 lines.add(exportContextCSV.formatRowValue(row, SInfoResultType.infrastructuretype)); |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
134 |
9202
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
135 if (this.getMainValueLabel(0) != null) { |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
136 lines.add(exportContextCSV.formatRowValue(row, SInfoResultType.waterlevel1)); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
137 lines.add(exportContextCSV.formatRowValue(row, SInfoResultType.mainValue1Duration)); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
138 lines.add(exportContextCSV.formatRowValue(row, SInfoResultType.discharge1)); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
139 if (this.getMainValueLabel(1) != null) { |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
140 lines.add(exportContextCSV.formatRowValue(row, SInfoResultType.waterlevel2)); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
141 lines.add(exportContextCSV.formatRowValue(row, SInfoResultType.mainValue2Duration)); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
142 lines.add(exportContextCSV.formatRowValue(row, SInfoResultType.discharge2)); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
143 if (this.getMainValueLabel(2) != null) { |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
144 lines.add(exportContextCSV.formatRowValue(row, SInfoResultType.waterlevel3)); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
145 lines.add(exportContextCSV.formatRowValue(row, SInfoResultType.mainValue3Duration)); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
146 lines.add(exportContextCSV.formatRowValue(row, SInfoResultType.discharge3)); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
147 } |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
148 } |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
149 } |
9176
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
150 |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
151 lines.add(exportContextCSV.formatRowValue(row, SInfoResultType.gaugeLabel)); |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
152 lines.add(exportContextCSV.formatRowValue(row, SInfoResultType.location)); |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
153 |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
154 return lines.toArray(new String[lines.size()]); |
9150
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9145
diff
changeset
|
155 } |
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9145
diff
changeset
|
156 |
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9145
diff
changeset
|
157 @Override |
9195 | 158 public void writeCSVHeader(final ExportContextCSV exportContextCSV, final RiverInfo river) { |
9150
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9145
diff
changeset
|
159 |
9176
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
160 final Collection<String> header = new ArrayList<>(20); |
9150
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9145
diff
changeset
|
161 |
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9145
diff
changeset
|
162 header.add(exportContextCSV.formatCsvHeader(GeneralResultType.station)); |
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9145
diff
changeset
|
163 header.add(exportContextCSV.formatCsvHeader(SInfoResultType.riverside)); |
9176
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
164 header.add(exportContextCSV.formatCsvHeader(SInfoResultType.floodDuration)); |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
165 header.add(exportContextCSV.msgUnitCSV(SInfoResultType.floodDischarge, SInfoResultType.floodDischarge.getUnit())); |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
166 header.add(exportContextCSV.msgUnitCSV(SInfoResultType.infrastructureHeight, SInfoResultType.infrastructureHeight.getUnit())); |
9150
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9145
diff
changeset
|
167 header.add(exportContextCSV.formatCsvHeader(SInfoResultType.infrastructuretype)); |
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9145
diff
changeset
|
168 |
9202
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
169 if (this.getMainValueLabel(0) != null) { |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
170 header.add(exportContextCSV.msgUnitCSV(SInfoResultType.waterlevel1, SInfoResultType.waterlevel.getUnit())); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
171 header.add(exportContextCSV.formatCsvHeader(SInfoResultType.mainValue1Duration)); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
172 header.add(exportContextCSV.msgUnitCSV(SInfoResultType.discharge1, SInfoResultType.discharge.getUnit())); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
173 if (this.getMainValueLabel(1) != null) { |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
174 header.add(exportContextCSV.msgUnitCSV(SInfoResultType.waterlevel2, SInfoResultType.waterlevel2.getUnit())); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
175 header.add(exportContextCSV.formatCsvHeader(SInfoResultType.mainValue2Duration)); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
176 header.add(exportContextCSV.msgUnitCSV(SInfoResultType.discharge2, SInfoResultType.discharge2.getUnit())); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
177 if (this.getMainValueLabel(2) != null) { |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
178 header.add(exportContextCSV.msgUnitCSV(SInfoResultType.waterlevel3, SInfoResultType.waterlevel3.getUnit())); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
179 header.add(exportContextCSV.formatCsvHeader(SInfoResultType.mainValue3Duration)); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
180 header.add(exportContextCSV.msgUnitCSV(SInfoResultType.discharge3, SInfoResultType.discharge3.getUnit())); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
181 } |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
182 } |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
183 } |
9150
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9145
diff
changeset
|
184 |
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9145
diff
changeset
|
185 header.add(exportContextCSV.formatCsvHeader(SInfoResultType.gaugeLabel)); |
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9145
diff
changeset
|
186 header.add(exportContextCSV.formatCsvHeader(SInfoResultType.location)); |
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9145
diff
changeset
|
187 |
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9145
diff
changeset
|
188 exportContextCSV.writeCSVLine(header.toArray(new String[header.size()])); |
9145 | 189 |
190 } | |
191 | |
9150
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9145
diff
changeset
|
192 @Override |
9195 | 193 protected String[] formatCSVRow(final ExportContextCSV exportContextCSV, final ResultRow row) { |
9150
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9145
diff
changeset
|
194 |
9195 | 195 return this.formatRow(exportContextCSV, row); |
9150
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9145
diff
changeset
|
196 } |
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9145
diff
changeset
|
197 |
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9145
diff
changeset
|
198 @Override |
9195 | 199 protected String[] formatPDFRow(final ExportContextPDF exportContextPDF, final ResultRow row) { |
9150
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9145
diff
changeset
|
200 |
9195 | 201 return this.formatRow(exportContextPDF, row); |
9145 | 202 } |
203 | |
9176
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
204 @Override |
9195 | 205 protected void addJRTableHeader(final ExportContextPDF exportContextPDF, final MetaAndTableJRDataSource source) { |
9150
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9145
diff
changeset
|
206 |
9176
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
207 /* column headings */ |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
208 exportContextPDF.addJRMetadata(source, "station_header", GeneralResultType.station); |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
209 exportContextPDF.addJRMetadata(source, "riverside_header", SInfoResultType.riverside); |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
210 exportContextPDF.addJRMetadata(source, "inundationduration_header", SInfoResultType.floodDuration); |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
211 exportContextPDF.addJRMetadata(source, "inundationduration_q_header", SInfoResultType.floodDischarge); |
9202
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
212 exportContextPDF.addJRMetadata(source, "infrastructure_height_header", SInfoResultType.infrastructureHeight); |
9176
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
213 exportContextPDF.addJRMetadata(source, "infrastructure_type_header", SInfoResultType.infrastructuretype); |
9150
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9145
diff
changeset
|
214 |
9202
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
215 // TODO Feldnamen ergaenzen und aktivieren wenn Report fertig |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
216 // if (this.getMainValueLabel(0) != null) { |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
217 // exportContextPDF.addJRMetadata(source, "?", SInfoResultType.waterlevel); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
218 // exportContextPDF.addJRMetadata(source, "?", SInfoResultType.mainValue1Duration); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
219 // exportContextPDF.addJRMetadata(source, "?", SInfoResultType.discharge); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
220 // if (this.getMainValueLabel(1) != null) { |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
221 // exportContextPDF.addJRMetadata(source, "?", SInfoResultType.waterlevel2); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
222 // exportContextPDF.addJRMetadata(source, "?", SInfoResultType.mainValue2Duration); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
223 // exportContextPDF.addJRMetadata(source, "?", SInfoResultType.discharge2); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
224 // if (this.getMainValueLabel(2) != null) { |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
225 // exportContextPDF.addJRMetadata(source, "?", SInfoResultType.waterlevel3); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
226 // exportContextPDF.addJRMetadata(source, "?", SInfoResultType.mainValue3Duration); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
227 // exportContextPDF.addJRMetadata(source, "?", SInfoResultType.discharge3); |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
228 // } |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
229 // } |
b4402594213b
More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
mschaefer
parents:
9195
diff
changeset
|
230 // } |
9150
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9145
diff
changeset
|
231 |
9176
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
232 exportContextPDF.addJRMetadata(source, "gauge_header", SInfoResultType.gaugeLabel); |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9170
diff
changeset
|
233 exportContextPDF.addJRMetadata(source, "location_header", SInfoResultType.location); |
9150
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9145
diff
changeset
|
234 } |
9145 | 235 } |