Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstMissVolCalculationResult2.java @ 9444:ecadc9ed0ba0
Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
author | mschaefer |
---|---|
date | Tue, 21 Aug 2018 13:41:18 +0200 |
parents | d194c5b24bf8 |
children | e60584f2a531 |
comparison
equal
deleted
inserted
replaced
9443:515643b2c49a | 9444:ecadc9ed0ba0 |
---|---|
1 /* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde | 1 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde |
2 * Software engineering by | 2 * Software engineering by |
3 * Björnsen Beratende Ingenieure GmbH | 3 * Björnsen Beratende Ingenieure GmbH |
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt | 4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt |
5 * | 5 * |
6 * This file is Free Software under the GNU AGPL (>=v3) | 6 * This file is Free Software under the GNU AGPL (>=v3) |
31 final class BezugswstMissVolCalculationResult2 extends AbstractCalculationExportableResult implements BunduWstExporter.MissResultType { | 31 final class BezugswstMissVolCalculationResult2 extends AbstractCalculationExportableResult implements BunduWstExporter.MissResultType { |
32 | 32 |
33 private static final long serialVersionUID = 1L; | 33 private static final long serialVersionUID = 1L; |
34 | 34 |
35 private static final String JASPER_FILE = "/jasper/templates/bundu.bezugswst.result2.jrxml"; | 35 private static final String JASPER_FILE = "/jasper/templates/bundu.bezugswst.result2.jrxml"; |
36 private static final String fieldMsgStr = "bundu.export.bezugswst.csv.meta.miss.field"; | 36 private static final String fieldVolumeMsgKey = "bundu.export.bezugswst.csv.meta.miss.volume.field"; |
37 private static final String fieldMassMsgKey = "bundu.export.bezugswst.csv.meta.miss.mass.field"; | |
37 private static final int fieldSize = 10; | 38 private static final int fieldSize = 10; |
38 | 39 |
39 public BezugswstMissVolCalculationResult2(final String label, final Collection<ResultRow> rows) { | 40 public BezugswstMissVolCalculationResult2(final String label, final Collection<ResultRow> rows) { |
40 super(label, rows); | 41 super(label, rows); |
41 | 42 |
54 protected String[] formatRow(final AbstractExportContext exportContext, final ResultRow row) { | 55 protected String[] formatRow(final AbstractExportContext exportContext, final ResultRow row) { |
55 | 56 |
56 final Collection<String> lines = new ArrayList<>(20); | 57 final Collection<String> lines = new ArrayList<>(20); |
57 | 58 |
58 lines.add(exportContext.formatRowValue(row, GeneralResultType.station)); | 59 lines.add(exportContext.formatRowValue(row, GeneralResultType.station)); |
59 final List<String> fields = (List<String>) row.getValue(BunduResultType.missVolumeFields); | 60 final List<String> vFields = (List<String>) row.getValue(BunduResultType.missVolumeFields); |
60 assert (fields.size() == fieldSize); // immer abgleichen mit der Calculation! | 61 assert (vFields.size() == fieldSize); // immer abgleichen mit der Calculation! |
61 for (final String field : fields) { | 62 final List<String> mFields = (List<String>) row.getValue(BunduResultType.missMassFields); |
62 lines.add(field); | 63 for (int i = 0; i <= vFields.size() - 1; i++) { |
64 lines.add(vFields.get(i)); | |
65 lines.add(mFields.get(i)); | |
63 } | 66 } |
64 lines.add(exportContext.formatRowValue(row, BunduResultType.missVolumeMeanBed)); | 67 lines.add(exportContext.formatRowValue(row, BunduResultType.missVolumeMeanBed)); |
65 lines.add(exportContext.formatRowValue(row, BunduResultType.missMassMeanBed)); | 68 lines.add(exportContext.formatRowValue(row, BunduResultType.missMassMeanBed)); |
66 | 69 |
67 return lines.toArray(new String[lines.size()]); | 70 return lines.toArray(new String[lines.size()]); |
68 } | 71 } |
69 | 72 |
70 @Override | 73 @Override |
71 public void writeCSVHeader(final ExportContextCSV exportContextCSV, final RiverInfo river) { | 74 public void writeCSVHeader(final ExportContextCSV exportContextCSV, final RiverInfo river) { |
72 | 75 |
73 final int colSize = fieldSize + 2; | 76 final int colSize = 2 * fieldSize + 2; |
74 exportContextCSV.writeTitleForTabs("bundu.export.csv.title.bezugswst.result2", colSize); // Voraussetzung für Tabs ist, dass der Titel vor den Headern | 77 exportContextCSV.writeTitleForTabs("bundu.export.csv.title.bezugswst.result2", colSize); // Voraussetzung für Tabs ist, dass der Titel vor den Headern |
75 final Collection<String> header = new ArrayList<>(colSize); | 78 final Collection<String> header = new ArrayList<>(colSize); |
76 | 79 |
77 header.add(exportContextCSV.formatCsvHeader(GeneralResultType.station)); | 80 header.add(exportContextCSV.formatCsvHeader(GeneralResultType.station)); |
78 | 81 |
79 for (int i = 1; i <= fieldSize; i++) { | 82 for (int i = 1; i <= fieldSize; i++) { |
80 header.add(exportContextCSV.msg(fieldMsgStr, i)); | 83 header.add(exportContextCSV.msg(fieldVolumeMsgKey, i)); |
84 header.add(exportContextCSV.msg(fieldMassMsgKey, i)); | |
81 } | 85 } |
82 header.add(exportContextCSV.formatCsvHeader(BunduResultType.missVolumeMeanBed)); | 86 header.add(exportContextCSV.formatCsvHeader(BunduResultType.missVolumeMeanBed)); |
83 header.add(exportContextCSV.formatCsvHeader(BunduResultType.missMassMeanBed)); | 87 header.add(exportContextCSV.formatCsvHeader(BunduResultType.missMassMeanBed)); |
84 | 88 |
85 exportContextCSV.writeCSVLine(header.toArray(new String[header.size()])); | 89 exportContextCSV.writeCSVLine(header.toArray(new String[header.size()])); |
102 protected void addJRTableHeader(final ExportContextPDF exportContextPDF, final MetaAndTableJRDataSource source) { | 106 protected void addJRTableHeader(final ExportContextPDF exportContextPDF, final MetaAndTableJRDataSource source) { |
103 /* column headings */ | 107 /* column headings */ |
104 | 108 |
105 exportContextPDF.addJRMetadata(source, "station_header", GeneralResultType.station); | 109 exportContextPDF.addJRMetadata(source, "station_header", GeneralResultType.station); |
106 for (int i = 1; i <= fieldSize; i++) { | 110 for (int i = 1; i <= fieldSize; i++) { |
107 exportContextPDF.addJRMetadata(source, "field_header" + String.valueOf(i), exportContextPDF.msg(fieldMsgStr, i)); | 111 exportContextPDF.addJRMetadata(source, "field_header" + String.valueOf(i), exportContextPDF.msg(fieldVolumeMsgKey, i)); |
112 exportContextPDF.addJRMetadata(source, "field_header" + String.valueOf(i), exportContextPDF.msg(fieldMassMsgKey, i)); | |
108 } | 113 } |
109 exportContextPDF.addJRMetadata(source, "mean_bedheight_header", BunduResultType.missVolumeMeanBed); | 114 exportContextPDF.addJRMetadata(source, "mean_bedheight_header", BunduResultType.missVolumeMeanBed); |
110 exportContextPDF.addJRMetadata(source, "mean_bedheight_header", BunduResultType.missMassMeanBed); | 115 exportContextPDF.addJRMetadata(source, "mean_bedheight_header", BunduResultType.missMassMeanBed); |
111 | 116 |
112 } | 117 } |