[PATCH] pdf exports added for fixation+bundu (waterlevel)

Wald Commits scm-commit at wald.intevation.org
Mon Sep 17 19:08:37 CEST 2018


# HG changeset patch
# User gernotbelger
# Date 1537204077 -7200
# Node ID ce13a2f072903b4e179d05c4ca6d1e2a4c9a807e
# Parent  dd05a5eef2106dc958ce5fb74111119e238ccd3d
pdf exports added for fixation+bundu (waterlevel)

diff -r dd05a5eef210 -r ce13a2f07290 artifacts/doc/conf/jasper/templates/fix_waterlevel.jrxml
--- a/artifacts/doc/conf/jasper/templates/fix_waterlevel.jrxml	Mon Sep 17 16:00:00 2018 +0200
+++ b/artifacts/doc/conf/jasper/templates/fix_waterlevel.jrxml	Mon Sep 17 19:07:57 2018 +0200
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- Created with Jaspersoft Studio version 6.6.0.final using JasperReports Library version 4.5.0  -->
-<!-- 2018-08-28T11:58:49 -->
+<!-- 2018-09-17T18:38:39 -->
 <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"/>
@@ -44,6 +44,7 @@
 	<field name="meta:flowdepthdevelopment_header_label" class="java.lang.String"/>
 	<field name="meta:flowdepth_tkh_header" class="java.lang.String"/>
 	<field name="meta:w_at_gauge_header" class="java.lang.String"/>
+	<field name="meta:w_at_gauge_header_2" class="java.lang.String"/>
 	<field name="meta:tkh_header" class="java.lang.String"/>
 	<field name="meta:tkhkind_header" class="java.lang.String"/>
 	<field name="meta:waterlevel_header" class="java.lang.String"/>
@@ -155,7 +156,7 @@
 			<textField isStretchWithOverflow="true">
 				<reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="278" y="0" width="85" height="24"/>
 				<box padding="5"/>
-				<textElement textAlignment="Left" verticalAlignment="Bottom"/>
+				<textElement textAlignment="Right" verticalAlignment="Bottom"/>
 				<textFieldExpression><![CDATA[$F{meta:waterlevel_name_header}]]></textFieldExpression>
 			</textField>
 			<textField isStretchWithOverflow="true">
@@ -226,7 +227,7 @@
 					<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
 					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
 				</box>
-				<textElement textAlignment="Left" verticalAlignment="Top"/>
+				<textElement textAlignment="Right" verticalAlignment="Top"/>
 				<textFieldExpression><![CDATA[$F{data:4}]]></textFieldExpression>
 			</textField>
 			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
