Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionCalcDetailResult.java @ 9582:8b457ca70512
Punkt 8.1 Grundberührungen Header
author | gernotbelger |
---|---|
date | Wed, 09 Jan 2019 14:47:21 +0100 |
parents | 7b2b086e45f0 |
children |
rev | line source |
---|---|
9150 | 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.collision; | |
11 | |
12 import java.util.ArrayList; | |
13 import java.util.Collection; | |
14 | |
15 import org.dive4elements.river.artifacts.common.AbstractCalculationExportableResult; | |
16 import org.dive4elements.river.artifacts.common.ExportContextCSV; | |
9195 | 17 import org.dive4elements.river.artifacts.common.ExportContextPDF; |
9150 | 18 import org.dive4elements.river.artifacts.common.GeneralResultType; |
9195 | 19 import org.dive4elements.river.artifacts.common.IExportContext; |
9150 | 20 import org.dive4elements.river.artifacts.common.MetaAndTableJRDataSource; |
21 import org.dive4elements.river.artifacts.common.ResultRow; | |
9157
f9bb5d0a6ff3
Added the S-Info collision calculation and chart output
mschaefer
parents:
9150
diff
changeset
|
22 import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType; |
9150 | 23 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; |
24 | |
25 /** | |
26 * Contains the results of a {@link FloodDurationCalculation}. | |
27 * | |
28 * @author Gernot Belger | |
29 */ | |
9195 | 30 final class CollisionCalcDetailResult extends AbstractCalculationExportableResult { |
9150 | 31 |
32 private static final long serialVersionUID = 1L; | |
33 private static final String JASPER_FILE = "/jasper/templates/sinfo.collision.detail.jrxml"; | |
34 | |
35 public CollisionCalcDetailResult(final String label, final Collection<ResultRow> rows) { | |
36 super(label, rows); | |
37 } | |
38 | |
39 @Override | |
9195 | 40 protected void writeCSVResultMetadata(final ExportContextCSV exportContextCSV) { |
9171 | 41 |
9172 | 42 // do nothing so far |
9150 | 43 } |
44 | |
45 @Override | |
9195 | 46 public void writeCSVHeader(final ExportContextCSV exportContextCSV, final RiverInfo river) { |
9150 | 47 |
9171 | 48 final int colSize = 6; |
49 exportContextCSV.writeTitleForTabs("sinfo.export.csv.title.collision.detail", 6); // Voraussetzung für Tabs ist, dass der Titel vor den Headern | |
9176
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9172
diff
changeset
|
50 // geschrieben wird. |
9171 | 51 // Das ist etwas doof. |
52 | |
53 final Collection<String> header = new ArrayList<>(colSize); | |
9150 | 54 |
55 header.add(exportContextCSV.formatCsvHeader(GeneralResultType.station)); | |
9318
7b2b086e45f0
collision pdf details, ResultType refactoring, bezugswst result
gernotbelger
parents:
9195
diff
changeset
|
56 header.add(exportContextCSV.formatCsvHeader(GeneralResultType.dateShort)); |
9176
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9172
diff
changeset
|
57 header.add(exportContextCSV.msgUnitCSV(SInfoResultType.collisionGaugeW, SInfoResultType.collisionGaugeW.getUnit())); |
9582 | 58 header.add(exportContextCSV.formatCsvHeader(GeneralResultType.gaugeLabel)); |
9318
7b2b086e45f0
collision pdf details, ResultType refactoring, bezugswst result
gernotbelger
parents:
9195
diff
changeset
|
59 header.add(exportContextCSV.msgUnitCSV(SInfoResultType.dischargeLong, SInfoResultType.dischargeLong.getUnit())); |
9157
f9bb5d0a6ff3
Added the S-Info collision calculation and chart output
mschaefer
parents:
9150
diff
changeset
|
60 header.add(exportContextCSV.formatCsvHeader(SInfoResultType.dischargeZone)); |
9150 | 61 |
9171 | 62 exportContextCSV.writeCSVLine(header.toArray(new String[colSize])); |
9150 | 63 } |
64 | |
65 @Override | |
9195 | 66 protected String[] formatCSVRow(final ExportContextCSV exportContextCSV, final ResultRow row) { |
67 return formatRow(exportContextCSV, row); | |
9150 | 68 } |
69 | |
70 @Override | |
9195 | 71 protected String[] formatPDFRow(final ExportContextPDF exportContextCSV, final ResultRow row) { |
9157
f9bb5d0a6ff3
Added the S-Info collision calculation and chart output
mschaefer
parents:
9150
diff
changeset
|
72 /* |
f9bb5d0a6ff3
Added the S-Info collision calculation and chart output
mschaefer
parents:
9150
diff
changeset
|
73 * final Collection<String> lines = new ArrayList<>(6); |
9318
7b2b086e45f0
collision pdf details, ResultType refactoring, bezugswst result
gernotbelger
parents:
9195
diff
changeset
|
74 * lines.add(exportContextCSV.formatRowValue(row, BunduResultType.station)); |
9157
f9bb5d0a6ff3
Added the S-Info collision calculation and chart output
mschaefer
parents:
9150
diff
changeset
|
75 * return lines.toArray(new String[lines.size()]); |
f9bb5d0a6ff3
Added the S-Info collision calculation and chart output
mschaefer
parents:
9150
diff
changeset
|
76 */ |
9195 | 77 return formatRow(exportContextCSV, row); |
9150 | 78 } |
79 | |
9195 | 80 private String[] formatRow(final IExportContext exportContext, final ResultRow row) { |
9150 | 81 |
9157
f9bb5d0a6ff3
Added the S-Info collision calculation and chart output
mschaefer
parents:
9150
diff
changeset
|
82 final Collection<String> lines = new ArrayList<>(6); |
9150 | 83 |
9195 | 84 lines.add(exportContext.formatRowValue(row, GeneralResultType.station)); |
9318
7b2b086e45f0
collision pdf details, ResultType refactoring, bezugswst result
gernotbelger
parents:
9195
diff
changeset
|
85 lines.add(exportContext.formatRowValue(row, GeneralResultType.dateShort)); |
9195 | 86 lines.add(exportContext.formatRowValue(row, SInfoResultType.collisionGaugeW)); |
9582 | 87 lines.add(exportContext.formatRowValue(row, GeneralResultType.gaugeLabel)); |
9318
7b2b086e45f0
collision pdf details, ResultType refactoring, bezugswst result
gernotbelger
parents:
9195
diff
changeset
|
88 lines.add(exportContext.formatRowValue(row, SInfoResultType.dischargeLong)); |
9195 | 89 lines.add(exportContext.formatRowValue(row, SInfoResultType.dischargeZone)); |
9150 | 90 |
91 return lines.toArray(new String[lines.size()]); | |
92 } | |
93 | |
94 @Override | |
95 protected String getJasperFile() { | |
96 return JASPER_FILE; | |
97 } | |
98 | |
99 @Override | |
9195 | 100 protected void addJRTableHeader(final ExportContextPDF exportContextCSV, final MetaAndTableJRDataSource source) { |
9150 | 101 |
102 /* column headings */ | |
103 exportContextCSV.addJRMetadata(source, "station_header", GeneralResultType.station); | |
9318
7b2b086e45f0
collision pdf details, ResultType refactoring, bezugswst result
gernotbelger
parents:
9195
diff
changeset
|
104 exportContextCSV.addJRMetadata(source, "date_header", GeneralResultType.dateShort); |
9157
f9bb5d0a6ff3
Added the S-Info collision calculation and chart output
mschaefer
parents:
9150
diff
changeset
|
105 exportContextCSV.addJRMetadata(source, "gaugew_header", SInfoResultType.collisionGaugeW); |
9582 | 106 exportContextCSV.addJRMetadata(source, "gauge_header", GeneralResultType.gaugeLabel); |
9318
7b2b086e45f0
collision pdf details, ResultType refactoring, bezugswst result
gernotbelger
parents:
9195
diff
changeset
|
107 exportContextCSV.addJRMetadata(source, "discharge_header", SInfoResultType.dischargeLong); |
9157
f9bb5d0a6ff3
Added the S-Info collision calculation and chart output
mschaefer
parents:
9150
diff
changeset
|
108 exportContextCSV.addJRMetadata(source, "dischargezone_header", SInfoResultType.dischargeZone); |
9150 | 109 } |
110 } |