[PATCH] U-Info S-Info general work
Wald Commits
scm-commit at wald.intevation.org
Tue Apr 17 13:20:34 CEST 2018
# HG changeset patch
# User gernotbelger
# Date 1523964025 -7200
# Node ID 7134a4c7d1b61c217967dabd92d5066c5e95aeb0
# Parent 460fcc128794bc90af6d102c5248a6b66b61ef19
U-Info S-Info general work
diff -r 460fcc128794 -r 7134a4c7d1b6 artifacts/doc/conf/jasper/sinfo.flowdepth.jasper
Binary file artifacts/doc/conf/jasper/sinfo.flowdepth.jasper has changed
diff -r 460fcc128794 -r 7134a4c7d1b6 artifacts/doc/conf/jasper/sinfo.flowdepthdevelopment.jasper
Binary file artifacts/doc/conf/jasper/sinfo.flowdepthdevelopment.jasper has changed
diff -r 460fcc128794 -r 7134a4c7d1b6 artifacts/doc/conf/jasper/sinfo.flowdepthminmax.jasper
Binary file artifacts/doc/conf/jasper/sinfo.flowdepthminmax.jasper has changed
diff -r 460fcc128794 -r 7134a4c7d1b6 artifacts/doc/conf/jasper/sinfo.tkh.jasper
Binary file artifacts/doc/conf/jasper/sinfo.tkh.jasper has changed
diff -r 460fcc128794 -r 7134a4c7d1b6 artifacts/doc/conf/jasper/templates/sinfo.flowdepth.jrxml
--- a/artifacts/doc/conf/jasper/templates/sinfo.flowdepth.jrxml Tue Apr 17 13:19:56 2018 +0200
+++ b/artifacts/doc/conf/jasper/templates/sinfo.flowdepth.jrxml Tue Apr 17 13:20:25 2018 +0200
@@ -1,11 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.5.1.final using JasperReports Library version 4.5.0 -->
-<!-- 2018-04-12T18:30:24 -->
-<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" name="flysreport" language="groovy" pageWidth="842" pageHeight="595" columnWidth="515" leftMargin="60" rightMargin="20" topMargin="20" bottomMargin="20">
+<!-- 2018-04-17T10:14:04 -->
+<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="flysreport" language="groovy" pageWidth="842" pageHeight="595" columnWidth="515" leftMargin="60" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<style name="htmlStyle" markup="html"/>
+ <field name="meta:totalpagesoffset" class="java.lang.Integer"/>
+ <field name="meta:startpageoffset" class="java.lang.Integer"/>
<field name="meta:header" class="java.lang.String"/>
<field name="meta:calcMode" class="java.lang.String"/>
<field name="meta:version_label" class="java.lang.String"/>
@@ -105,31 +107,31 @@
<reportElement positionType="FixRelativeToBottom" x="0" y="24" width="762" height="1"/>
</line>
<textField isStretchWithOverflow="true">
- <reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="50" height="24"/>
+ <reportElement key="0" style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="50" height="24"/>
<box padding="5"/>
<textElement textAlignment="Right" verticalAlignment="Bottom"/>
<textFieldExpression><![CDATA[$F{meta:station_header}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
- <reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="50" y="0" width="55" height="24"/>
+ <reportElement key="1" style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="50" y="0" width="55" height="24"/>
<box padding="5"/>
<textElement textAlignment="Right" verticalAlignment="Bottom"/>
<textFieldExpression><![CDATA[$F{meta:flowdepth_header} + "<br/>[m]"]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
- <reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="105" y="0" width="54" height="24"/>
+ <reportElement key="flowdepthtkh" style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="105" y="0" width="54" height="24"/>
<box padding="5"/>
<textElement textAlignment="Right" verticalAlignment="Bottom"/>
<textFieldExpression><![CDATA[$F{meta:flowdepth_tkh_header} + " [m]"]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
- <reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="159" y="0" width="36" height="24"/>
+ <reportElement key="tkh" style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="159" y="0" width="36" height="24"/>
<box padding="5"/>
<textElement textAlignment="Right" verticalAlignment="Bottom"/>
<textFieldExpression><![CDATA[$F{meta:tkh_header} + "<br/>[cm]"]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
- <reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="195" y="0" width="60" height="24"/>
+ <reportElement key="4" style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="195" y="0" width="60" height="24"/>
<box padding="5">
<pen lineStyle="Solid"/>
</box>
@@ -137,37 +139,37 @@
<textFieldExpression><![CDATA[$F{meta:waterlevel_header} + "<br/>[" + $F{meta:river_unit} + "]"]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
- <reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="255" y="0" width="40" height="24"/>
+ <reportElement key="5" style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="255" y="0" width="40" height="24"/>
<box padding="5"/>
<textElement textAlignment="Right" verticalAlignment="Bottom"/>
<textFieldExpression><![CDATA[$F{meta:discharge_header} + "<br/>[m³/s]"]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
- <reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="295" y="0" width="80" height="24"/>
+ <reportElement key="6" style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="295" y="0" width="80" height="24"/>
<box padding="5"/>
<textElement verticalAlignment="Bottom"/>
<textFieldExpression><![CDATA[$F{meta:waterlevel_name_header}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
- <reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="375" y="0" width="110" height="24"/>
+ <reportElement key="7" style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="375" y="0" width="110" height="24"/>
<box padding="5"/>
<textElement verticalAlignment="Bottom"/>
<textFieldExpression><![CDATA[$F{meta:gauge_header}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
- <reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="485" y="0" width="60" height="24"/>
+ <reportElement key="8" style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="485" y="0" width="60" height="24"/>
<box padding="5"/>
<textElement textAlignment="Right" verticalAlignment="Bottom"/>
<textFieldExpression><![CDATA[$F{meta:bedheight_header} + "<br/>[" + $F{meta:river_unit} + "]"]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
- <reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="545" y="0" width="95" height="24"/>
+ <reportElement key="9" style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="545" y="0" width="95" height="24"/>
<box padding="5"/>
<textElement verticalAlignment="Bottom"/>
<textFieldExpression><![CDATA[$F{meta:sounding_name_header}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
- <reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="640" y="0" width="122" height="24"/>
+ <reportElement key="10" style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="640" y="0" width="122" height="24"/>
<box padding="5"/>
<textElement verticalAlignment="Bottom"/>
<textFieldExpression><![CDATA[$F{meta:location_header}]]></textFieldExpression>
@@ -177,67 +179,67 @@
<detail>
<band height="20" splitType="Prevent">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="50" height="20"/>
+ <reportElement key="0" positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="50" height="20"/>
<box topPadding="5" leftPadding="5" bottomPadding="0" rightPadding="5"/>
<textElement textAlignment="Right" verticalAlignment="Top"/>
<textFieldExpression><![CDATA[$F{data:0}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement positionType="Float" stretchType="RelativeToBandHeight" x="50" y="0" width="55" height="20"/>
+ <reportElement key="1" positionType="Float" stretchType="RelativeToBandHeight" x="50" y="0" width="55" height="20"/>
<box topPadding="5" leftPadding="5" bottomPadding="0" rightPadding="5"/>
<textElement textAlignment="Right" verticalAlignment="Top"/>
<textFieldExpression><![CDATA[$F{data:1}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement positionType="Float" stretchType="RelativeToBandHeight" x="105" y="0" width="54" height="20"/>
+ <reportElement key="flowdepthtkh" positionType="Float" stretchType="RelativeToBandHeight" x="105" y="0" width="54" height="20"/>
<box topPadding="5" leftPadding="5" bottomPadding="0" rightPadding="5"/>
<textElement textAlignment="Right" verticalAlignment="Top"/>
<textFieldExpression><![CDATA[$F{data:2}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement positionType="Float" stretchType="RelativeToBandHeight" x="159" y="0" width="36" height="20"/>
+ <reportElement key="tkh" positionType="Float" stretchType="RelativeToBandHeight" x="159" y="0" width="36" height="20"/>
<box topPadding="5" leftPadding="5" bottomPadding="0" rightPadding="5"/>
<textElement textAlignment="Right" verticalAlignment="Top"/>
<textFieldExpression><![CDATA[$F{data:3}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement positionType="Float" stretchType="RelativeToBandHeight" x="195" y="0" width="60" height="20"/>
+ <reportElement key="4" positionType="Float" stretchType="RelativeToBandHeight" x="195" y="0" width="60" height="20"/>
<box topPadding="5" leftPadding="5" bottomPadding="0" rightPadding="5"/>
<textElement textAlignment="Right" verticalAlignment="Top"/>
<textFieldExpression><![CDATA[$F{data:4}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement positionType="Float" stretchType="RelativeToBandHeight" x="255" y="0" width="40" height="20"/>
+ <reportElement key="5" positionType="Float" stretchType="RelativeToBandHeight" x="255" y="0" width="40" height="20"/>
<box topPadding="5" leftPadding="5" bottomPadding="0" rightPadding="5"/>
<textElement textAlignment="Right" verticalAlignment="Top"/>
<textFieldExpression><![CDATA[$F{data:5}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement positionType="Float" stretchType="RelativeToBandHeight" x="295" y="0" width="80" height="20"/>
+ <reportElement key="6" positionType="Float" stretchType="RelativeToBandHeight" x="295" y="0" width="80" height="20"/>
<box topPadding="5" leftPadding="5" bottomPadding="0" rightPadding="5"/>
<textElement verticalAlignment="Top"/>
<textFieldExpression><![CDATA[$F{data:6}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement positionType="Float" stretchType="RelativeToBandHeight" x="375" y="0" width="110" height="20"/>
+ <reportElement key="7" positionType="Float" stretchType="RelativeToBandHeight" x="375" y="0" width="110" height="20"/>
<box topPadding="5" leftPadding="5" bottomPadding="0" rightPadding="5"/>
<textElement verticalAlignment="Top"/>
<textFieldExpression><![CDATA[$F{data:7}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement positionType="Float" stretchType="RelativeToBandHeight" x="485" y="0" width="60" height="20"/>
+ <reportElement key="8" positionType="Float" stretchType="RelativeToBandHeight" x="485" y="0" width="60" height="20"/>
<box topPadding="5" leftPadding="5" rightPadding="5"/>
<textElement textAlignment="Right" verticalAlignment="Top"/>
<textFieldExpression><![CDATA[$F{data:8}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement positionType="Float" stretchType="RelativeToBandHeight" x="545" y="0" width="95" height="20"/>
+ <reportElement key="9" positionType="Float" stretchType="RelativeToBandHeight" x="545" y="0" width="95" height="20"/>
<box topPadding="5" leftPadding="5" bottomPadding="0" rightPadding="5"/>
<textElement verticalAlignment="Top"/>
<textFieldExpression><![CDATA[$F{data:9}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement positionType="Float" stretchType="RelativeToBandHeight" x="640" y="0" width="122" height="20"/>
+ <reportElement key="10" positionType="Float" stretchType="RelativeToBandHeight" x="640" y="0" width="122" height="20"/>
<box topPadding="5" leftPadding="5" bottomPadding="0" rightPadding="5"/>
<textElement verticalAlignment="Top"/>
<textFieldExpression><![CDATA[$F{data:10}]]></textFieldExpression>
@@ -248,12 +250,12 @@
<band height="29" splitType="Stretch">
<textField evaluationTime="Report">
<reportElement x="705" y="9" width="57" height="20"/>
- <textFieldExpression><![CDATA[" / " + $V{PAGE_NUMBER}]]></textFieldExpression>
+ <textFieldExpression><![CDATA[" / " +( $V{PAGE_NUMBER} +(($F{meta:totalpagesoffset} != null) ? $F{meta:totalpagesoffset} : 0) )]]></textFieldExpression>
</textField>
<textField>
<reportElement x="650" y="9" width="55" height="20"/>
<textElement textAlignment="Right"/>
- <textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
+ <textFieldExpression><![CDATA[$V{PAGE_NUMBER}+ (($F{meta:startpageoffset} != null) ? $F{meta:startpageoffset} : 0 )]]></textFieldExpression>
</textField>
</band>
</pageFooter>
diff -r 460fcc128794 -r 7134a4c7d1b6 artifacts/doc/conf/jasper/templates/sinfo.flowdepthdevelopment.jrxml
--- a/artifacts/doc/conf/jasper/templates/sinfo.flowdepthdevelopment.jrxml Tue Apr 17 13:19:56 2018 +0200
+++ b/artifacts/doc/conf/jasper/templates/sinfo.flowdepthdevelopment.jrxml Tue Apr 17 13:20:25 2018 +0200
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.5.1.final using JasperReports Library version 4.5.0 -->
-<!-- 2018-04-12T10:43:25 -->
+<!-- 2018-04-16T10:31:02 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="flysreport" language="groovy" pageWidth="842" pageHeight="595" columnWidth="515" leftMargin="60" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
@@ -141,12 +141,6 @@
<textFieldExpression><![CDATA[$F{meta:flowdepthdevelopmentperyear_header} + "<br/>[cm/a]"]]></textFieldExpression>
</textField>
<textField>
- <reportElement key="" style="htmlStyle" x="220" y="40" width="85" height="35"/>
- <box topPadding="0" leftPadding="5" bottomPadding="5" rightPadding="5"/>
- <textElement textAlignment="Right" verticalAlignment="Bottom"/>
- <textFieldExpression><![CDATA[$F{meta:waterleveldifference_header2}]]></textFieldExpression>
- </textField>
- <textField>
<reportElement key="" style="htmlStyle" x="305" y="0" width="85" height="40"/>
<box topPadding="0" leftPadding="5" bottomPadding="0" rightPadding="5"/>
<textElement textAlignment="Right" verticalAlignment="Bottom"/>
@@ -191,14 +185,23 @@
<line>
<reportElement style="htmlStyle" x="0" y="74" width="762" height="1"/>
</line>
- <textField>
- <reportElement key="" style="htmlStyle" x="220" y="0" width="85" height="40"/>
- <box topPadding="0" leftPadding="5" bottomPadding="0" rightPadding="5"/>
- <textElement textAlignment="Right" verticalAlignment="Bottom">
- <font pdfEncoding=""/>
- </textElement>
- <textFieldExpression><![CDATA[$F{meta:waterleveldifference_header}+"<br/>["+$F{meta:river_unit}+"]"]]></textFieldExpression>
- </textField>
+ <frame>
+ <reportElement key="TEST" x="220" y="0" width="85" height="75"/>
+ <textField>
+ <reportElement key="" style="htmlStyle" x="0" y="40" width="85" height="35"/>
+ <box topPadding="0" leftPadding="5" bottomPadding="5" rightPadding="5"/>
+ <textElement textAlignment="Right" verticalAlignment="Bottom"/>
+ <textFieldExpression><![CDATA[$F{meta:waterleveldifference_header2}]]></textFieldExpression>
+ </textField>
+ <textField>
+ <reportElement key="" style="htmlStyle" x="0" y="0" width="85" height="40"/>
+ <box topPadding="0" leftPadding="5" bottomPadding="0" rightPadding="5"/>
+ <textElement textAlignment="Right" verticalAlignment="Bottom">
+ <font pdfEncoding=""/>
+ </textElement>
+ <textFieldExpression><![CDATA[$F{meta:waterleveldifference_header}+"<br/>["+$F{meta:river_unit}+"]"]]></textFieldExpression>
+ </textField>
+ </frame>
</band>
</columnHeader>
<detail>
@@ -239,7 +242,7 @@
<textFieldExpression><![CDATA[$F{data:2}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement key="" style="htmlStyle" stretchType="RelativeToBandHeight" x="220" y="0" width="85" height="20"/>
+ <reportElement key="TEST" style="htmlStyle" stretchType="RelativeToBandHeight" x="220" y="0" width="85" height="20"/>
<box topPadding="5" leftPadding="5" bottomPadding="0" rightPadding="5"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{data:3}]]></textFieldExpression>
@@ -253,7 +256,7 @@
</band>
</detail>
<pageFooter>
- <band height="30" splitType="Stretch">
+ <band height="29" splitType="Stretch">
<textField evaluationTime="Report">
<reportElement style="htmlStyle" x="705" y="9" width="57" height="20"/>
<textFieldExpression><![CDATA[" / " + $V{PAGE_NUMBER}]]></textFieldExpression>
diff -r 460fcc128794 -r 7134a4c7d1b6 artifacts/doc/conf/jasper/templates/uinfo.salixline.jrxml
--- a/artifacts/doc/conf/jasper/templates/uinfo.salixline.jrxml Tue Apr 17 13:19:56 2018 +0200
+++ b/artifacts/doc/conf/jasper/templates/uinfo.salixline.jrxml Tue Apr 17 13:20:25 2018 +0200
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.5.1.final using JasperReports Library version 4.5.0 -->
-<!-- 2018-04-12T16:02:57 -->
+<!-- 2018-04-16T11:03:24 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="flysreport" language="groovy" pageWidth="595" pageHeight="842" columnWidth="545" leftMargin="30" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
@@ -51,9 +51,13 @@
<field name="meta:sounding_name_header" class="java.lang.String"/>
<field name="meta:location_header" class="java.lang.String"/>
<field name="meta:river_unit" class="java.lang.String"/>
+ <field name="meta:salix_line" class="java.lang.String"/>
+ <field name="meta:salix_line_hist" class="java.lang.String"/>
+ <field name="meta:salix_line_scen" class="java.lang.String"/>
<field name="data:0" class="java.lang.String"/>
<field name="data:1" class="java.lang.String"/>
<field name="data:2" class="java.lang.String"/>
+ <field name="data:3" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
@@ -124,17 +128,23 @@
<reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="80" y="0" width="90" height="24"/>
<box padding="5"/>
<textElement textAlignment="Right" verticalAlignment="Bottom"/>
- <textFieldExpression><![CDATA[$F{meta:tkh_header} + "<br/>[cm]"]]></textFieldExpression>
+ <textFieldExpression><![CDATA[$F{meta:salix_line}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement key="" style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="170" y="0" width="140" height="24"/>
<box padding="5"/>
- <textElement verticalAlignment="Bottom"/>
- <textFieldExpression><![CDATA[$F{meta:tkhkind_header}]]></textFieldExpression>
+ <textElement textAlignment="Right" verticalAlignment="Bottom"/>
+ <textFieldExpression><![CDATA[$F{meta:salix_line_hist}]]></textFieldExpression>
</textField>
<line>
<reportElement style="htmlStyle" positionType="FixRelativeToBottom" x="0" y="24" width="550" height="1"/>
</line>
+ <textField isStretchWithOverflow="true">
+ <reportElement key="" style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="310" y="0" width="140" height="24"/>
+ <box padding="5"/>
+ <textElement textAlignment="Right" verticalAlignment="Bottom"/>
+ <textFieldExpression><![CDATA[$F{meta:salix_line_scen}]]></textFieldExpression>
+ </textField>
</band>
</columnHeader>
<detail>
@@ -169,9 +179,20 @@
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
- <textElement textAlignment="Left"/>
+ <textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{data:2}]]></textFieldExpression>
</textField>
+ <textField isStretchWithOverflow="true" isBlankWhenNull="true">
+ <reportElement key="" style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="310" y="0" width="140" height="20"/>
+ <box topPadding="5" leftPadding="5" bottomPadding="0" rightPadding="5">
+ <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
+ <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
+ <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
+ <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
+ </box>
+ <textElement textAlignment="Right"/>
+ <textFieldExpression><![CDATA[$F{data:3}]]></textFieldExpression>
+ </textField>
</band>
</detail>
<pageFooter>
diff -r 460fcc128794 -r 7134a4c7d1b6 artifacts/doc/conf/jasper/templates/uinfo.vegetationzones.jrxml
--- a/artifacts/doc/conf/jasper/templates/uinfo.vegetationzones.jrxml Tue Apr 17 13:19:56 2018 +0200
+++ b/artifacts/doc/conf/jasper/templates/uinfo.vegetationzones.jrxml Tue Apr 17 13:20:25 2018 +0200
@@ -1,11 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.5.1.final using JasperReports Library version 4.5.0 -->
-<!-- 2018-04-10T16:12:10 -->
+<!-- 2018-04-16T11:38:36 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="flysreport" language="groovy" pageWidth="595" pageHeight="842" columnWidth="545" leftMargin="30" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
- <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<style name="htmlStyle" isDefault="true" mode="Transparent" markup="html"/>
<field name="meta:header" class="java.lang.String"/>
<field name="meta:calcMode" class="java.lang.String"/>
@@ -52,15 +51,12 @@
<field name="meta:sounding_name_header" class="java.lang.String"/>
<field name="meta:location_header" class="java.lang.String"/>
<field name="meta:river_unit" class="java.lang.String"/>
+ <field name="meta:veg_name" class="java.lang.String"/>
+ <field name="meta:veg_dauervon" class="java.lang.String"/>
+ <field name="meta:veg_dauerbis" class="java.lang.String"/>
<field name="data:0" class="java.lang.String"/>
<field name="data:1" class="java.lang.String"/>
<field name="data:2" class="java.lang.String"/>
- <field name="data:3" class="java.lang.String"/>
- <field name="data:4" class="java.lang.String"/>
- <field name="data:5" class="java.lang.String"/>
- <field name="data:6" class="java.lang.String"/>
- <field name="data:7" class="java.lang.String"/>
- <field name="data:8" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
@@ -122,22 +118,22 @@
<columnHeader>
<band height="25" splitType="Stretch">
<textField isStretchWithOverflow="true">
- <reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="80" height="24"/>
+ <reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="140" height="24"/>
+ <box padding="5"/>
+ <textElement verticalAlignment="Bottom"/>
+ <textFieldExpression><![CDATA[$F{meta:veg_name}]]></textFieldExpression>
+ </textField>
+ <textField isStretchWithOverflow="true">
+ <reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="140" y="0" width="140" height="24"/>
<box padding="5"/>
<textElement textAlignment="Right" verticalAlignment="Bottom"/>
- <textFieldExpression><![CDATA[$F{meta:station_header}]]></textFieldExpression>
+ <textFieldExpression><![CDATA[$F{meta:veg_dauervon}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
- <reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="80" y="0" width="90" height="24"/>
+ <reportElement key="" style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="280" y="0" width="140" height="24"/>
<box padding="5"/>
<textElement textAlignment="Right" verticalAlignment="Bottom"/>
- <textFieldExpression><![CDATA[$F{meta:tkh_header} + "<br/>[cm]"]]></textFieldExpression>
- </textField>
- <textField isStretchWithOverflow="true">
- <reportElement key="" style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="170" y="0" width="140" height="24"/>
- <box padding="5"/>
- <textElement verticalAlignment="Bottom"/>
- <textFieldExpression><![CDATA[$F{meta:tkhkind_header}]]></textFieldExpression>
+ <textFieldExpression><![CDATA[$F{meta:veg_dauerbis}]]></textFieldExpression>
</textField>
<line>
<reportElement style="htmlStyle" positionType="FixRelativeToBottom" x="0" y="24" width="550" height="1"/>
@@ -147,18 +143,18 @@
<detail>
<band height="20" splitType="Prevent">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="80" height="20"/>
+ <reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="140" height="20"/>
<box topPadding="5" leftPadding="5" bottomPadding="0" rightPadding="5">
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
- <textElement textAlignment="Right" verticalAlignment="Top"/>
+ <textElement verticalAlignment="Top"/>
<textFieldExpression><![CDATA[$F{data:0}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="80" y="0" width="90" height="20"/>
+ <reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="140" y="0" width="140" height="20"/>
<box topPadding="5" leftPadding="5" bottomPadding="0" rightPadding="5">
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -169,14 +165,14 @@
<textFieldExpression><![CDATA[$F{data:1}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement key="" style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="170" y="0" width="140" height="20"/>
+ <reportElement key="" style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="280" y="0" width="140" height="20"/>
<box topPadding="5" leftPadding="5" bottomPadding="0" rightPadding="5">
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
- <textElement textAlignment="Left"/>
+ <textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{data:2}]]></textFieldExpression>
</textField>
</band>
diff -r 460fcc128794 -r 7134a4c7d1b6 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/SInfoResultType.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/SInfoResultType.java Tue Apr 17 13:19:56 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/SInfoResultType.java Tue Apr 17 13:20:25 2018 +0200
@@ -27,6 +27,8 @@
*/
public abstract class SInfoResultType extends AbstractResultType {
+ private static final long serialVersionUID = 1L;
+
private SInfoResultType(final String unit, final String csvHeader) {
super(unit, csvHeader, csvHeader);
}
@@ -37,6 +39,8 @@
public static final SInfoResultType waterlevel = new SInfoResultType(null, SInfoI18NStrings.CSV_WATERLEVEL_HEADER,
"sinfo.export.flow_depth.pdf.header.waterlevel") {
+ private static final long serialVersionUID = 1L;
+
@Override
public String exportValue(final CallContext context, final Object value) {
final double doubleValue = asDouble(value);
@@ -52,6 +56,8 @@
};
public static final SInfoResultType waterlevelLabel = new SInfoResultType(I18NStrings.UNIT_NONE, SInfoI18NStrings.CSV_LABEL_HEADER) {
+ private static final long serialVersionUID = 1L;
+
@Override
public String exportValue(final CallContext context, final Object value) {
return exportStringValue(value);
@@ -64,6 +70,8 @@
};
public static final SInfoResultType discharge = new SInfoResultType(I18NStrings.UNIT_CUBIC_M, SInfoI18NStrings.CSV_DISCHARGE_HEADER) {
+ private static final long serialVersionUID = 1L;
+
@Override
public String exportValue(final CallContext context, final Object value) {
final double doubleValue = asDouble(value);
@@ -79,6 +87,8 @@
public static final SInfoResultType meanBedHeight = new SInfoResultType(null, SInfoI18NStrings.CSV_MEAN_BED_HEIGHT_HEADER,
SInfoI18NStrings.CSV_MEAN_BED_HEIGHT_HEADER_SHORT) {
+ private static final long serialVersionUID = 1L;
+
@Override
public String exportValue(final CallContext context, final Object value) {
final double doubleValue = asDouble(value);
@@ -92,6 +102,8 @@
};
public static final SInfoResultType soundingLabel = new SInfoResultType(I18NStrings.UNIT_NONE, SInfoI18NStrings.CSV_SOUNDING_HEADER) {
+ private static final long serialVersionUID = 1L;
+
@Override
public String exportValue(final CallContext context, final Object value) {
return exportStringValue(value);
@@ -104,6 +116,8 @@
};
public static final SInfoResultType flowdepthDevelopmentPerYear = new SInfoResultType(I18NStrings.UNIT_CM_A,
SInfoI18NStrings.CSV_FLOWDEPTH_DEVELOPMENT_PER_YEAR_HEADER) {
+ private static final long serialVersionUID = 1L;
+
@Override
public String exportValue(final CallContext context, final Object value) {
final double doubleValue = asDouble(value);
@@ -117,6 +131,8 @@
};
public static final SInfoResultType flowdepthmin = new SInfoResultType(I18NStrings.UNIT_M, SInfoI18NStrings.CSV_FLOWDEPTH_MIN_HEADER) {
+ private static final long serialVersionUID = 1L;
+
@Override
public String exportValue(final CallContext context, final Object value) {
final double doubleValue = asDouble(value);
@@ -130,6 +146,8 @@
};
public static final SInfoResultType flowdepthmax = new SInfoResultType(I18NStrings.UNIT_M, SInfoI18NStrings.CSV_FLOWDEPTH_MAX_HEADER) {
+ private static final long serialVersionUID = 1L;
+
@Override
public String exportValue(final CallContext context, final Object value) {
final double doubleValue = asDouble(value);
@@ -143,6 +161,8 @@
};
public static final SInfoResultType gaugeLabel = new SInfoResultType(I18NStrings.UNIT_NONE, SInfoI18NStrings.CSV_GAUGE_HEADER) {
+ private static final long serialVersionUID = 1L;
+
@Override
public String exportValue(final CallContext context, final Object value) {
return exportStringValue(value);
@@ -155,6 +175,8 @@
};
public static final SInfoResultType location = new SInfoResultType(I18NStrings.UNIT_NONE, SInfoI18NStrings.CSV_LOCATION_HEADER) {
+ private static final long serialVersionUID = 1L;
+
@Override
public String exportValue(final CallContext context, final Object value) {
return exportStringValue(value);
@@ -168,6 +190,8 @@
public static final SInfoResultType soilkind = new SInfoResultType(I18NStrings.UNIT_NONE, SInfoI18NStrings.CSV_TKHKIND_HEADER,
"sinfo.export.tkh.pdf.header.tkhkind") {
+ private static final long serialVersionUID = 1L;
+
@Override
public String exportValue(final CallContext context, final Object value) {
@@ -187,6 +211,8 @@
};
public static final SInfoResultType flowdepth = new SInfoResultType(I18NStrings.UNIT_M, SInfoI18NStrings.CSV_FLOWDEPTH_HEADER) {
+ private static final long serialVersionUID = 1L;
+
@Override
public String exportValue(final CallContext context, final Object value) {
final double doubleValue = asDouble(value);
@@ -200,6 +226,8 @@
};
public static final SInfoResultType d50 = new SInfoResultType(null, null) {
+ private static final long serialVersionUID = 1L;
+
@Override
public String exportValue(final CallContext context, final Object value) {
final double doubleValue = asDouble(value);
@@ -213,6 +241,8 @@
};
public static final SInfoResultType velocity = new SInfoResultType(null, null) {
+ private static final long serialVersionUID = 1L;
+
@Override
public String exportValue(final CallContext context, final Object value) {
final double doubleValue = asDouble(value);
@@ -226,6 +256,8 @@
};
public static final SInfoResultType tau = new SInfoResultType(null, null) {
+ private static final long serialVersionUID = 1L;
+
@Override
public String exportValue(final CallContext context, final Object value) {
final double doubleValue = asDouble(value);
@@ -239,6 +271,8 @@
};
public static final SInfoResultType tkh = new SInfoResultType(I18NStrings.UNIT_CM, SInfoI18NStrings.CSV_TKH_HEADER, SInfoI18NStrings.CSV_TKH_HEADER_SHORT) {
+ private static final long serialVersionUID = 1L;
+
@Override
public String exportValue(final CallContext context, final Object value) {
final double doubleValue = asDouble(value);
@@ -252,6 +286,8 @@
};
public static final SInfoResultType tkhup = new SInfoResultType(I18NStrings.UNIT_M, null) {
+ private static final long serialVersionUID = 1L;
+
@Override
public String exportValue(final CallContext context, final Object value) {
final double doubleValue = asDouble(value);
@@ -265,6 +301,8 @@
};
public static final SInfoResultType tkhdown = new SInfoResultType(I18NStrings.UNIT_M, null) {
+ private static final long serialVersionUID = 1L;
+
@Override
public String exportValue(final CallContext context, final Object value) {
final double doubleValue = asDouble(value);
@@ -278,6 +316,8 @@
};
public static final SInfoResultType flowdepthtkh = new SInfoResultType(I18NStrings.UNIT_M, SInfoI18NStrings.CSV_FLOWDEPTHTKH_HEADER) {
+ private static final long serialVersionUID = 1L;
+
@Override
public String exportValue(final CallContext context, final Object value) {
final double doubleValue = asDouble(value);
@@ -292,6 +332,8 @@
public static final SInfoResultType flowdepthDevelopment = new SInfoResultType(I18NStrings.UNIT_M, SInfoI18NStrings.CSV_FLOWDEPTH_DEVELOPMENT_HEADER,
SInfoI18NStrings.PDF_FLOWDEPTH_DEVELOPMENT_HEADER) {
+ private static final long serialVersionUID = 1L;
+
@Override
public String exportValue(final CallContext context, final Object value) {
final double doubleValue = asDouble(value);
@@ -306,6 +348,8 @@
public static final SInfoResultType depthDevelopmentPerYear = new SInfoResultType(I18NStrings.UNIT_CM_A,
SInfoI18NStrings.CSV_FLOWDEPTH_DEVELOPMENT_PER_YEAR_HEADER) {
+ private static final long serialVersionUID = 1L;
+
@Override
public String exportValue(final CallContext context, final Object value) {
final double doubleValue = asDouble(value);
@@ -319,6 +363,8 @@
};
public static final SInfoResultType waterlevelDifference = new SInfoResultType(I18NStrings.UNIT_M, SInfoI18NStrings.CSV_WATERLEVEL_DIFFERENCE_HEADER,
"sinfo.export.pdf.header.waterlevel.difference") {
+ private static final long serialVersionUID = 1L;
+
@Override
public String exportValue(final CallContext context, final Object value) {
final double doubleValue = asDouble(value);
@@ -332,6 +378,8 @@
};
public static final SInfoResultType bedHeightDifference = new SInfoResultType(I18NStrings.UNIT_M, SInfoI18NStrings.CSV_MEAN_BED_HEIGHT_DIFFERENCE_HEADER,
"sinfo.export.pdf.header.mean_bed_height.difference") {
+ private static final long serialVersionUID = 1L;
+
@Override
public String exportValue(final CallContext context, final Object value) {
final double doubleValue = asDouble(value);
@@ -344,6 +392,8 @@
}
};
public static final SInfoResultType flowdepthCurrent = new SInfoResultType(I18NStrings.UNIT_M, SInfoI18NStrings.CSV_FLOWDEPTH_CURRENT_HEADER) {
+ private static final long serialVersionUID = 1L;
+
@Override
public String exportValue(final CallContext context, final Object value) {
final double doubleValue = asDouble(value);
@@ -356,6 +406,8 @@
}
};
public static final SInfoResultType flowdepthHistorical = new SInfoResultType(I18NStrings.UNIT_M, SInfoI18NStrings.CSV_FLOWDEPTH_HISTORICAL_HEADER) {
+ private static final long serialVersionUID = 1L;
+
@Override
public String exportValue(final CallContext context, final Object value) {
final double doubleValue = asDouble(value);
diff -r 460fcc128794 -r 7134a4c7d1b6 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthExporter.java Tue Apr 17 13:19:56 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthExporter.java Tue Apr 17 13:20:25 2018 +0200
@@ -8,20 +8,24 @@
package org.dive4elements.river.artifacts.sinfo.flowdepth;
+import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collection;
import org.apache.log4j.Logger;
import org.dive4elements.river.artifacts.common.GeneralResultType;
+import org.dive4elements.river.artifacts.common.JasperDesigner;
+import org.dive4elements.river.artifacts.common.JasperReporter;
+import org.dive4elements.river.artifacts.common.MetaAndTableJRDataSource;
import org.dive4elements.river.artifacts.common.ResultRow;
import org.dive4elements.river.artifacts.sinfo.common.AbstractSInfoExporter;
import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType;
import org.dive4elements.river.artifacts.sinfo.util.BedHeightInfo;
-import org.dive4elements.river.artifacts.sinfo.util.MetaAndTableJRDataSource;
import org.dive4elements.river.artifacts.sinfo.util.RiverInfo;
import org.dive4elements.river.artifacts.sinfo.util.WstInfo;
import au.com.bytecode.opencsv.CSVWriter;
+import net.sf.jasperreports.engine.JRException;
/**
* Generates different output formats (csv, pdf) of data that resulted from a flow depths min/max computation.
@@ -59,6 +63,8 @@
final WstInfo wst = result.getWst();
super.writeCSVWaterlevelMetadata(writer, wst);
+ writer.writeNext(new String[] { "" }); // break line
+
}
/**
@@ -125,8 +131,22 @@
}
@Override
- protected final String getJasperFile() {
- return JASPER_FILE;
+ protected void writePDF(final OutputStream out) {
+
+ try {
+ final MetaAndTableJRDataSource source = createJRData(this.data);
+ final JasperReporter reporter = new JasperReporter();
+ final JasperDesigner design = reporter.addReport(JASPER_FILE, source);
+
+ if (!getData().isUseTkh()) {
+ design.removeColumn("tkh");
+ design.removeColumn("flowdepthtkh");
+ }
+ reporter.exportPDF(out);
+ }
+ catch (final JRException je) {
+ getLog().warn("Error generating PDF Report!", je);
+ }
}
@Override
diff -r 460fcc128794 -r 7134a4c7d1b6 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthdev/FlowDepthDevelopmentExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthdev/FlowDepthDevelopmentExporter.java Tue Apr 17 13:19:56 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthdev/FlowDepthDevelopmentExporter.java Tue Apr 17 13:20:25 2018 +0200
@@ -8,18 +8,21 @@
package org.dive4elements.river.artifacts.sinfo.flowdepthdev;
+import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collection;
import org.apache.log4j.Logger;
import org.dive4elements.river.artifacts.common.GeneralResultType;
+import org.dive4elements.river.artifacts.common.JasperReporter;
+import org.dive4elements.river.artifacts.common.MetaAndTableJRDataSource;
import org.dive4elements.river.artifacts.common.ResultRow;
import org.dive4elements.river.artifacts.sinfo.common.AbstractSInfoExporter;
import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType;
-import org.dive4elements.river.artifacts.sinfo.util.MetaAndTableJRDataSource;
import org.dive4elements.river.artifacts.sinfo.util.RiverInfo;
import au.com.bytecode.opencsv.CSVWriter;
+import net.sf.jasperreports.engine.JRException;
/**
* Generates different output formats (csv, pdf) of data that resulted from a flow depths computation.
@@ -41,7 +44,7 @@
/** The log used in this exporter. */
private static Logger log = Logger.getLogger(FlowDepthDevelopmentExporter.class);
- private static final String JASPER_FILE = "/jasper/sinfo.flowdepthdevelopment.jasper";
+ private static final String JASPER_FILE = "/jasper/templates/sinfo.flowdepthdevelopment.jrxml";
@Override
protected Logger getLog() {
@@ -59,6 +62,7 @@
writeCSVSoundingMetadata(writer, result.getHistoricalSounding(), CSV_META_HEADER_SOUNDING_HISTORICAL);
writer.writeNext(new String[] { "" }); // break line
writeCSVWaterlevelMetadata(writer, result.getHistoricalWst(), CSV_META_HEADER_WATERLEVEL_HISTORICAL);
+ writer.writeNext(new String[] { "" }); // break line
}
@Override
@@ -122,11 +126,6 @@
}
@Override
- protected final String getJasperFile() {
- return JASPER_FILE;
- }
-
- @Override
protected final void addJRMetaData(final MetaAndTableJRDataSource source, final FlowDepthDevelopmentCalculationResults results) {
/* general metadata */
@@ -156,4 +155,18 @@
source.addMetaData("location_header", SInfoResultType.location.getPdfHeader(this.context.getMeta()));
}
+ @Override
+ protected void writePDF(final OutputStream out) {
+ try {
+ final MetaAndTableJRDataSource source = createJRData(this.data);
+
+ final JasperReporter reporter = new JasperReporter();
+ reporter.addReport(JASPER_FILE, source);
+ reporter.exportPDF(out);
+ }
+ catch (final JRException je) {
+ getLog().warn("Error generating PDF Report!", je);
+ }
+ }
+
}
\ No newline at end of file
diff -r 460fcc128794 -r 7134a4c7d1b6 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxExporter.java Tue Apr 17 13:19:56 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxExporter.java Tue Apr 17 13:20:25 2018 +0200
@@ -8,20 +8,23 @@
package org.dive4elements.river.artifacts.sinfo.flowdepthminmax;
+import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collection;
import org.apache.log4j.Logger;
import org.dive4elements.river.artifacts.common.GeneralResultType;
+import org.dive4elements.river.artifacts.common.JasperReporter;
+import org.dive4elements.river.artifacts.common.MetaAndTableJRDataSource;
import org.dive4elements.river.artifacts.common.ResultRow;
import org.dive4elements.river.artifacts.sinfo.common.AbstractSInfoExporter;
import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType;
import org.dive4elements.river.artifacts.sinfo.util.BedHeightInfo;
-import org.dive4elements.river.artifacts.sinfo.util.MetaAndTableJRDataSource;
import org.dive4elements.river.artifacts.sinfo.util.RiverInfo;
import org.dive4elements.river.artifacts.sinfo.util.WstInfo;
import au.com.bytecode.opencsv.CSVWriter;
+import net.sf.jasperreports.engine.JRException;
/**
* Generates different output formats (csv, pdf) of data that resulted from a flow depths computation.
@@ -35,7 +38,7 @@
/** The log used in this exporter. */
private static Logger log = Logger.getLogger(FlowDepthMinMaxExporter.class);
- private static final String JASPER_FILE = "/jasper/sinfo.flowdepthminmax.jasper";
+ private static final String JASPER_FILE = "/jasper/templates/sinfo.flowdepthminmax.jrxml";
@Override
protected Logger getLog() {
@@ -51,6 +54,7 @@
writer.writeNext(new String[] { "" }); // break line
final WstInfo wst = result.getWst();
writeCSVWaterlevelMetadata(writer, wst);
+ writer.writeNext(new String[] { "" }); // break line
}
@Override
@@ -120,11 +124,6 @@
}
@Override
- protected final String getJasperFile() {
- return JASPER_FILE;
- }
-
- @Override
protected final void addJRMetaData(final MetaAndTableJRDataSource source, final FlowDepthMinMaxCalculationResults results) {
/* general metadata */
@@ -143,4 +142,18 @@
source.addMetaData("location_header", SInfoResultType.location.getPdfHeader(this.context.getMeta()));
}
+ @Override
+ protected void writePDF(final OutputStream out) {
+ try {
+ final MetaAndTableJRDataSource source = createJRData(this.data);
+
+ final JasperReporter reporter = new JasperReporter();
+ reporter.addReport(JASPER_FILE, source);
+ reporter.exportPDF(out);
+ }
+ catch (final JRException je) {
+ getLog().warn("Error generating PDF Report!", je);
+ }
+ }
+
}
\ No newline at end of file
diff -r 460fcc128794 -r 7134a4c7d1b6 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/TkhExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/TkhExporter.java Tue Apr 17 13:19:56 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/TkhExporter.java Tue Apr 17 13:20:25 2018 +0200
@@ -8,19 +8,22 @@
package org.dive4elements.river.artifacts.sinfo.tkhstate;
+import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collection;
import org.apache.log4j.Logger;
import org.dive4elements.river.artifacts.common.GeneralResultType;
+import org.dive4elements.river.artifacts.common.JasperReporter;
+import org.dive4elements.river.artifacts.common.MetaAndTableJRDataSource;
import org.dive4elements.river.artifacts.common.ResultRow;
import org.dive4elements.river.artifacts.sinfo.common.AbstractSInfoExporter;
import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType;
-import org.dive4elements.river.artifacts.sinfo.util.MetaAndTableJRDataSource;
import org.dive4elements.river.artifacts.sinfo.util.RiverInfo;
import org.dive4elements.river.artifacts.sinfo.util.WstInfo;
import au.com.bytecode.opencsv.CSVWriter;
+import net.sf.jasperreports.engine.JRException;
/**
* Generates different output formats (csv, pdf) of data that resulted from a tkh computation.
@@ -35,7 +38,7 @@
private static final String CSV_META_CALCULATION_FORMULA = "sinfo.export.tkh.calculation.formula";
- private static final String JASPER_FILE = "/jasper/sinfo.tkh.jasper";
+ private static final String JASPER_FILE = "/jasper/templates/sinfo.tkh.jrxml";
@Override
protected Logger getLog() {
@@ -87,7 +90,7 @@
final WstInfo wst = result.getWst();
super.writeCSVWaterlevelMetadata(writer, wst);
-
+ writer.writeNext(new String[] { "" }); // break line
// FIXME:
// "# W/Pegel [cm]: " (nur bei Eingabe des Wasserstands am Pegel)
// "# Q (m³/s): " (nur bei Eingabe des Durchflusses)
@@ -123,11 +126,6 @@
}
@Override
- protected final String getJasperFile() {
- return JASPER_FILE;
- }
-
- @Override
protected final void addJRMetaData(final MetaAndTableJRDataSource source, final TkhCalculationResults results) {
/* general metadata */
@@ -155,4 +153,18 @@
source.addMetaData("location_header", SInfoResultType.location.getPdfHeader(this.context.getMeta()));
}
+ @Override
+ protected void writePDF(final OutputStream out) {
+ try {
+ final MetaAndTableJRDataSource source = createJRData(this.data);
+
+ final JasperReporter reporter = new JasperReporter();
+ reporter.addReport(JASPER_FILE, source);
+ reporter.exportPDF(out);
+ }
+ catch (final JRException je) {
+ getLog().warn("Error generating PDF Report!", je);
+ }
+ }
+
}
\ No newline at end of file
diff -r 460fcc128794 -r 7134a4c7d1b6 artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/commons/AbstractUInfoExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/commons/AbstractUInfoExporter.java Tue Apr 17 13:19:56 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/commons/AbstractUInfoExporter.java Tue Apr 17 13:20:25 2018 +0200
@@ -20,8 +20,8 @@
import org.dive4elements.river.artifacts.common.AbstractCalculationResults;
import org.dive4elements.river.artifacts.common.AbstractCommonExporter;
import org.dive4elements.river.artifacts.common.I18NStrings;
+import org.dive4elements.river.artifacts.common.MetaAndTableJRDataSource;
import org.dive4elements.river.artifacts.resources.Resources;
-import org.dive4elements.river.artifacts.sinfo.util.MetaAndTableJRDataSource;
import org.dive4elements.river.artifacts.sinfo.util.RiverInfo;
import au.com.bytecode.opencsv.CSVWriter;
diff -r 460fcc128794 -r 7134a4c7d1b6 artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/commons/UInfoResultType.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/commons/UInfoResultType.java Tue Apr 17 13:19:56 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/commons/UInfoResultType.java Tue Apr 17 13:20:25 2018 +0200
@@ -21,6 +21,8 @@
*/
public abstract class UInfoResultType extends AbstractResultType {
+ private static final long serialVersionUID = 1L;
+
public UInfoResultType(final String unit, final String csvHeader) {
super(unit, csvHeader, csvHeader);
@@ -39,6 +41,8 @@
}
public static final UInfoResultType salixline = new UInfoResultType(null, "uinfo.export.salix_line.csv.header.salix_line") {
+ private static final long serialVersionUID = 1L;
+
@Override
public String exportValue(final CallContext context, final Object value) {
final double doubleValue = asDouble(value);
@@ -54,6 +58,8 @@
};
public static final UInfoResultType salixlinehist = new UInfoResultType(null, "uinfo.export.salix_line.csv.header.hist") {
+ private static final long serialVersionUID = 1L;
+
@Override
public String exportValue(final CallContext context, final Object value) {
final double doubleValue = asDouble(value);
@@ -69,6 +75,8 @@
};
public static final UInfoResultType salixlinescen = new UInfoResultType(null, "uinfo.export.salix_line.csv.header.scen") {
+ private static final long serialVersionUID = 1L;
+
@Override
public String exportValue(final CallContext context, final Object value) {
final double doubleValue = asDouble(value);
@@ -83,4 +91,51 @@
}
};
+ public static final UInfoResultType vegname = new UInfoResultType(null, "uinfo.export.csv.meta.header.veg.name") {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String exportValue(final CallContext context, final Object value) {
+ return exportStringValue(value);
+ }
+
+ @Override
+ protected NumberFormat createFormatter(final CallContext context) {
+ throw new UnsupportedOperationException();
+ }
+ };
+
+ public static final UInfoResultType vegdauervon = new UInfoResultType(null, "uinfo.export.csv.meta.header.veg.dauervon") {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String exportValue(final CallContext context, final Object value) {
+ final double doubleValue = asDouble(value);
+ return exportDoubleValue(context, doubleValue);
+ }
+
+ @Override
+ protected NumberFormat createFormatter(final CallContext context) {
+ // REMARK: other modules use Formatter.getWaterlevelW(context) instead, but that format with a variable number of
+ // digits.
+ return Formatter.getUeberflutungsdauer(context);
+ }
+ };
+
+ public static final UInfoResultType vegdauerbis = new UInfoResultType(null, "uinfo.export.csv.meta.header.veg.dauerbis") {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String exportValue(final CallContext context, final Object value) {
+ final double doubleValue = asDouble(value);
+ return exportDoubleValue(context, doubleValue);
+ }
+
+ @Override
+ protected NumberFormat createFormatter(final CallContext context) {
+ // REMARK: other modules use Formatter.getWaterlevelW(context) instead, but that format with a variable number of
+ // digits.
+ return Formatter.getUeberflutungsdauer(context);
+ }
+ };
}
diff -r 460fcc128794 -r 7134a4c7d1b6 artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/InundationDurationExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/InundationDurationExporter.java Tue Apr 17 13:19:56 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/InundationDurationExporter.java Tue Apr 17 13:20:25 2018 +0200
@@ -9,18 +9,21 @@
*/
package org.dive4elements.river.artifacts.uinfo.inundationduration;
+import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collection;
import org.apache.log4j.Logger;
import org.dive4elements.river.artifacts.common.GeneralResultType;
+import org.dive4elements.river.artifacts.common.JasperReporter;
+import org.dive4elements.river.artifacts.common.MetaAndTableJRDataSource;
import org.dive4elements.river.artifacts.common.ResultRow;
import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType;
-import org.dive4elements.river.artifacts.sinfo.util.MetaAndTableJRDataSource;
import org.dive4elements.river.artifacts.sinfo.util.RiverInfo;
import org.dive4elements.river.artifacts.uinfo.commons.AbstractUInfoExporter;
import au.com.bytecode.opencsv.CSVWriter;
+import net.sf.jasperreports.engine.JRException;
/**
* @author Domenico Nardi Tironi
@@ -31,7 +34,7 @@
/** The log used in this exporter. */
private static Logger log = Logger.getLogger(InundationDurationExporter.class);
- private static final String JASPER_FILE = "/jasper/uinfo.inundationduration.jasper";
+ private static final String JASPER_FILE = "/jasper/templates/uinfo.inundationduration.jrxml";
@Override
protected Logger getLog() {
@@ -43,6 +46,7 @@
log.info("SalixLineExporter.writeCSVMeta");
super.writeCSVGlobalMetadataDefaults(writer, results);
+ writer.writeNext(new String[] { "" }); // break line
}
@Override
@@ -111,28 +115,28 @@
}
@Override
- protected final String getJasperFile() {
- return JASPER_FILE;
- }
-
- @Override
protected final void addJRMetaData(final MetaAndTableJRDataSource source, final InundationDurationCalculationResults results) {
/* general metadata */
super.addJRMetaData(source, results);
-
+
/* column headings */
source.addMetaData("station_header", GeneralResultType.station.getPdfHeader(this.context.getMeta()));
- // source.addMetaData("flowdepth_header", SInfoResultType.flowdepth.getPdfHeader(this.context.getMeta()));
- // source.addMetaData("flowdepth_tkh_header", SInfoResultType.flowdepthtkh.getPdfHeader(this.context.getMeta()));
- // source.addMetaData("tkh_header", SInfoResultType.tkh.getPdfHeader(this.context.getMeta()));
- // source.addMetaData("waterlevel_header", SInfoResultType.waterlevel.getPdfHeader(this.context.getMeta()));
- // source.addMetaData("discharge_header", SInfoResultType.discharge.getPdfHeader(this.context.getMeta()));
- // source.addMetaData("waterlevel_name_header", SInfoResultType.waterlevelLabel.getPdfHeader(this.context.getMeta()));
- // source.addMetaData("gauge_header", SInfoResultType.gaugeLabel.getPdfHeader(this.context.getMeta()));
- // source.addMetaData("bedheight_header", SInfoResultType.meanBedHeight.getPdfHeader(this.context.getMeta()));
- // source.addMetaData("sounding_name_header", SInfoResultType.soundingLabel.getPdfHeader(this.context.getMeta()));
- // source.addMetaData("location_header", SInfoResultType.location.getPdfHeader(this.context.getMeta()));
+
+ }
+
+ @Override
+ protected void writePDF(final OutputStream out) {
+ try {
+ final MetaAndTableJRDataSource source = createJRData(this.data);
+
+ final JasperReporter reporter = new JasperReporter();
+ reporter.addReport(JASPER_FILE, source);
+ reporter.exportPDF(out);
+ }
+ catch (final JRException je) {
+ getLog().warn("Error generating PDF Report!", je);
+ }
}
}
\ No newline at end of file
diff -r 460fcc128794 -r 7134a4c7d1b6 artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineExporter.java Tue Apr 17 13:19:56 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineExporter.java Tue Apr 17 13:20:25 2018 +0200
@@ -9,18 +9,21 @@
*/
package org.dive4elements.river.artifacts.uinfo.salix;
+import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collection;
import org.apache.log4j.Logger;
import org.dive4elements.river.artifacts.common.GeneralResultType;
+import org.dive4elements.river.artifacts.common.JasperReporter;
+import org.dive4elements.river.artifacts.common.MetaAndTableJRDataSource;
import org.dive4elements.river.artifacts.common.ResultRow;
-import org.dive4elements.river.artifacts.sinfo.util.MetaAndTableJRDataSource;
import org.dive4elements.river.artifacts.sinfo.util.RiverInfo;
import org.dive4elements.river.artifacts.uinfo.commons.AbstractUInfoExporter;
import org.dive4elements.river.artifacts.uinfo.commons.UInfoResultType;
import au.com.bytecode.opencsv.CSVWriter;
+import net.sf.jasperreports.engine.JRException;
/**
* @author Domenico Nardi Tironi
@@ -31,7 +34,7 @@
/** The log used in this exporter. */
private static Logger log = Logger.getLogger(SalixLineExporter.class);
- private static final String JASPER_FILE = "/jasper/uinfo.salixline.jasper";
+ private static final String JASPER_FILE = "/jasper/templates/uinfo.salixline.jrxml";
@Override
protected Logger getLog() {
@@ -156,27 +159,33 @@
}
@Override
- protected final String getJasperFile() {
- return JASPER_FILE;
- }
-
- @Override
protected final void addJRMetaData(final MetaAndTableJRDataSource source, final SalixLineCalculationResults results) {
super.addJRMetaData(source, results);
/* additional column headings */
source.addMetaData("station_header", GeneralResultType.station.getPdfHeader(this.context.getMeta()));
- // source.addMetaData("flowdepth_header", SInfoResultType.flowdepth.getPdfHeader(this.context.getMeta()));
- // source.addMetaData("flowdepth_tkh_header", SInfoResultType.flowdepthtkh.getPdfHeader(this.context.getMeta()));
- // source.addMetaData("tkh_header", SInfoResultType.tkh.getPdfHeader(this.context.getMeta()));
- // source.addMetaData("waterlevel_header", SInfoResultType.waterlevel.getPdfHeader(this.context.getMeta()));
- // source.addMetaData("discharge_header", SInfoResultType.discharge.getPdfHeader(this.context.getMeta()));
- // source.addMetaData("waterlevel_name_header", SInfoResultType.waterlevelLabel.getPdfHeader(this.context.getMeta()));
- // source.addMetaData("gauge_header", SInfoResultType.gaugeLabel.getPdfHeader(this.context.getMeta()));
- // source.addMetaData("bedheight_header", SInfoResultType.meanBedHeight.getPdfHeader(this.context.getMeta()));
- // source.addMetaData("sounding_name_header", SInfoResultType.soundingLabel.getPdfHeader(this.context.getMeta()));
- // source.addMetaData("location_header", SInfoResultType.location.getPdfHeader(this.context.getMeta()));
+
+ source.addMetaData("salix_line", UInfoResultType.salixline.getPdfHeader(this.context.getMeta()));
+ // wenn "historisch" gewählt wurde, nur "historisch" anzeigen; sonst für jeden scen-wert ne neue Spalte und "hist"
+ // ausblenden!...!..!!
+ source.addMetaData("salix_line_hist", UInfoResultType.salixlinehist.getPdfHeader(this.context.getMeta()));
+ source.addMetaData("salix_line_scen", UInfoResultType.salixlinescen.getPdfHeader(this.context.getMeta()));
+ }
+
+ @Override
+ protected void writePDF(final OutputStream out) {
+ try {
+ final MetaAndTableJRDataSource source = createJRData(this.data);
+
+ final JasperReporter reporter = new JasperReporter();
+ reporter.addReport(JASPER_FILE, source);
+ reporter.exportPDF(out);
+ }
+ catch (final JRException je) {
+ getLog().warn("Error generating PDF Report!", je);
+ }
+
}
}
\ No newline at end of file
diff -r 460fcc128794 -r 7134a4c7d1b6 artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesCalculation.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesCalculation.java Tue Apr 17 13:19:56 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesCalculation.java Tue Apr 17 13:20:25 2018 +0200
@@ -1,6 +1,6 @@
/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
- * Software engineering by
- * Björnsen Beratende Ingenieure GmbH
+ * Software engineering by
+ * Björnsen Beratende Ingenieure GmbH
* Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
*
* This file is Free Software under the GNU AGPL (>=v3)
@@ -19,10 +19,10 @@
import org.dive4elements.river.artifacts.model.Calculation;
import org.dive4elements.river.artifacts.model.CalculationResult;
import org.dive4elements.river.artifacts.resources.Resources;
-import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType;
import org.dive4elements.river.artifacts.sinfo.util.CalculationUtils;
import org.dive4elements.river.artifacts.sinfo.util.RiverInfo;
import org.dive4elements.river.artifacts.uinfo.UINFOArtifact;
+import org.dive4elements.river.artifacts.uinfo.commons.UInfoResultType;
import org.dive4elements.river.model.River;
/**
@@ -31,13 +31,13 @@
*/
final class VegetationZonesCalculation {
- private CallContext context;
+ private final CallContext context;
- public VegetationZonesCalculation(CallContext context) {
+ public VegetationZonesCalculation(final CallContext context) {
this.context = context;
}
- public CalculationResult calculate(UINFOArtifact uinfo) {
+ public CalculationResult calculate(final UINFOArtifact uinfo) {
final Calculation problems = new Calculation();
final String calcModeLabel = Resources.getMsg(this.context.getMeta(), uinfo.getCalculationMode().name());
@@ -45,31 +45,24 @@
final RiverAccess access = new RiverAccess(uinfo);
final River river = access.getRiver();
- DoubleRange calcRange = null;
+ final DoubleRange calcRange = null;
final RiverInfo riverInfo = new RiverInfo(river);
-
+
final VegetationZonesCalculationResults results = new VegetationZonesCalculationResults(calcModeLabel, user, riverInfo, calcRange);
- final Collection<ResultRow> rows = new ArrayList<ResultRow>();
-
- final ResultRow row1 = ResultRow.create(). //
- putValue(SInfoResultType.discharge, 100). //
- putValue(SInfoResultType.waterlevel, 2). //
- putValue(SInfoResultType.gaugeLabel, "Torgau");
+ final Collection<ResultRow> rows = new ArrayList<>();
- rows.add(row1);
-
- ResultRow row2 = ResultRow.create(). //
- putValue(SInfoResultType.discharge, 200). //
- putValue(SInfoResultType.waterlevel, 3). //
- putValue(SInfoResultType.gaugeLabel, "Zollenspieker");
+ final ResultRow row2 = ResultRow.create(). //
+ putValue(UInfoResultType.vegname, "Zonaler Wald"). //
+ putValue(UInfoResultType.vegdauervon, 0). //
+ putValue(UInfoResultType.vegdauerbis, 5);
rows.add(row2);
final VegetationZonesCalculationResult result = new VegetationZonesCalculationResult("Ergebnis 1", null, rows);
-
+
results.addResult(result, problems);
-
+
return new CalculationResult(results, problems);
}
}
\ No newline at end of file
diff -r 460fcc128794 -r 7134a4c7d1b6 artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesExporter.java Tue Apr 17 13:19:56 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesExporter.java Tue Apr 17 13:20:25 2018 +0200
@@ -9,17 +9,22 @@
*/
package org.dive4elements.river.artifacts.uinfo.vegetationzones;
+import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collection;
+import org.apache.commons.lang.math.DoubleRange;
import org.apache.log4j.Logger;
-import org.dive4elements.river.artifacts.common.GeneralResultType;
+import org.dive4elements.river.artifacts.common.I18NStrings;
+import org.dive4elements.river.artifacts.common.JasperReporter;
+import org.dive4elements.river.artifacts.common.MetaAndTableJRDataSource;
import org.dive4elements.river.artifacts.common.ResultRow;
-import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType;
import org.dive4elements.river.artifacts.sinfo.util.RiverInfo;
import org.dive4elements.river.artifacts.uinfo.commons.AbstractUInfoExporter;
+import org.dive4elements.river.artifacts.uinfo.commons.UInfoResultType;
import au.com.bytecode.opencsv.CSVWriter;
+import net.sf.jasperreports.engine.JRException;
/**
* @author Domenico Nardi Tironi
@@ -30,7 +35,7 @@
/** The log used in this exporter. */
private static Logger log = Logger.getLogger(VegetationZonesExporter.class);
- private static final String JASPER_FILE = "/jasper/uinfo.vegetationzones.jasper";
+ private static final String JASPER_FILE = "/jasper/templates/uinfo.vegetationzones.jrxml";
@Override
protected Logger getLog() {
@@ -41,6 +46,13 @@
protected void writeCSVGlobalMetadata(final CSVWriter writer, final VegetationZonesCalculationResults results) {
log.info("SalixLineExporter.writeCSVMeta");
super.writeCSVGlobalMetadataDefaults(writer, results);
+
+ final DoubleRange calcRange = results.getCalcRange();
+ if (calcRange != null) {
+ // "# Ort/Bereich (km): "
+ writeCSVMetaEntry(writer, I18NStrings.CSV_META_RANGE, msg(I18NStrings.CSV_META_RANGE_LABEL), getKmFormatter().format(calcRange.getMinimumDouble()),
+ getKmFormatter().format(calcRange.getMaximumDouble()));
+ }
}
/**
@@ -56,16 +68,9 @@
final Collection<String> header = new ArrayList<>(11);
- header.add(msg(GeneralResultType.station.getCsvHeader()));
- header.add(msgUnit(SInfoResultType.flowdepth.getCsvHeader(), SInfoResultType.flowdepth.getUnit()));
-
- header.add(msgUnit(SInfoResultType.waterlevel.getCsvHeader(), river.getWstUnit()));
- header.add(msgUnit(SInfoResultType.discharge.getCsvHeader(), SInfoResultType.discharge.getUnit()));
- header.add(msg(SInfoResultType.waterlevelLabel.getCsvHeader()));
- header.add(msg(SInfoResultType.gaugeLabel.getCsvHeader()));
- header.add(msgUnit(SInfoResultType.meanBedHeight.getCsvHeader(), river.getWstUnit()));
- header.add(msg(SInfoResultType.soundingLabel.getCsvHeader()));
- header.add(msg(SInfoResultType.location.getCsvHeader()));
+ header.add(msg(UInfoResultType.vegname.getCsvHeader()));
+ header.add(msg(UInfoResultType.vegdauervon.getCsvHeader()));
+ header.add(msg(UInfoResultType.vegdauerbis.getCsvHeader()));
writer.writeNext(header.toArray(new String[header.size()]));
}
@@ -82,31 +87,42 @@
final Collection<String> lines = new ArrayList<>(11);
- lines.add(row.exportValue(this.context, GeneralResultType.station));
- lines.add(row.exportValue(this.context, SInfoResultType.flowdepth));
-
- lines.add(row.exportValue(this.context, SInfoResultType.waterlevel));
- lines.add(row.exportValue(this.context, SInfoResultType.discharge));
- lines.add(row.exportValue(this.context, SInfoResultType.waterlevelLabel));
- lines.add(row.exportValue(this.context, SInfoResultType.gaugeLabel));
- lines.add(row.exportValue(this.context, SInfoResultType.meanBedHeight));
- lines.add(row.exportValue(this.context, SInfoResultType.soundingLabel));
- lines.add(row.exportValue(this.context, SInfoResultType.location));
+ lines.add(row.exportValue(this.context, UInfoResultType.vegname));
+ lines.add(row.exportValue(this.context, UInfoResultType.vegdauervon));
+ lines.add(row.exportValue(this.context, UInfoResultType.vegdauerbis));
return lines.toArray(new String[lines.size()]);
}
@Override
- protected String getJasperFile() {
- // TODO Auto-generated method stub
- return JASPER_FILE;
+ protected void writeCSVResultMetadata(final CSVWriter writer, final VegetationZonesCalculationResults results,
+ final VegetationZonesCalculationResult result) {
+
}
@Override
- protected void writeCSVResultMetadata(final CSVWriter writer, final VegetationZonesCalculationResults results,
- final VegetationZonesCalculationResult result) {
- // TODO Auto-generated method stub
+ protected final void addJRMetaData(final MetaAndTableJRDataSource source, final VegetationZonesCalculationResults results) {
+ super.addJRMetaData(source, results);
+
+ /* additional column headings */
+ source.addMetaData("veg_name", UInfoResultType.vegname.getPdfHeader(this.context.getMeta()));
+ source.addMetaData("veg_dauervon", UInfoResultType.vegdauervon.getPdfHeader(this.context.getMeta()));
+ source.addMetaData("veg_dauerbis", UInfoResultType.vegdauerbis.getPdfHeader(this.context.getMeta()));
+ }
+
+ @Override
+ protected void writePDF(final OutputStream out) {
+ try {
+ final MetaAndTableJRDataSource source = createJRData(this.data);
+
+ final JasperReporter reporter = new JasperReporter();
+ reporter.addReport(JASPER_FILE, source);
+ reporter.exportPDF(out);
+ }
+ catch (final JRException je) {
+ getLog().warn("Error generating PDF Report!", je);
+ }
}
}
\ No newline at end of file
diff -r 460fcc128794 -r 7134a4c7d1b6 artifacts/src/main/java/org/dive4elements/river/utils/Formatter.java
--- a/artifacts/src/main/java/org/dive4elements/river/utils/Formatter.java Tue Apr 17 13:19:56 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/utils/Formatter.java Tue Apr 17 13:20:25 2018 +0200
@@ -99,7 +99,7 @@
/**
* Creates a localized NumberFormatter with given range of decimal digits.
- *
+ *
* @param m
* CallMeta to find the locale.
* @param min
@@ -398,4 +398,8 @@
public static NumberFormat getSalixLine(final CallContext context) {
return Formatter.getFormatter(context, 2, 2);
}
+
+ public static NumberFormat getUeberflutungsdauer(final CallContext context) {
+ return Formatter.getFormatter(context, 0, 0);
+ }
}
\ No newline at end of file
diff -r 460fcc128794 -r 7134a4c7d1b6 artifacts/src/main/resources/messages.properties
--- a/artifacts/src/main/resources/messages.properties Tue Apr 17 13:19:56 2018 +0200
+++ b/artifacts/src/main/resources/messages.properties Tue Apr 17 13:20:25 2018 +0200
@@ -860,7 +860,7 @@
sinfo.export.flow_depth.pdf.meta.calculation.name = Gill (1971)
sinfo.export.flow_depth.csv.meta.height_unit.river = # H\u00f6hensystem des Flusses: {0}
-sinfo.export.flow_depth.csv.header.km = Fluss-km
+export.flow_depth.csv.header.km = Fluss-km
sinfo.export.flow_depth.csv.header.flowdepth = Flie\u00dftiefe
sinfo.export.flow_depth.csv.header.flowdepthTkh = Flie\u00dftiefe mit TKH
sinfo.export.flow_depth.csv.header.tkh = TKH
@@ -986,7 +986,7 @@
flowdepthdevelopmentcalculation.yearDifferenceHistorical = = historisches Differenzenpaar
uinfo_salix_line = Salix-Linie
-uinfo_inundation_duration = Überflutungsdauern Aue
+uinfo_inundation_duration = \ufffdberflutungsdauern Aue
uinfo_vegetation_zones = Vegetationszonen
state.uinfo.river = Gew\u00e4sser
@@ -1008,10 +1008,14 @@
uinfo.export.csv.meta.header.salix.szenariotyp = # Szenariotyp
uinfo.export.csv.meta.header.salix.teilabschnitt = # Teilabschnitt
-uinfo.export.csv.meta.header.salix.mwspiegellaenderung = # MittelwasserSpiegellagenänderung
+uinfo.export.csv.meta.header.salix.mwspiegellaenderung = # MittelwasserSpiegellagen\ufffdnderung
uinfo.export.csv.meta.header.salix.historical = ##Historische Betrachtung
uinfo.export.csv.meta.header.salix.historical.zeitpunkt = # Historischer Zeitpunkt
- uinfo.export.csv.meta.header.salix.historical.zeitart = # Art des Zeitraums
+uinfo.export.csv.meta.header.salix.historical.zeitart = # Art des Zeitraums
+
+uinfo.export.csv.meta.header.veg.name = Vegetationszonen
+uinfo.export.csv.meta.header.veg.dauervon = \u00dcberflutungsdauer von [d/a]
+uinfo.export.csv.meta.header.veg.dauerbis = \u00dcberflutungsdauer bis [d/a]
\ No newline at end of file
diff -r 460fcc128794 -r 7134a4c7d1b6 artifacts/src/main/resources/messages_de.properties
--- a/artifacts/src/main/resources/messages_de.properties Tue Apr 17 13:19:56 2018 +0200
+++ b/artifacts/src/main/resources/messages_de.properties Tue Apr 17 13:20:25 2018 +0200
@@ -860,7 +860,7 @@
sinfo.export.flow_depth.pdf.meta.calculation.name = Gill (1971)
sinfo.export.flow_depth.csv.meta.height_unit.river = # H\u00f6hensystem des Flusses: {0}
-sinfo.export.flow_depth.csv.header.km = Fluss-km
+export.flow_depth.csv.header.km = Fluss-km
sinfo.export.flow_depth.csv.header.flowdepth = Flie\u00dftiefe
sinfo.export.flow_depth.csv.header.flowdepthTkh = Flie\u00dftiefe mit TKH
sinfo.export.flow_depth.csv.header.tkh = TKH
@@ -986,7 +986,7 @@
flowdepthdevelopmentcalculation.yearDifferenceHistorical = = historisches Differenzenpaar
uinfo_salix_line = Salix-Linie
-uinfo_inundation_duration = Überflutungsdauern Aue
+uinfo_inundation_duration = \ufffdberflutungsdauern Aue
uinfo_vegetation_zones = Vegetationszonen
state.uinfo.river = Gew\u00e4sser
@@ -1008,10 +1008,13 @@
uinfo.export.csv.meta.header.salix.szenariotyp = # Szenariotyp
uinfo.export.csv.meta.header.salix.teilabschnitt = # Teilabschnitt
-uinfo.export.csv.meta.header.salix.mwspiegellaenderung = # MittelwasserSpiegellagenänderung
+uinfo.export.csv.meta.header.salix.mwspiegellaenderung = # MittelwasserSpiegellagen\ufffdnderung
uinfo.export.csv.meta.header.salix.historical = ##Historische Betrachtung
uinfo.export.csv.meta.header.salix.historical.zeitpunkt = # Historischer Zeitpunkt
- uinfo.export.csv.meta.header.salix.historical.zeitart = # Art des Zeitraums
-
\ No newline at end of file
+uinfo.export.csv.meta.header.salix.historical.zeitart = # Art des Zeitraums
+
+uinfo.export.csv.meta.header.veg.name = Vegetationszonen
+uinfo.export.csv.meta.header.veg.dauervon = \ufffdberflutungsdauer von [d/a]
+uinfo.export.csv.meta.header.veg.dauerbis = \ufffdberflutungsdauer bis [d/a]
\ No newline at end of file
More information about the Dive4Elements-commits
mailing list