diff -r dd05a5eef210 -r ce13a2f07290 artifacts/doc/conf/jasper/templates/waterlevel_new.jrxml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/doc/conf/jasper/templates/waterlevel_new.jrxml	Mon Sep 17 19:07:57 2018 +0200
@@ -0,0 +1,272 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Created with Jaspersoft Studio version 6.6.0.final using JasperReports Library version 4.5.0  -->
+<!-- 2018-09-17T18:59:50 -->
+<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"/>
+	<style name="htmlStyle" isDefault="true" mode="Transparent" markup="html" fontName="Roboto">
+		<paragraph lineSpacing="Single"/>
+	</style>
+	<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"/>
+	<field name="meta:version" class="java.lang.String"/>
+	<field name="meta:user_label" class="java.lang.String"/>
+	<field name="meta:user" class="java.lang.String"/>
+	<field name="meta:date_label" class="java.lang.String"/>
+	<field name="meta:date" class="java.lang.String"/>
+	<field name="meta:river_label" class="java.lang.String"/>
+	<field name="meta:river" class="java.lang.String"/>
+	<field name="meta:range_label" class="java.lang.String"/>
+	<field name="meta:range" class="java.lang.String"/>
+	<field name="meta:calculation_label" class="java.lang.String"/>
+	<field name="meta:calculation_name" class="java.lang.String"/>
+	<field name="meta:station_header" class="java.lang.String"/>
+	<field name="meta:flowdepthdevelopment_header" class="java.lang.String"/>
+	<field name="meta:flowdepthdevelopmentperyear_header" class="java.lang.String"/>
+	<field name="meta:waterleveldifference_header" class="java.lang.String"/>
+	<field name="meta:waterleveldifference_header2" class="java.lang.String"/>
+	<field name="meta:waterleveldifference_header_label" class="java.lang.String"/>
+	<field name="meta:bedheightdifference_header" class="java.lang.String"/>
+	<field name="meta:bedheightdifference_header2" class="java.lang.String"/>
+	<field name="meta:bedheightdifference_header_label" class="java.lang.String"/>
+	<field name="meta:flowdepthcurrent_header" class="java.lang.String"/>
+	<field name="meta:flowdepthcurrent_header2" class="java.lang.String"/>
+	<field name="meta:flowdepthhistorical_header" class="java.lang.String"/>
+	<field name="meta:flowdepthhistorical_header2" class="java.lang.String"/>
+	<field name="meta:flowdepthcurrent_header_label" class="java.lang.String"/>
+	<field name="meta:flowdepthhistorical_header_label" class="java.lang.String"/>
+	<field name="meta:flowdepth_header" class="java.lang.String"/>
+	<field name="meta:flowdepthdevelopment" class="java.lang.String"/>
+	<field name="meta:flowdepthmin_header" class="java.lang.String"/>
+	<field name="meta:flowdepthmax_header" class="java.lang.String"/>
+	<field name="meta:flowdepthdevelopment_header_label" class="java.lang.String"/>
+	<field name="meta:flowdepth_tkh_header" class="java.lang.String"/>
+	<field name="meta:w_at_gauge_header" class="java.lang.String"/>
+	<field name="meta:w_at_gauge_header_2" class="java.lang.String"/>
+	<field name="meta:tkh_header" class="java.lang.String"/>
+	<field name="meta:tkhkind_header" class="java.lang.String"/>
+	<field name="meta:waterlevel_header" class="java.lang.String"/>
+	<field name="meta:discharge_header" class="java.lang.String"/>
+	<field name="meta:waterlevel_name_header" class="java.lang.String"/>
+	<field name="meta:gauge_header" class="java.lang.String"/>
+	<field name="meta:bedheight_header" class="java.lang.String"/>
+	<field name="meta:sounding_name_header" class="java.lang.String"/>
+	<field name="meta:location_header" class="java.lang.String"/>
+	<field name="meta:fix_date" class="java.lang.String"/>
+	<field name="meta:fix_q" class="java.lang.String"/>
+	<field name="meta:fix_w" class="java.lang.String"/>
+	<field name="meta:fix_state" class="java.lang.String"/>
+	<field name="meta:fix_delta_w" 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"/>
+	<background>
+		<band splitType="Stretch"/>
+	</background>
+	<title>
+		<band height="169" splitType="Stretch">
+			<textField>
+				<reportElement style="htmlStyle" x="0" y="0" width="515" height="30"/>
+				<textElement>
+					<font size="18"/>
+				</textElement>
+				<textFieldExpression><![CDATA[$F{meta:header} + " " + $F{meta:river}]]></textFieldExpression>
+			</textField>
+			<textField>
+				<reportElement style="htmlStyle" x="0" y="39" width="165" height="20"/>
+				<textFieldExpression><![CDATA[$F{meta:calcMode}]]></textFieldExpression>
+			</textField>
+			<textField>
+				<reportElement style="htmlStyle" x="0" y="69" width="123" height="20"/>
+				<textFieldExpression><![CDATA[$F{meta:version_label} + ":"]]></textFieldExpression>
+			</textField>
+			<textField>
+				<reportElement style="htmlStyle" x="123" y="69" width="392" height="20"/>
+				<textFieldExpression><![CDATA[$F{meta:version}]]></textFieldExpression>
+			</textField>
+			<textField>
+				<reportElement style="htmlStyle" x="0" y="89" width="123" height="20"/>
+				<textFieldExpression><![CDATA[$F{meta:user_label} + ":"]]></textFieldExpression>
+			</textField>
+			<textField>
+				<reportElement style="htmlStyle" x="123" y="89" width="392" height="20"/>
+				<textFieldExpression><![CDATA[$F{meta:user}]]></textFieldExpression>
+			</textField>
+			<textField>
+				<reportElement style="htmlStyle" x="0" y="109" width="123" height="20"/>
+				<textFieldExpression><![CDATA[$F{meta:date_label} + ":"]]></textFieldExpression>
+			</textField>
+			<textField>
+				<reportElement style="htmlStyle" x="123" y="109" width="392" height="20"/>
+				<textFieldExpression><![CDATA[$F{meta:date}]]></textFieldExpression>
+			</textField>
+			<textField>
+				<reportElement style="htmlStyle" x="0" y="129" width="123" height="20"/>
+				<textFieldExpression><![CDATA[$F{meta:river_label} + ":"]]></textFieldExpression>
+			</textField>
+			<textField>
+				<reportElement style="htmlStyle" x="123" y="129" width="392" height="20"/>
+				<textFieldExpression><![CDATA[$F{meta:river}]]></textFieldExpression>
+			</textField>
+			<textField>
+				<reportElement style="htmlStyle" x="0" y="149" width="123" height="20"/>
+				<textFieldExpression><![CDATA[$F{meta:range_label} + ":"]]></textFieldExpression>
+			</textField>
+			<textField>
+				<reportElement style="htmlStyle" x="123" y="149" width="392" height="20"/>
+				<textFieldExpression><![CDATA[$F{meta:range}]]></textFieldExpression>
+			</textField>
+		</band>
+	</title>
+	<columnHeader>
+		<band height="25" splitType="Stretch">
+			<line>
+				<reportElement style="htmlStyle" positionType="FixRelativeToBottom" x="0" y="24" width="550" height="1"/>
+			</line>
+			<textField isStretchWithOverflow="true">
+				<reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="60" 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="60" y="0" width="77" height="24"/>
+				<box padding="5"/>
+				<textElement textAlignment="Right" verticalAlignment="Bottom"/>
+				<textFieldExpression><![CDATA[$F{meta:fix_w}]]></textFieldExpression>
+			</textField>
+			<textField isStretchWithOverflow="true">
+				<reportElement key="delete" style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="137" y="-1" width="0" height="24"/>
+				<box padding="5"/>
+				<textElement textAlignment="Right" verticalAlignment="Bottom"/>
+				<textFieldExpression><![CDATA[$F{meta:w_at_gauge_header}]]></textFieldExpression>
+			</textField>
+			<textField isStretchWithOverflow="true">
+				<reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="137" y="0" width="70" height="24"/>
+				<box padding="5"/>
+				<textElement textAlignment="Right" verticalAlignment="Bottom"/>
+				<textFieldExpression><![CDATA[$F{meta:fix_q}]]></textFieldExpression>
+			</textField>
+			<textField isStretchWithOverflow="true">
+				<reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="207" y="0" width="83" height="24"/>
+				<box padding="5"/>
+				<textElement textAlignment="Right" verticalAlignment="Bottom"/>
+				<textFieldExpression><![CDATA[$F{meta:w_at_gauge_header_2}]]></textFieldExpression>
+			</textField>
+			<textField isStretchWithOverflow="true">
+				<reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="290" y="0" width="120" height="24"/>
+				<box padding="5"/>
+				<textElement textAlignment="Left" verticalAlignment="Bottom"/>
+				<textFieldExpression><![CDATA[$F{meta:location_header}]]></textFieldExpression>
+			</textField>
+			<textField isStretchWithOverflow="true">
+				<reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="410" y="0" width="140" height="24"/>
+				<box padding="5"/>
+				<textElement textAlignment="Left" verticalAlignment="Bottom"/>
+				<textFieldExpression><![CDATA[$F{meta:gauge_header}]]></textFieldExpression>
+			</textField>
+		</band>
+	</columnHeader>
+	<detail>
+		<band height="15" splitType="Prevent">
+			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
+				<reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="60" height="15"/>
+				<box topPadding="2" 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"/>
+				<textFieldExpression><![CDATA[$F{data:0}]]></textFieldExpression>
+			</textField>
+			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
+				<reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="60" y="0" width="77" height="15"/>
+				<box topPadding="2" 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"/>
+				<textFieldExpression><![CDATA[$F{data:1}]]></textFieldExpression>
+			</textField>
+			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
+				<reportElement key="delete" style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="137" y="-1" width="0" height="15"/>
+				<box topPadding="2" 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"/>
+				<textFieldExpression><![CDATA[$F{data:2}]]></textFieldExpression>
+			</textField>
+			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
+				<reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="137" y="0" width="70" height="15"/>
+				<box topPadding="2" 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"/>
+				<textFieldExpression><![CDATA[$F{data:3}]]></textFieldExpression>
+			</textField>
+			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
+				<reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="207" y="0" width="83" height="15"/>
+				<box topPadding="2" 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"/>
+				<textFieldExpression><![CDATA[$F{data:4}]]></textFieldExpression>
+			</textField>
+			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
+				<reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="290" y="0" width="120" height="15"/>
+				<box topPadding="2" 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" verticalAlignment="Top"/>
+				<textFieldExpression><![CDATA[$F{data:5}]]></textFieldExpression>
+			</textField>
+			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
+				<reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="410" y="0" width="140" height="15"/>
+				<box topPadding="2" 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" verticalAlignment="Top"/>
+				<textFieldExpression><![CDATA[$F{data:6}]]></textFieldExpression>
+			</textField>
+		</band>
+	</detail>
+	<pageFooter>
+		<band height="15" splitType="Stretch">
+			<textField isStretchWithOverflow="true">
+				<reportElement style="htmlStyle" x="437" y="0" width="55" height="15"/>
+				<box topPadding="2" rightPadding="3"/>
+				<textElement textAlignment="Right"/>
+				<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
+			</textField>
+			<textField isStretchWithOverflow="true" evaluationTime="Report">
+				<reportElement style="htmlStyle" x="493" y="0" width="57" height="15"/>
+				<box topPadding="2" leftPadding="0" bottomPadding="0" rightPadding="0"/>
+				<textFieldExpression><![CDATA["/ " + $V{PAGE_NUMBER}]]></textFieldExpression>
+			</textField>
+		</band>
+	</pageFooter>
+</jasperReport>
diff -r dd05a5eef210 -r ce13a2f07290 artifacts/doc/conf/jasper/waterlevel.jasper
Binary file artifacts/doc/conf/jasper/waterlevel.jasper has changed
diff -r dd05a5eef210 -r ce13a2f07290 artifacts/doc/conf/jasper/waterlevel.jrxml
--- a/artifacts/doc/conf/jasper/waterlevel.jrxml	Mon Sep 17 16:00:00 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,173 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<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="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"/>
-	<field name="river" class="java.lang.String"/>
-	<field name="gauge" class="java.lang.String"/>
-	<field name="km" class="java.lang.String"/>
-	<field name="W" class="java.lang.String"/>
-	<field name="date" class="java.lang.String"/>
-	<field name="Q" class="java.lang.String"/>
-	<field name="calculation" class="java.lang.String"/>
-	<field name="range" class="java.lang.String"/>
-	<field name="description" class="java.lang.String"/>
-	<field name="location" class="java.lang.String"/>
-	<field name="gaugename" class="java.lang.String"/>
-	<background>
-		<band splitType="Stretch"/>
-	</background>
-	<title>
-		<band height="162" splitType="Stretch">
-			<staticText>
-				<reportElement x="0" y="1" width="165" height="30"/>
-				<textElement>
-					<font size="18"/>
-				</textElement>
-				<text><![CDATA[Ergebnisausgabe]]></text>
-			</staticText>
-			<textField>
-				<reportElement x="165" y="0" width="350" height="31"/>
-				<textElement>
-					<font size="18"/>
-				</textElement>
-				<textFieldExpression><![CDATA[$F{river}]]></textFieldExpression>
-			</textField>
-			<textField>
-				<reportElement x="0" y="31" width="515" height="26"/>
-				<textElement>
-					<font size="14"/>
-				</textElement>
-				<textFieldExpression><![CDATA[$F{calculation}]]></textFieldExpression>
-			</textField>
-			<staticText>
-				<reportElement x="0" y="70" width="123" height="20"/>
-				<textElement/>
-				<text><![CDATA[Gewässer:]]></text>
-			</staticText>
-			<textField>
-				<reportElement x="123" y="70" width="392" height="20"/>
-				<textElement/>
-				<textFieldExpression><![CDATA[$F{river}]]></textFieldExpression>
-			</textField>
-			<staticText>
-				<reportElement x="0" y="90" width="123" height="20"/>
-				<textElement/>
-				<text><![CDATA[Bezugspegel:]]></text>
-			</staticText>
-			<textField>
-				<reportElement x="123" y="90" width="392" height="20"/>
-				<textElement/>
-				<textFieldExpression><![CDATA[$F{gauge}]]></textFieldExpression>
-			</textField>
-			<staticText>
-				<reportElement x="0" y="110" width="123" height="20"/>
-				<textElement/>
-				<text><![CDATA[Datum der Erstellung:]]></text>
-			</staticText>
-			<textField>
-				<reportElement x="123" y="110" width="392" height="20"/>
-				<textElement/>
-				<textFieldExpression><![CDATA[$F{date}]]></textFieldExpression>
-			</textField>
-			<staticText>
-				<reportElement x="0" y="130" width="123" height="20"/>
-				<textElement/>
-				<text><![CDATA[Ort/Bereich:]]></text>
-			</staticText>
-			<textField>
-				<reportElement x="123" y="130" width="392" height="20"/>
-				<textElement/>
-				<textFieldExpression><![CDATA[$F{range}]]></textFieldExpression>
-			</textField>
-		</band>
-	</title>
-	<columnHeader>
-		<band height="25" splitType="Stretch">
-			<line>
-				<reportElement x="0" y="19" width="515" height="1"/>
-			</line>
-			<staticText>
-				<reportElement x="0" y="0" width="60" height="20"/>
-				<textElement/>
-				<text><![CDATA[Fluss-Km]]></text>
-			</staticText>
-			<staticText>
-				<reportElement x="60" y="0" width="65" height="20"/>
-				<textElement/>
-				<text><![CDATA[W [NN + m]]]></text>
-			</staticText>
-			<staticText>
-				<reportElement x="125" y="0" width="65" height="20"/>
-				<textElement/>
-				<text><![CDATA[Q [m³/s]]]></text>
-			</staticText>
-			<staticText>
-				<reportElement x="190" y="0" width="85" height="20"/>
-				<textElement/>
-				<text><![CDATA[Bezeichnung]]></text>
-			</staticText>
-			<staticText>
-				<reportElement x="275" y="0" width="110" height="20"/>
-				<textElement/>
-				<text><![CDATA[Lage]]></text>
-			</staticText>
-			<staticText>
-				<reportElement x="385" y="0" width="130" height="20"/>
-				<textElement/>
-				<text><![CDATA[Bezugspegel]]></text>
-			</staticText>
-		</band>
-	</columnHeader>
-	<detail>
-		<band height="14" splitType="Stretch">
-			<textField isBlankWhenNull="true">
-				<reportElement x="0" y="0" width="60" height="14"/>
-				<textElement/>
-				<textFieldExpression><![CDATA[$F{km}]]></textFieldExpression>
-			</textField>
-			<textField isBlankWhenNull="true">
-				<reportElement x="60" y="0" width="65" height="14"/>
-				<textElement/>
-				<textFieldExpression><![CDATA[$F{W}]]></textFieldExpression>
-			</textField>
-			<textField isBlankWhenNull="true">
-				<reportElement x="125" y="0" width="65" height="14"/>
-				<textElement/>
-				<textFieldExpression><![CDATA[$F{Q}]]></textFieldExpression>
-			</textField>
-			<textField isStretchWithOverflow="true" isBlankWhenNull="false">
-				<reportElement stretchType="RelativeToBandHeight" x="190" y="0" width="85" height="14"/>
-				<textElement/>
-				<textFieldExpression><![CDATA[$F{description}]]></textFieldExpression>
-			</textField>
-			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
-				<reportElement stretchType="RelativeToBandHeight" x="275" y="0" width="110" height="14" isPrintWhenDetailOverflows="true"/>
-				<textElement/>
-				<textFieldExpression><![CDATA[$F{location}]]></textFieldExpression>
-			</textField>
-			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
-				<reportElement stretchType="RelativeToBandHeight" x="385" y="0" width="130" height="14"/>
-				<textElement/>
-				<textFieldExpression><![CDATA[$F{gaugename}]]></textFieldExpression>
-			</textField>
-		</band>
-	</detail>
-	<pageFooter>
-		<band height="29" splitType="Stretch">
-			<textField evaluationTime="Report">
-				<reportElement x="458" y="9" width="57" height="20"/>
-				<textElement/>
-				<textFieldExpression><![CDATA[" / " + $V{PAGE_NUMBER}]]></textFieldExpression>
-			</textField>
-			<textField>
-				<reportElement x="403" y="9" width="55" height="20"/>
-				<textElement textAlignment="Right"/>
-				<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
-			</textField>
-		</band>
-	</pageFooter>
-	<summary>
-		<band height="42" splitType="Stretch"/>
-	</summary>
-</jasperReport>
diff -r dd05a5eef210 -r ce13a2f07290 artifacts/doc/conf/jasper/waterlevel_en.jasper
Binary file artifacts/doc/conf/jasper/waterlevel_en.jasper has changed
diff -r dd05a5eef210 -r ce13a2f07290 artifacts/doc/conf/jasper/waterlevel_en.jrxml
--- a/artifacts/doc/conf/jasper/waterlevel_en.jrxml	Mon Sep 17 16:00:00 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,173 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<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="515" leftMargin="60" rightMargin="20" topMargin="20" bottomMargin="20">
-	<property name="ireport.zoom" value="1.5"/>
-	<property name="ireport.x" value="135"/>
-	<property name="ireport.y" value="0"/>
-	<field name="river" class="java.lang.String"/>
-	<field name="gauge" class="java.lang.String"/>
-	<field name="km" class="java.lang.String"/>
-	<field name="W" class="java.lang.String"/>
-	<field name="date" class="java.lang.String"/>
-	<field name="Q" class="java.lang.String"/>
-	<field name="calculation" class="java.lang.String"/>
-	<field name="range" class="java.lang.String"/>
-	<field name="description" class="java.lang.String"/>
-	<field name="location" class="java.lang.String"/>
-	<field name="gaugename" class="java.lang.String"/>
-	<background>
-		<band splitType="Stretch"/>
-	</background>
-	<title>
-		<band height="162" splitType="Stretch">
-			<staticText>
-				<reportElement x="0" y="1" width="177" height="30"/>
-				<textElement>
-					<font size="18"/>
-				</textElement>
-				<text><![CDATA[Calculation result]]></text>
-			</staticText>
-			<textField>
-				<reportElement x="177" y="0" width="338" height="31"/>
-				<textElement>
-					<font size="18"/>
-				</textElement>
-				<textFieldExpression><![CDATA[$F{river}]]></textFieldExpression>
-			</textField>
-			<textField>
-				<reportElement x="0" y="31" width="515" height="26"/>
-				<textElement>
-					<font size="14"/>
-				</textElement>
-				<textFieldExpression><![CDATA[$F{calculation}]]></textFieldExpression>
-			</textField>
-			<staticText>
-				<reportElement x="0" y="70" width="123" height="20"/>
-				<textElement/>
-				<text><![CDATA[River:]]></text>
-			</staticText>
-			<textField>
-				<reportElement x="123" y="70" width="392" height="20"/>
-				<textElement/>
-				<textFieldExpression><![CDATA[$F{river}]]></textFieldExpression>
-			</textField>
-			<staticText>
-				<reportElement x="0" y="90" width="123" height="20"/>
-				<textElement/>
-				<text><![CDATA[Reference Gauge:]]></text>
-			</staticText>
-			<textField>
-				<reportElement x="123" y="90" width="392" height="20"/>
-				<textElement/>
-				<textFieldExpression><![CDATA[$F{gauge}]]></textFieldExpression>
-			</textField>
-			<staticText>
-				<reportElement x="0" y="110" width="123" height="20"/>
-				<textElement/>
-				<text><![CDATA[Date of creation:]]></text>
-			</staticText>
-			<textField>
-				<reportElement x="123" y="110" width="392" height="20"/>
-				<textElement/>
-				<textFieldExpression><![CDATA[$F{date}]]></textFieldExpression>
-			</textField>
-			<staticText>
-				<reportElement x="0" y="130" width="123" height="20"/>
-				<textElement/>
-				<text><![CDATA[Location/Distance:]]></text>
-			</staticText>
-			<textField>
-				<reportElement x="123" y="130" width="392" height="20"/>
-				<textElement/>
-				<textFieldExpression><![CDATA[$F{range}]]></textFieldExpression>
-			</textField>
-		</band>
-	</title>
-	<columnHeader>
-		<band height="25" splitType="Stretch">
-			<line>
-				<reportElement x="0" y="19" width="515" height="1"/>
-			</line>
-			<staticText>
-				<reportElement x="0" y="0" width="62" height="20"/>
-				<textElement/>
-				<text><![CDATA[River-Km]]></text>
-			</staticText>
-			<staticText>
-				<reportElement x="205" y="0" width="76" height="20"/>
-				<textElement/>
-				<text><![CDATA[Description]]></text>
-			</staticText>
-			<staticText>
-				<reportElement x="281" y="0" width="113" height="20"/>
-				<textElement/>
-				<text><![CDATA[Location]]></text>
-			</staticText>
-			<staticText>
-				<reportElement x="62" y="0" width="67" height="20"/>
-				<textElement/>
-				<text><![CDATA[W [NN + m]]]></text>
-			</staticText>
-			<staticText>
-				<reportElement x="129" y="0" width="76" height="20"/>
-				<textElement/>
-				<text><![CDATA[Q [m³/s]]]></text>
-			</staticText>
-			<staticText>
-				<reportElement x="394" y="0" width="121" height="20"/>
-				<textElement/>
-				<text><![CDATA[Reference Gauge]]></text>
-			</staticText>
-		</band>
-	</columnHeader>
-	<detail>
-		<band height="14" splitType="Stretch">
-			<textField isBlankWhenNull="true">
-				<reportElement x="0" y="0" width="62" height="14"/>
-				<textElement/>
-				<textFieldExpression><![CDATA[$F{km}]]></textFieldExpression>
-			</textField>
-			<textField isStretchWithOverflow="true" isBlankWhenNull="false">
-				<reportElement stretchType="RelativeToBandHeight" x="205" y="0" width="76" height="14"/>
-				<textElement/>
-				<textFieldExpression><![CDATA[$F{description}]]></textFieldExpression>
-			</textField>
-			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
-				<reportElement stretchType="RelativeToBandHeight" x="281" y="0" width="113" height="14" isPrintWhenDetailOverflows="true"/>
-				<textElement/>
-				<textFieldExpression><![CDATA[$F{location}]]></textFieldExpression>
-			</textField>
-			<textField isBlankWhenNull="true">
-				<reportElement x="62" y="0" width="67" height="14"/>
-				<textElement/>
-				<textFieldExpression><![CDATA[$F{W}]]></textFieldExpression>
-			</textField>
-			<textField isBlankWhenNull="true">
-				<reportElement x="129" y="0" width="76" height="14"/>
-				<textElement/>
-				<textFieldExpression><![CDATA[$F{Q}]]></textFieldExpression>
-			</textField>
-			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
-				<reportElement stretchType="RelativeToBandHeight" x="394" y="0" width="121" height="14"/>
-				<textElement/>
-				<textFieldExpression><![CDATA[$F{gaugename}]]></textFieldExpression>
-			</textField>
-		</band>
-	</detail>
-	<pageFooter>
-		<band height="29" splitType="Stretch">
-			<textField evaluationTime="Report">
-				<reportElement x="458" y="9" width="57" height="20"/>
-				<textElement/>
-				<textFieldExpression><![CDATA[" / " + $V{PAGE_NUMBER}]]></textFieldExpression>
-			</textField>
-			<textField>
-				<reportElement x="403" y="9" width="55" height="20"/>
-				<textElement textAlignment="Right"/>
-				<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
-			</textField>
-		</band>
-	</pageFooter>
-	<summary>
-		<band height="42" splitType="Stretch"/>
-	</summary>
-</jasperReport>
diff -r dd05a5eef210 -r ce13a2f07290 artifacts/src/main/java/org/dive4elements/river/artifacts/AbstractFixBunduArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/AbstractFixBunduArtifact.java	Mon Sep 17 16:00:00 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/AbstractFixBunduArtifact.java	Mon Sep 17 19:07:57 2018 +0200
@@ -56,4 +56,9 @@
 
         return wAtKm;
     }
