annotate artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxExporter.java @ 9006:7134a4c7d1b6

U-Info S-Info general work
author gernotbelger
date Tue, 17 Apr 2018 13:20:25 +0200
parents d5802f22e4f5
children 23945061daec
rev   line source
8946
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
2 * Software engineering by Intevation GmbH
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
3 *
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
6 * documentation coming with Dive4Elements River for details.
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
7 */
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
8
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
9 package org.dive4elements.river.artifacts.sinfo.flowdepthminmax;
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
10
9006
7134a4c7d1b6 U-Info S-Info general work
gernotbelger
parents: 8997
diff changeset
11 import java.io.OutputStream;
8946
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
12 import java.util.ArrayList;
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
13 import java.util.Collection;
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
14
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
15 import org.apache.log4j.Logger;
8997
d5802f22e4f5 Work on uinfo
gernotbelger
parents: 8993
diff changeset
16 import org.dive4elements.river.artifacts.common.GeneralResultType;
9006
7134a4c7d1b6 U-Info S-Info general work
gernotbelger
parents: 8997
diff changeset
17 import org.dive4elements.river.artifacts.common.JasperReporter;
7134a4c7d1b6 U-Info S-Info general work
gernotbelger
parents: 8997
diff changeset
18 import org.dive4elements.river.artifacts.common.MetaAndTableJRDataSource;
8997
d5802f22e4f5 Work on uinfo
gernotbelger
parents: 8993
diff changeset
19 import org.dive4elements.river.artifacts.common.ResultRow;
8946
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
20 import org.dive4elements.river.artifacts.sinfo.common.AbstractSInfoExporter;
8948
a4f1ac81f26d Work on SINFO-FlowDepthMinMax.
gernotbelger
parents: 8946
diff changeset
21 import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType;
8946
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
22 import org.dive4elements.river.artifacts.sinfo.util.BedHeightInfo;
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
23 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo;
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
24 import org.dive4elements.river.artifacts.sinfo.util.WstInfo;
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
25
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
26 import au.com.bytecode.opencsv.CSVWriter;
9006
7134a4c7d1b6 U-Info S-Info general work
gernotbelger
parents: 8997
diff changeset
27 import net.sf.jasperreports.engine.JRException;
8946
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
28
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
29 /**
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
30 * Generates different output formats (csv, pdf) of data that resulted from a flow depths computation.
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
31 *
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
32 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
33 * @author Gernot Belger
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
34 */
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
35 // REMARK: must be public because its registered in generators.xml
8948
a4f1ac81f26d Work on SINFO-FlowDepthMinMax.
gernotbelger
parents: 8946
diff changeset
36 public class FlowDepthMinMaxExporter extends AbstractSInfoExporter<FlowDepthMinMaxCalculationResult, FlowDepthMinMaxCalculationResults> {
8946
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
37
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
38 /** The log used in this exporter. */
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
39 private static Logger log = Logger.getLogger(FlowDepthMinMaxExporter.class);
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
40
9006
7134a4c7d1b6 U-Info S-Info general work
gernotbelger
parents: 8997
diff changeset
41 private static final String JASPER_FILE = "/jasper/templates/sinfo.flowdepthminmax.jrxml";
8946
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
42
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
43 @Override
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
44 protected Logger getLog() {
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
45 return log;
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
46 }
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
47
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
48 @Override
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
49 protected void writeCSVResultMetadata(final CSVWriter writer, final FlowDepthMinMaxCalculationResults results,
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
50 final FlowDepthMinMaxCalculationResult result) {
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
51
8993
0adc6d04de95 SInfo - FlowDepthMinMax: choosing bed heights, not bed height min and max separately
gernotbelger
parents: 8949
diff changeset
52 final BedHeightInfo sounding = result.getSounding();
8946
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
53 super.writeCSVSoundingMetadata(writer, sounding);
8997
d5802f22e4f5 Work on uinfo
gernotbelger
parents: 8993
diff changeset
54 writer.writeNext(new String[] { "" }); // break line
8946
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
55 final WstInfo wst = result.getWst();
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
56 writeCSVWaterlevelMetadata(writer, wst);
9006
7134a4c7d1b6 U-Info S-Info general work
gernotbelger
parents: 8997
diff changeset
57 writer.writeNext(new String[] { "" }); // break line
8946
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
58 }
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
59
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
60 @Override
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
61 protected void writeCSVGlobalMetadata(final CSVWriter writer, final FlowDepthMinMaxCalculationResults results) {
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
62
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
63 super.writeCSVGlobalMetadataDefaults(writer, results);
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
64 }
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
65
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
66 /**
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
67 * Write the header, with different headings depending on whether at a
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
68 * gauge or at a location.
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
69 *
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
70 * @param river
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
71 * @param useTkh
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
72 */
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
73 @Override
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
74 protected void writeCSVHeader(final CSVWriter writer, final FlowDepthMinMaxCalculationResults results, final RiverInfo river) {
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
75 log.info("FlowDepthExporter.writeCSVHeader");
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
76
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
77 final Collection<String> header = new ArrayList<>(11);
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
78
8997
d5802f22e4f5 Work on uinfo
gernotbelger
parents: 8993
diff changeset
79 header.add(msg(GeneralResultType.station.getCsvHeader()));
8948
a4f1ac81f26d Work on SINFO-FlowDepthMinMax.
gernotbelger
parents: 8946
diff changeset
80 header.add(msgUnit(SInfoResultType.flowdepthmin.getCsvHeader(), SInfoResultType.flowdepthmin.getUnit()));
a4f1ac81f26d Work on SINFO-FlowDepthMinMax.
gernotbelger
parents: 8946
diff changeset
81 header.add(msgUnit(SInfoResultType.flowdepthmax.getCsvHeader(), SInfoResultType.flowdepthmax.getUnit()));
a4f1ac81f26d Work on SINFO-FlowDepthMinMax.
gernotbelger
parents: 8946
diff changeset
82 header.add(msgUnit(SInfoResultType.waterlevel.getCsvHeader(), river.getWstUnit()));
a4f1ac81f26d Work on SINFO-FlowDepthMinMax.
gernotbelger
parents: 8946
diff changeset
83 header.add(msgUnit(SInfoResultType.discharge.getCsvHeader(), SInfoResultType.discharge.getUnit()));
a4f1ac81f26d Work on SINFO-FlowDepthMinMax.
gernotbelger
parents: 8946
diff changeset
84 header.add(msg(SInfoResultType.waterlevelLabel.getCsvHeader()));
a4f1ac81f26d Work on SINFO-FlowDepthMinMax.
gernotbelger
parents: 8946
diff changeset
85 header.add(msg(SInfoResultType.gaugeLabel.getCsvHeader()));
a4f1ac81f26d Work on SINFO-FlowDepthMinMax.
gernotbelger
parents: 8946
diff changeset
86 header.add(msgUnit(SInfoResultType.meanBedHeight.getCsvHeader(), river.getWstUnit()));
a4f1ac81f26d Work on SINFO-FlowDepthMinMax.
gernotbelger
parents: 8946
diff changeset
87 header.add(msg(SInfoResultType.soundingLabel.getCsvHeader()));
a4f1ac81f26d Work on SINFO-FlowDepthMinMax.
gernotbelger
parents: 8946
diff changeset
88 header.add(msg(SInfoResultType.location.getCsvHeader()));
8946
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
89
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
90 writer.writeNext(header.toArray(new String[header.size()]));
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
91 }
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
92
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
93 /**
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
94 * Format a row of a flow depth result into an array of string, both used by csv and pdf
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
95 *
8948
a4f1ac81f26d Work on SINFO-FlowDepthMinMax.
gernotbelger
parents: 8946
diff changeset
96 * @param result
a4f1ac81f26d Work on SINFO-FlowDepthMinMax.
gernotbelger
parents: 8946
diff changeset
97 *
8946
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
98 * @param useTkh
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
99 */
8997
d5802f22e4f5 Work on uinfo
gernotbelger
parents: 8993
diff changeset
100 @Override
d5802f22e4f5 Work on uinfo
gernotbelger
parents: 8993
diff changeset
101 protected String[] formatRow(final FlowDepthMinMaxCalculationResults results, final ResultRow row, final ExportMode mode) {
8946
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
102
8948
a4f1ac81f26d Work on SINFO-FlowDepthMinMax.
gernotbelger
parents: 8946
diff changeset
103 final Collection<String> lines = new ArrayList<>(10);
8946
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
104
8997
d5802f22e4f5 Work on uinfo
gernotbelger
parents: 8993
diff changeset
105 lines.add(row.exportValue(this.context, GeneralResultType.station));
8946
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
106
8948
a4f1ac81f26d Work on SINFO-FlowDepthMinMax.
gernotbelger
parents: 8946
diff changeset
107 // REMARK: null check as pdf will call this with null and in that case we show all columns (to avoid multiple jasper
a4f1ac81f26d Work on SINFO-FlowDepthMinMax.
gernotbelger
parents: 8946
diff changeset
108 // FIXME: does not work like this: we may have several pairs of min/max; so we need to look at all of them?
a4f1ac81f26d Work on SINFO-FlowDepthMinMax.
gernotbelger
parents: 8946
diff changeset
109 // templates)
a4f1ac81f26d Work on SINFO-FlowDepthMinMax.
gernotbelger
parents: 8946
diff changeset
110 // if (result == null || result.getMinSounding() != null)
a4f1ac81f26d Work on SINFO-FlowDepthMinMax.
gernotbelger
parents: 8946
diff changeset
111 lines.add(row.exportValue(this.context, SInfoResultType.flowdepthmin));
a4f1ac81f26d Work on SINFO-FlowDepthMinMax.
gernotbelger
parents: 8946
diff changeset
112 // if (result == null || result.getMaxSounding() != null)
a4f1ac81f26d Work on SINFO-FlowDepthMinMax.
gernotbelger
parents: 8946
diff changeset
113 lines.add(row.exportValue(this.context, SInfoResultType.flowdepthmax));
8946
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
114
8948
a4f1ac81f26d Work on SINFO-FlowDepthMinMax.
gernotbelger
parents: 8946
diff changeset
115 lines.add(row.exportValue(this.context, SInfoResultType.waterlevel));
a4f1ac81f26d Work on SINFO-FlowDepthMinMax.
gernotbelger
parents: 8946
diff changeset
116 lines.add(row.exportValue(this.context, SInfoResultType.discharge));
a4f1ac81f26d Work on SINFO-FlowDepthMinMax.
gernotbelger
parents: 8946
diff changeset
117 lines.add(row.exportValue(this.context, SInfoResultType.waterlevelLabel));
a4f1ac81f26d Work on SINFO-FlowDepthMinMax.
gernotbelger
parents: 8946
diff changeset
118 lines.add(row.exportValue(this.context, SInfoResultType.gaugeLabel));
a4f1ac81f26d Work on SINFO-FlowDepthMinMax.
gernotbelger
parents: 8946
diff changeset
119 lines.add(row.exportValue(this.context, SInfoResultType.meanBedHeight));
a4f1ac81f26d Work on SINFO-FlowDepthMinMax.
gernotbelger
parents: 8946
diff changeset
120 lines.add(row.exportValue(this.context, SInfoResultType.soundingLabel));
a4f1ac81f26d Work on SINFO-FlowDepthMinMax.
gernotbelger
parents: 8946
diff changeset
121 lines.add(row.exportValue(this.context, SInfoResultType.location));
8946
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
122
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
123 return lines.toArray(new String[lines.size()]);
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
124 }
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
125
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
126 @Override
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
127 protected final void addJRMetaData(final MetaAndTableJRDataSource source, final FlowDepthMinMaxCalculationResults results) {
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
128
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
129 /* general metadata */
8997
d5802f22e4f5 Work on uinfo
gernotbelger
parents: 8993
diff changeset
130 super.addJRMetaData(source, results);
8946
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
131
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
132 /* column headings */
8997
d5802f22e4f5 Work on uinfo
gernotbelger
parents: 8993
diff changeset
133 source.addMetaData("station_header", GeneralResultType.station.getPdfHeader(this.context.getMeta()));
8949
09e4a4909814 Distinguish between csv and pdf column headers
gernotbelger
parents: 8948
diff changeset
134 source.addMetaData("flowdepthmin_header", SInfoResultType.flowdepthmin.getPdfHeader(this.context.getMeta()));
09e4a4909814 Distinguish between csv and pdf column headers
gernotbelger
parents: 8948
diff changeset
135 source.addMetaData("flowdepthmax_header", SInfoResultType.flowdepthmax.getPdfHeader(this.context.getMeta()));
09e4a4909814 Distinguish between csv and pdf column headers
gernotbelger
parents: 8948
diff changeset
136 source.addMetaData("waterlevel_header", SInfoResultType.waterlevel.getPdfHeader(this.context.getMeta()));
09e4a4909814 Distinguish between csv and pdf column headers
gernotbelger
parents: 8948
diff changeset
137 source.addMetaData("discharge_header", SInfoResultType.discharge.getPdfHeader(this.context.getMeta()));
09e4a4909814 Distinguish between csv and pdf column headers
gernotbelger
parents: 8948
diff changeset
138 source.addMetaData("waterlevel_name_header", SInfoResultType.waterlevelLabel.getPdfHeader(this.context.getMeta()));
09e4a4909814 Distinguish between csv and pdf column headers
gernotbelger
parents: 8948
diff changeset
139 source.addMetaData("gauge_header", SInfoResultType.gaugeLabel.getPdfHeader(this.context.getMeta()));
09e4a4909814 Distinguish between csv and pdf column headers
gernotbelger
parents: 8948
diff changeset
140 source.addMetaData("bedheight_header", SInfoResultType.meanBedHeight.getPdfHeader(this.context.getMeta()));
09e4a4909814 Distinguish between csv and pdf column headers
gernotbelger
parents: 8948
diff changeset
141 source.addMetaData("sounding_name_header", SInfoResultType.soundingLabel.getPdfHeader(this.context.getMeta()));
09e4a4909814 Distinguish between csv and pdf column headers
gernotbelger
parents: 8948
diff changeset
142 source.addMetaData("location_header", SInfoResultType.location.getPdfHeader(this.context.getMeta()));
8946
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
143 }
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
144
9006
7134a4c7d1b6 U-Info S-Info general work
gernotbelger
parents: 8997
diff changeset
145 @Override
7134a4c7d1b6 U-Info S-Info general work
gernotbelger
parents: 8997
diff changeset
146 protected void writePDF(final OutputStream out) {
7134a4c7d1b6 U-Info S-Info general work
gernotbelger
parents: 8997
diff changeset
147 try {
7134a4c7d1b6 U-Info S-Info general work
gernotbelger
parents: 8997
diff changeset
148 final MetaAndTableJRDataSource source = createJRData(this.data);
7134a4c7d1b6 U-Info S-Info general work
gernotbelger
parents: 8997
diff changeset
149
7134a4c7d1b6 U-Info S-Info general work
gernotbelger
parents: 8997
diff changeset
150 final JasperReporter reporter = new JasperReporter();
7134a4c7d1b6 U-Info S-Info general work
gernotbelger
parents: 8997
diff changeset
151 reporter.addReport(JASPER_FILE, source);
7134a4c7d1b6 U-Info S-Info general work
gernotbelger
parents: 8997
diff changeset
152 reporter.exportPDF(out);
7134a4c7d1b6 U-Info S-Info general work
gernotbelger
parents: 8997
diff changeset
153 }
7134a4c7d1b6 U-Info S-Info general work
gernotbelger
parents: 8997
diff changeset
154 catch (final JRException je) {
7134a4c7d1b6 U-Info S-Info general work
gernotbelger
parents: 8997
diff changeset
155 getLog().warn("Error generating PDF Report!", je);
7134a4c7d1b6 U-Info S-Info general work
gernotbelger
parents: 8997
diff changeset
156 }
7134a4c7d1b6 U-Info S-Info general work
gernotbelger
parents: 8997
diff changeset
157 }
7134a4c7d1b6 U-Info S-Info general work
gernotbelger
parents: 8997
diff changeset
158
8946
5d5d482da3e9 Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
diff changeset
159 }

http://dive4elements.wald.intevation.org