+
+    public String getCalculationModeString() {
+        return null; // must be implemented in inheriting classes. cannot declare this class abstract
+    }
+
 }
\ No newline at end of file
diff -r dd05a5eef210 -r ce13a2f07290 artifacts/src/main/java/org/dive4elements/river/artifacts/FixationArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/FixationArtifact.java	Mon Sep 17 16:00:00 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/FixationArtifact.java	Mon Sep 17 19:07:57 2018 +0200
@@ -44,4 +44,9 @@
         return ARTIFACT_NAME;
     }
 
+    @Override
+    public String getCalculationModeString() {
+        return super.getDataAsString("calculation.mode");
+    }
+
 }
\ No newline at end of file
diff -r dd05a5eef210 -r ce13a2f07290 artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/BUNDUArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/BUNDUArtifact.java	Mon Sep 17 16:00:00 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/BUNDUArtifact.java	Mon Sep 17 19:07:57 2018 +0200
@@ -80,7 +80,11 @@
         return ARTIFACT_NAME;
     }
 
-    public BunduCalcMode getCalculationMode() {
+    protected String getCalculationModeStr() {
+        return String.valueOf(getCalculationMode());
+    }
+
+    BunduCalcMode getCalculationMode() {
 
         final String calc = getDataAsString(FIELD_MODE);
         if (calc == null) {
@@ -99,4 +103,9 @@
         return getDataAsString(FIELD_RIVER);
     }
 
+    @Override
+    public String getCalculationModeString() {
+        return String.valueOf(getCalculationMode());
+    }
+
 }
\ No newline at end of file
diff -r dd05a5eef210 -r ce13a2f07290 artifacts/src/main/java/org/dive4elements/river/exports/FixWaterlevelExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/FixWaterlevelExporter.java	Mon Sep 17 16:00:00 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/FixWaterlevelExporter.java	Mon Sep 17 19:07:57 2018 +0200
@@ -8,34 +8,14 @@
 
 package org.dive4elements.river.exports;
 
-import java.io.OutputStream;
 import java.text.NumberFormat;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
 
 import org.apache.log4j.Logger;
 import org.dive4elements.river.artifacts.D4EArtifact;
-import org.dive4elements.river.artifacts.access.RangeAccess;
-import org.dive4elements.river.artifacts.common.DefaultCalculationResults;
-import org.dive4elements.river.artifacts.common.ExportContextPDF;
-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.model.ConstantWQKms;
-import org.dive4elements.river.artifacts.model.DischargeTables;
-import org.dive4elements.river.artifacts.model.WQKms;
-import org.dive4elements.river.artifacts.sinfo.util.CalculationUtils;
-import org.dive4elements.river.artifacts.sinfo.util.RiverInfo;
-import org.dive4elements.river.model.DischargeTable;
 import org.dive4elements.river.model.Gauge;
-import org.dive4elements.river.utils.Formatter;
 import org.dive4elements.river.utils.RiverUtils;
-import org.dive4elements.river.utils.RiverUtils.WQ_MODE;
 
 import au.com.bytecode.opencsv.CSVWriter;
-import net.sf.jasperreports.engine.JRException;
 
 /**
  * Generates different output formats (wst, csv, pdf) of data that resulted from
@@ -48,8 +28,6 @@
     /** The log used in this exporter. */
     private static Logger log = Logger.getLogger(FixWaterlevelExporter.class);
 
-    private final Map<String, Double> gaugeQ_W_Map = new HashMap<>();
-
     @Override
     protected void writeRow4(final CSVWriter writer, final double wqkm[], final D4EArtifact flys, final Gauge gauge, final boolean isQ) {
         if (!isQ) {
@@ -84,34 +62,6 @@
         }
     }
 
-    private String getWaterlevel(final double discharge, final Gauge gauge) {
-        final NumberFormat formatter = Formatter.getWaterlevelW(this.context);
-        final Double waterlevel = this.getWforGaugeAndQ(gauge, discharge);
-        if (waterlevel != null)
-            return formatter.format(waterlevel);
-        return "";
-    }
-
-    private Double getWforGaugeAndQ(final Gauge gauge, final double q) {
-
-        final String key = gauge.getName() + String.valueOf(q);
-        if (!this.gaugeQ_W_Map.containsKey(key)) {
-
-            final DischargeTable dt = gauge.fetchMasterDischargeTable();
-            final double[][] table = DischargeTables.loadDischargeTableValues(dt);
-
-            final double[] qs = DischargeTables.getWsForQ(table, q);
-
-            // final DischargeTables dct = new DischargeTables(gauge.getRiver().getName(), gauge.getName());
-            // final double[] qs = DischargeTables.getWsForQ(dct.getFirstTable(), q); // TODO: KLÄREN, welche Abflusstabelle
-            // genommen werden soll!
-            if (qs != null && qs.length > 0) {
-                this.gaugeQ_W_Map.put(key, qs[0]);
-            }
-        }
-        return this.gaugeQ_W_Map.get(key);
-    }
-
     /**
      * Write the header, with different headings depending on whether at a
      * gauge or at a location.
@@ -142,145 +92,4 @@
         }
     }
 
-    @Override
-    protected void writePDF(final OutputStream out) {
-
-        log.debug("write PDF");
-
-        if (!isQ()) {
-            super.writePDF(out);
-        } else {
-
-            final MetaAndTableJRDataSource source = new MetaAndTableJRDataSource();
-            final String jasperFile = "/jasper/templates/fix_waterlevel.jrxml"; // "/jasper/fix_waterlevel_en.jasper");
-
-            addMetaData(source);
-            try {
-                final List<String[]> sorted = getRows(); // Custom Result could be nice, too...
-                for (final String[] list : sorted) {
-                    source.addData(list);
-                }
-
-                final JasperReporter reporter = new JasperReporter();
-                reporter.addReport(jasperFile, source);
-                reporter.exportPDF(out);
-            }
-            catch (final JRException je) {
-                log.warn("Error generating PDF Report!", je);
-            }
-        }
-    }
-
-    private void addMetaData(final MetaAndTableJRDataSource source) {
-        final D4EArtifact flys = (D4EArtifact) this.master;
-        final String user = CalculationUtils.findArtifactUser(this.context, flys);
-        final RangeAccess ra = new RangeAccess(flys);
-        final RiverInfo ri = new RiverInfo(ra.getRiver());
-
-        final DefaultCalculationResults results = new DefaultCalculationResults(msg("calculation.analysis"), user, ri, ra.getRange());
-        final ExportContextPDF contextPdf = new ExportContextPDF(this.context, results);
-        contextPdf.addJRMetaDataDefaults(source);
-        contextPdf.addJRMetaDataForModules(source);
-
-        /* column headings */
-        contextPdf.addJRMetadata(source, "station_header", GeneralResultType.station);
-        contextPdf.addJRMetadata(source, "fix_w", msg(CSV_W_HEADER, DEFAULT_CSV_W_HEADER, new Object[] { ri.getWstUnit() }));
-        contextPdf.addJRMetadata(source, "w_at_gauge_header", msg("fix.export.csv.w_at_gauge"));
-        contextPdf.addJRMetadata(source, "fix_q", msg(CSV_Q_HEADER));
-        contextPdf.addJRMetadata(source, "waterlevel_name_header", msg("common.export.csv.header.mainvalue_label"));
-        contextPdf.addJRMetadata(source, "location_header", msg("common.export.csv.header.location"));
-        contextPdf.addJRMetadata(source, "gauge_header", msg("common.export.csv.header.gauge"));
-
-    }
-
-    private List<String[]> getRows() {
-        final List<String[]> list = new ArrayList<>();
-        final WQ_MODE mode = RiverUtils.getWQMode((D4EArtifact) this.master);
-        final boolean atGauge = mode == WQ_MODE.QGAUGE || mode == WQ_MODE.WGAUGE;
-        final boolean isQ = mode == WQ_MODE.QGAUGE || mode == WQ_MODE.QFREE;
-
-        Double first = Double.NaN;
-        Double last = Double.NaN;
-
-        for (final WQKms[] tmp : this.data) {
-            for (final WQKms wqkms : tmp) {
-                list.addAll(getRows2(wqkms, atGauge, isQ));
-                final double[] firstLast = wqkms.getFirstLastKM();
-                if (first.isNaN()) {
-                    /* Initialize */
-                    first = firstLast[0];
-                    last = firstLast[1];
-                }
-                if (firstLast[0] > firstLast[1]) {
-                    /*
-                     * Calculating upstream we assert that it is
-                     * impossible that the direction changes during this
-                     * loop
-                     */
-                    first = Math.max(first, firstLast[0]);
-                    last = Math.min(last, firstLast[1]);
-                } else if (firstLast[0] < firstLast[1]) {
-                    first = Math.min(first, firstLast[0]);
-                    last = Math.max(last, firstLast[1]);
-                } else {
-                    first = last = firstLast[0];
-                }
-            }
-        }
-
-        /* Append the official fixing at the bottom */
-        for (final WQKms wqkms : this.officalFixings) {
-            list.addAll(getRows2(filterWQKms(wqkms, first, last), atGauge, isQ));
-        }
-        return list;
-    }
-
-    private List<String[]> getRows2(final WQKms wqkms, final boolean atGauge, final boolean isQ) {
-        log.debug("WaterlevelExporter.addWKmsData"); // OLD CODE :-/
-
-        final List<String[]> list = new ArrayList<>();
-        // Skip constant data.
-        if (wqkms instanceof ConstantWQKms) {
-            return null;
-        }
-
-        final NumberFormat kmf = getKmFormatter();
-        final NumberFormat wf = getWFormatter();
-        final NumberFormat qf = getQFormatter();
-
-        final int size = wqkms.size();
-        double[] result = new double[3];
-
-        final D4EArtifact flys = (D4EArtifact) this.master;
-        final RangeAccess rangeAccess = new RangeAccess(flys);
-
-        final Gauge gauge = rangeAccess.getRiver().determineRefGauge(rangeAccess.getKmRange(), rangeAccess.isRange());
-
-        final String gaugeName = gauge.getName();
-        String desc = "";
-        final String notinrange = msg(CSV_NOT_IN_GAUGE_RANGE, DEFAULT_CSV_NOT_IN_GAUGE_RANGE);
-
-        final double a = gauge.getRange().getA().doubleValue();
-        final double b = gauge.getRange().getB().doubleValue();
-
-        desc = getDesc(wqkms, isQ);
-        final long startTime = System.currentTimeMillis();
-
-        for (int i = 0; i < size; i++) {
-            result = wqkms.get(i, result);
-            final double q = result[1];
-            final String waterlevel = this.getWaterlevel(q, gauge); // THIS IS NEW (and makes common super method
-                                                                    // difficult)
-            if (atGauge) {
-                list.add(new String[] { kmf.format(result[2]), wf.format(result[0]), waterlevel, qf.format(RiverUtils.roundQ(result[1])), desc,
-                        RiverUtils.getLocationDescription(flys, result[2]), result[2] >= a && result[2] <= b ? gaugeName : notinrange });
-            } else {
-                list.add(new String[] { kmf.format(result[2]), wf.format(result[0]), waterlevel, qf.format(RiverUtils.roundQ(result[1])), desc,
-                        RiverUtils.getLocationDescription(flys, result[2]), result[2] >= a && result[2] <= b ? gaugeName : notinrange });
-            }
-
-        }
-
-        return list;
-    }
 }
\ No newline at end of file
diff -r dd05a5eef210 -r ce13a2f07290 artifacts/src/main/java/org/dive4elements/river/exports/WaterlevelExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/WaterlevelExporter.java	Mon Sep 17 16:00:00 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/WaterlevelExporter.java	Mon Sep 17 19:07:57 2018 +0200
@@ -24,7 +24,6 @@
 import org.apache.log4j.Logger;
 import org.dive4elements.artifacts.Artifact;
 import org.dive4elements.artifacts.CallMeta;
-import org.dive4elements.artifacts.common.utils.Config;
 import org.dive4elements.river.artifacts.AbstractFixBunduArtifact;
 import org.dive4elements.river.artifacts.D4EArtifact;
 import org.dive4elements.river.artifacts.StaticWQKmsArtifact;
@@ -32,8 +31,15 @@
 import org.dive4elements.river.artifacts.access.FixRealizingAccess;
 import org.dive4elements.river.artifacts.access.IsOfficialAccess;
 import org.dive4elements.river.artifacts.access.RangeAccess;
+import org.dive4elements.river.artifacts.common.DefaultCalculationResults;
+import org.dive4elements.river.artifacts.common.ExportContextPDF;
+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.model.CalculationResult;
 import org.dive4elements.river.artifacts.model.ConstantWQKms;
+import org.dive4elements.river.artifacts.model.DischargeTables;
 import org.dive4elements.river.artifacts.model.Segment;
 import org.dive4elements.river.artifacts.model.WKmsJRDataSource;
 import org.dive4elements.river.artifacts.model.WQCKms;
@@ -41,6 +47,9 @@
 import org.dive4elements.river.artifacts.model.WQKmsResult;
 import org.dive4elements.river.artifacts.model.WstLine;
 import org.dive4elements.river.artifacts.resources.Resources;
+import org.dive4elements.river.artifacts.sinfo.util.CalculationUtils;
+import org.dive4elements.river.artifacts.sinfo.util.RiverInfo;
+import org.dive4elements.river.model.DischargeTable;
 import org.dive4elements.river.model.Gauge;
 import org.dive4elements.river.utils.Formatter;
 import org.dive4elements.river.utils.RiverUtils;
@@ -49,9 +58,6 @@
 import au.com.bytecode.opencsv.CSVWriter;
 import gnu.trove.TDoubleArrayList;
 import net.sf.jasperreports.engine.JRException;
-import net.sf.jasperreports.engine.JasperExportManager;
-import net.sf.jasperreports.engine.JasperFillManager;
-import net.sf.jasperreports.engine.JasperPrint;
 
 /**
  * Generates different output formats (wst, csv, pdf) of data that resulted from
@@ -129,7 +135,6 @@
     public static final String DEFAULT_CSV_NOT_IN_GAUGE_RANGE = "außerhalb des gewählten Bezugspegels";
 
     protected static final String PDF_HEADER_MODE = "export.waterlevel.pdf.mode";
-    private static final String JASPER_FILE = "export.waterlevel.pdf.file";
 
     /** The storage that contains all WQKms objects that are calculated. */
     public List<WQKms[]> data;
@@ -137,6 +142,8 @@
     /** The storage that contains official fixings if available. */
     public List<WQKms> officalFixings;
 
+    private final Map<String, Double> gaugeQ_W_Map = new HashMap<>();
+
     public WaterlevelExporter() {
         this.data = new ArrayList<>();
     }
@@ -308,7 +315,7 @@
         }
     }
 
-    protected final boolean isQ() {
+    private final boolean isQ() {
         final WQ_MODE mode = RiverUtils.getWQMode((D4EArtifact) this.master);
         return mode == WQ_MODE.QGAUGE || mode == WQ_MODE.QFREE;
     }
@@ -571,6 +578,16 @@
         return colDesc == null ? "" : colDesc;
     }
 
+    private List<Segment> getSegments(final D4EArtifact flys) {
+        if (flys instanceof AbstractFixBunduArtifact) {
+            // Get W/Q input per gauge for this case.
+            final FixRealizingAccess fixAccess = new FixRealizingAccess(flys);
+            return fixAccess.getSegments();
+
+        }
+        return null;
+    }
+
     /**
      * Write "rows" of csv data from wqkms with writer.
      */
@@ -596,8 +613,6 @@
                                                   // (it seems to)
         String desc = "";
         final String notinrange = msg(CSV_NOT_IN_GAUGE_RANGE, DEFAULT_CSV_NOT_IN_GAUGE_RANGE);
-        List<Segment> segments = null;
-        boolean isFixRealize = false;
 
         final double a = gauge.getRange().getA().doubleValue();
         final double b = gauge.getRange().getB().doubleValue();
@@ -605,15 +620,11 @@
 
         desc = getDesc(wqkms, isQ);
 
-        if (flys instanceof AbstractFixBunduArtifact) {
-            // Get W/Q input per gauge for this case.
-            final FixRealizingAccess fixAccess = new FixRealizingAccess(flys);
-            segments = fixAccess.getSegments();
-            if (segments != null && !segments.isEmpty()) {
-                isFixRealize = true;
-            }
+        boolean isFixRealize = false;
+        final List<Segment> segments = getSegments(flys);
+        if (segments != null && !segments.isEmpty()) {
+            isFixRealize = true;
         }
-
         if (atGauge) { // "At gauge" needs more output.
 
             // Kms tend to be close together so caching the last sector
@@ -757,27 +768,176 @@
         }
     }
 
-    public void doWritePdf(final WKmsJRDataSource source, final String jasperFile) {
+    @Override
+    protected void writePDF(final OutputStream out) {
+        log.debug("write PDF");
 
-        final String confPath = Config.getConfigDirectory().toString();
+        final boolean isQ = isQ();
+        final MetaAndTableJRDataSource source = new MetaAndTableJRDataSource();
+        final String jasperFile = !isQ ? "/jasper/templates/waterlevel_new.jrxml" : "/jasper/templates/fix_waterlevel.jrxml";
 
-        final Map parameters = new HashMap();
-        parameters.put("ReportTitle", "Exported Data");
+        ((D4EArtifact) this.master).getData("calculation.mode");
+        if ((this.master instanceof WINFOArtifact)) {
+            addMetaData(source, "calc.surface.curve"); // Wasserspiegellage
+        } else if
+
+        (this.master instanceof AbstractFixBunduArtifact) {
+            addMetaData(source, ((AbstractFixBunduArtifact) this.master).getCalculationModeString());// "calculation.vollmer"); // ausgelagerte
+                                                                                                     // Wasserspiegellage
+            // else
+            // addMetaData(source, "calculation.analysis"); // Fixierungsanalyse
+        }
+
         try {
-            final JasperPrint print = JasperFillManager.fillReport(confPath + jasperFile, parameters, source);
-            JasperExportManager.exportReportToPdfStream(print, this.out);
+            final List<String[]> sorted = getRows(); // Custom Result could be nice, too...
+            for (final String[] list : sorted) {
+                source.addData(list);
+            }
+
+            final JasperReporter reporter = new JasperReporter();
+
+            final JasperDesigner d = reporter.addReport(jasperFile, source);
+            d.removeColumn("delete"); // I don't want to mess with getRows(), so I prefer deleting the unwanted row directly in the report.
+
+            reporter.exportPDF(this.out);
         }
         catch (final JRException je) {
             log.warn("Error generating PDF Report!", je);
         }
+
     }
 
-    @Override
-    protected void writePDF(final OutputStream out) {
-        log.debug("write PDF");
-        final WKmsJRDataSource source = createJRData();
-        final String jasperFile = Resources.getMsg(this.context.getMeta(), JASPER_FILE, "/jasper/waterlevel_en.jasper");
-        doWritePdf(source, jasperFile);
+    private List<String[]> getRows() {
+        final List<String[]> list = new ArrayList<>();
+        final WQ_MODE mode = RiverUtils.getWQMode((D4EArtifact) this.master);
+        final boolean atGauge = mode == WQ_MODE.QGAUGE || mode == WQ_MODE.WGAUGE;
+        final boolean isQ = mode == WQ_MODE.QGAUGE || mode == WQ_MODE.QFREE;
+
+        Double first = Double.NaN;
+        Double last = Double.NaN;
+
+        for (final WQKms[] tmp : this.data) {
+            for (final WQKms wqkms : tmp) {
+                list.addAll(getRows2(wqkms, atGauge, isQ));
+                final double[] firstLast = wqkms.getFirstLastKM();
+                if (first.isNaN()) {
+                    /* Initialize */
+                    first = firstLast[0];
+                    last = firstLast[1];
+                }
+                if (firstLast[0] > firstLast[1]) {
+                    /*
+                     * Calculating upstream we assert that it is
+                     * impossible that the direction changes during this
+                     * loop
+                     */
+                    first = Math.max(first, firstLast[0]);
+                    last = Math.min(last, firstLast[1]);
+                } else if (firstLast[0] < firstLast[1]) {
+                    first = Math.min(first, firstLast[0]);
+                    last = Math.max(last, firstLast[1]);
+                } else {
+                    first = last = firstLast[0];
+                }
+            }
+        }
+
+        /* Append the official fixing at the bottom */
+        for (final WQKms wqkms : this.officalFixings) {
+            list.addAll(getRows2(filterWQKms(wqkms, first, last), atGauge, isQ));
+        }
+        return list;
+    }
+
+    private List<String[]> getRows2(final WQKms wqkms, final boolean atGauge, final boolean isQ) {
+        log.debug("WaterlevelExporter.addWKmsData"); // OLD CODE :-/
+
+        final List<String[]> list = new ArrayList<>();
+        // Skip constant data.
+        if (wqkms instanceof ConstantWQKms) {
+            return null;
+        }
+
+        final NumberFormat kmf = getKmFormatter();
+        final NumberFormat wf = getWFormatter();
+        final NumberFormat qf = getQFormatter();
+
+        final int size = wqkms.size();
+        double[] result = new double[3];
+
+        final D4EArtifact flys = (D4EArtifact) this.master;
+        final RangeAccess rangeAccess = new RangeAccess(flys);
+
+        final Gauge gauge = rangeAccess.getRiver().determineRefGauge(rangeAccess.getKmRange(), rangeAccess.isRange());
+
+        final String gaugeName = gauge.getName();
+        String desc = "";
+        final String notinrange = msg(CSV_NOT_IN_GAUGE_RANGE, DEFAULT_CSV_NOT_IN_GAUGE_RANGE);
+
+        final double a = gauge.getRange().getA().doubleValue();
+        final double b = gauge.getRange().getB().doubleValue();
+        final WaterlevelDescriptionBuilder wldb = new WaterlevelDescriptionBuilder(flys, this.context);
+
+        desc = wldb.getDesc(wqkms);// class getDesc(wqkms, isQ);
+
+        Segment lastSegment = null;
+        final Gauge lastGauge = null;
+        final List<Segment> segments = getSegments(flys);
+
+        final NumberFormat nf = Formatter.getFormatter(this.context.getMeta(), 0, 0);
+
+        for (int i = 0; i < size; ++i) {
+            result = wqkms.get(i, result);
+            final double km = result[2];
+
+            if (segments != null) {
+                final Segment found = lastSegment != null && lastSegment.inside(km) ? lastSegment : findSegment(km, segments);
+
+                if (found != null) {
+                    desc = nf.format(found.getValues()[0]);
+                }
+                lastSegment = found;
+            }
+
+            final double q = result[1];
+            final String waterlevel = this.getWaterlevel(q, gauge); // THIS IS NEW (and makes common super method
+                                                                    // difficult)
+            if (atGauge) {
+                list.add(new String[] { kmf.format(result[2]), wf.format(result[0]), waterlevel, qf.format(RiverUtils.roundQ(result[1])), desc,
+                        RiverUtils.getLocationDescription(flys, result[2]), result[2] >= a && result[2] <= b ? gaugeName : notinrange });
+            } else {
+                list.add(new String[] { kmf.format(result[2]), wf.format(result[0]), waterlevel, qf.format(RiverUtils.roundQ(result[1])), desc,
+                        RiverUtils.getLocationDescription(flys, result[2]), result[2] >= a && result[2] <= b ? gaugeName : notinrange });
+            }
+
+        }
+
+        return list;
+    }
+
+    protected final void addMetaData(final MetaAndTableJRDataSource source, final String calculation) {
+        final D4EArtifact flys = (D4EArtifact) this.master;
+        final String user = CalculationUtils.findArtifactUser(this.context, flys);
+        final RangeAccess ra = new RangeAccess(flys);
+        final RiverInfo ri = new RiverInfo(ra.getRiver());
+
+        final DefaultCalculationResults results = new DefaultCalculationResults(msg(calculation), user, ri, ra.getRange());
+        final ExportContextPDF contextPdf = new ExportContextPDF(this.context, results);
+        contextPdf.addJRMetaDataDefaults(source);
+        contextPdf.addJRMetaDataForModules(source);
+
+        /* column headings */
+        contextPdf.addJRMetadata(source, "station_header", GeneralResultType.station);
+        contextPdf.addJRMetadata(source, "fix_w", msg(CSV_W_HEADER, DEFAULT_CSV_W_HEADER, new Object[] { ri.getWstUnit() }));
+        contextPdf.addJRMetadata(source, "w_at_gauge_header", msg("fix.export.csv.w_at_gauge"));
+        contextPdf.addJRMetadata(source, "fix_q", msg(CSV_Q_HEADER));
+        contextPdf.addJRMetadata(source, "waterlevel_name_header", msg("common.export.csv.header.mainvalue_label"));
+        contextPdf.addJRMetadata(source, "location_header", msg("common.export.csv.header.location"));
+
+        contextPdf.addJRMetadata(source, "w_at_gauge_header_2", msg("export.waterlevel.csv.header.w.desc"));
+
+        contextPdf.addJRMetadata(source, "location_header", msg("common.export.csv.header.location"));
+        contextPdf.addJRMetadata(source, "gauge_header", msg("common.export.csv.header.gauge"));
 
     }
 
@@ -901,5 +1061,33 @@
         }
     }
 
+    protected final String getWaterlevel(final double discharge, final Gauge gauge) {
+        final NumberFormat formatter = Formatter.getWaterlevelW(this.context);
+        final Double waterlevel = this.getWforGaugeAndQ(gauge, discharge);
+        if (waterlevel != null)
+            return formatter.format(waterlevel);
+        return "";
+    }
+
+    private Double getWforGaugeAndQ(final Gauge gauge, final double q) {
+
+        final String key = gauge.getName() + String.valueOf(q);
+        if (!this.gaugeQ_W_Map.containsKey(key)) {
+
+            final DischargeTable dt = gauge.fetchMasterDischargeTable();
+            final double[][] table = DischargeTables.loadDischargeTableValues(dt);
+
+            final double[] qs = DischargeTables.getWsForQ(table, q);
+
+            // final DischargeTables dct = new DischargeTables(gauge.getRiver().getName(), gauge.getName());
+            // final double[] qs = DischargeTables.getWsForQ(dct.getFirstTable(), q); // TODO: KLÄREN, welche Abflusstabelle
+            // genommen werden soll!
+            if (qs != null && qs.length > 0) {
+                this.gaugeQ_W_Map.put(key, qs[0]);
+            }
+        }
+        return this.gaugeQ_W_Map.get(key);
+    }
+
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
diff -r dd05a5eef210 -r ce13a2f07290 artifacts/src/main/resources/messages.properties
--- a/artifacts/src/main/resources/messages.properties	Mon Sep 17 16:00:00 2018 +0200
+++ b/artifacts/src/main/resources/messages.properties	Mon Sep 17 19:07:57 2018 +0200
@@ -443,7 +443,6 @@
 export.reference_curve.pdf.mode = Reference Curve
 export.computed.discharge.pdf.file = /jasper/computed-discharge_en.jasper
 export.duration.pdf.file = /jasper/duration_en.jasper
-export.waterlevel.pdf.file = /jasper/waterlevel_en.jasper
 export.wdifferences.pdf.file = /jasper/wdifferences_en.jasper
 export.historical.discharge.pdf.file = /jasper/historical-discharge_en.jasper
 export.reference_curve.pdf.file = /jasper/reference_en.jasper
@@ -681,6 +680,7 @@
 fix.mhq=around MHQ
 fix.hq5=over HQ5
 fix.export.csv.w_at_gauge = W at Gauge [cm]
+export.waterlevel.csv.header.w.desc =  W/Gauge [cm]
 
 chart.fix.deltawt.title=Difference from compensating curve at kilometer {0}
 chart.fix.deltawt.subtitle=Water: {0}; Period:  {1,date,short} to {2,date,short}; Reference period: {3,date,short} to {4,date,short}
diff -r dd05a5eef210 -r ce13a2f07290 artifacts/src/main/resources/messages_de.properties
--- a/artifacts/src/main/resources/messages_de.properties	Mon Sep 17 16:00:00 2018 +0200
+++ b/artifacts/src/main/resources/messages_de.properties	Mon Sep 17 19:07:57 2018 +0200
@@ -443,7 +443,6 @@
 export.reference_curve.pdf.mode = Bezugslinie
 export.computed.discharge.pdf.file = /jasper/computed-discharge.jasper
 export.duration.pdf.file = /jasper/duration.jasper
-export.waterlevel.pdf.file = /jasper/waterlevel.jasper
 export.wdifferences.pdf.file = /jasper/wdifferences.jasper
 export.historical.discharge.pdf.file = /jasper/historical-discharge.jasper
 export.reference_curve.pdf.file = /jasper/reference.jasper
@@ -681,6 +680,7 @@
 fix.mhq=um MHQ
 fix.hq5=um HQ5
 fix.export.csv.w_at_gauge = W am Pegel [cm]
+export.waterlevel.csv.header.w.desc = W/Pegel [cm]
 
 chart.fix.deltawt.title=Abweichungen von der Ausgleichskurve an Kilometer {0}
 chart.fix.deltawt.subtitle=Gew\u00e4sser: {0}; Darstellungszeitraum: {1,date,short} bis {2,date,short}; Bezugszeitraum: {3,date,short} bis {4,date,short}


More information about the Dive4Elements-commits mailing list