[PATCH] (issue1754) Add range to W / Bed difference export

Wald Commits scm-commit at wald.intevation.org
Mon Mar 16 17:38:13 CET 2015


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1426523888 -3600
# Node ID ce325339e9ba569fe61e52b1d00c71b9b7cf0b8a
# Parent  138feb491c8aa2a245979b06f00777ec6f9c258c
(issue1754) Add range to W / Bed difference export.

    This also fixes the Title layout in waterlevel report and
    removes the year/epoch field from the english beddifference report.

diff -r 138feb491c8a -r ce325339e9ba artifacts/doc/conf/jasper/beddifference.jasper
Binary file artifacts/doc/conf/jasper/beddifference.jasper has changed
diff -r 138feb491c8a -r ce325339e9ba artifacts/doc/conf/jasper/beddifference.jrxml
--- a/artifacts/doc/conf/jasper/beddifference.jrxml	Mon Mar 16 17:08:04 2015 +0100
+++ b/artifacts/doc/conf/jasper/beddifference.jrxml	Mon Mar 16 17:38:08 2015 +0100
@@ -21,11 +21,12 @@
 	<field name="gap1" class="java.lang.String"/>
 	<field name="gap2header" class="java.lang.String"/>
 	<field name="gap2" class="java.lang.String"/>
+	<field name="range" class="java.lang.String"/>
 	<background>
 		<band splitType="Stretch"/>
 	</background>
 	<title>
-		<band height="161" splitType="Stretch">
+		<band height="155" splitType="Stretch">
 			<staticText>
 				<reportElement x="0" y="1" width="177" height="30"/>
 				<textElement>
@@ -77,6 +78,16 @@
 				<textElement/>
 				<textFieldExpression><![CDATA[$F{differences}]]></textFieldExpression>
 			</textField>
+			<textField>
+				<reportElement x="123" y="129" width="392" height="20"/>
+				<textElement/>
+				<textFieldExpression><![CDATA[$F{range}]]></textFieldExpression>
+			</textField>
+			<staticText>
+				<reportElement x="0" y="129" width="123" height="20"/>
+				<textElement/>
+				<text><![CDATA[Bereich:]]></text>
+			</staticText>
 		</band>
 	</title>
 	<columnHeader>
diff -r 138feb491c8a -r ce325339e9ba artifacts/doc/conf/jasper/beddifference_en.jasper
Binary file artifacts/doc/conf/jasper/beddifference_en.jasper has changed
diff -r 138feb491c8a -r ce325339e9ba artifacts/doc/conf/jasper/beddifference_en.jrxml
--- a/artifacts/doc/conf/jasper/beddifference_en.jrxml	Mon Mar 16 17:08:04 2015 +0100
+++ b/artifacts/doc/conf/jasper/beddifference_en.jrxml	Mon Mar 16 17:38:08 2015 +0100
@@ -9,12 +9,12 @@
 	<field name="calculation" class="java.lang.String"/>
 	<field name="differences" class="java.lang.String"/>
 	<field name="km" class="java.lang.String"/>
-	<field name="ye_mode" class="java.lang.String"/>
+	<field name="range" class="java.lang.String"/>
 	<background>
 		<band splitType="Stretch"/>
 	</background>
 	<title>
-		<band height="161" splitType="Stretch">
+		<band height="154" splitType="Stretch">
 			<staticText>
 				<reportElement x="0" y="1" width="155" height="30"/>
 				<textElement>
@@ -57,24 +57,24 @@
 				<textFieldExpression><![CDATA[$F{date}]]></textFieldExpression>
 			</textField>
 			<staticText>
-				<reportElement x="0" y="130" width="123" height="20"/>
+				<reportElement x="0" y="110" width="123" height="20"/>
 				<textElement/>
 				<text><![CDATA[Differences:]]></text>
 			</staticText>
 			<textField isStretchWithOverflow="true">
-				<reportElement stretchType="RelativeToTallestObject" x="123" y="130" width="392" height="20"/>
+				<reportElement stretchType="RelativeToTallestObject" x="123" y="110" width="392" height="20"/>
 				<textElement/>
 				<textFieldExpression><![CDATA[$F{differences}]]></textFieldExpression>
 			</textField>
-			<textField isStretchWithOverflow="true">
-				<reportElement stretchType="RelativeToTallestObject" x="123" y="110" width="392" height="20"/>
+			<textField>
+				<reportElement x="123" y="130" width="392" height="20"/>
 				<textElement/>
-				<textFieldExpression><![CDATA[$F{ye_mode}]]></textFieldExpression>
+				<textFieldExpression><![CDATA[$F{range}]]></textFieldExpression>
 			</textField>
 			<staticText>
-				<reportElement x="0" y="110" width="123" height="20"/>
+				<reportElement x="0" y="130" width="123" height="20"/>
 				<textElement/>
-				<text><![CDATA[Year/Epoch:]]></text>
+				<text><![CDATA[Range:]]></text>
 			</staticText>
 		</band>
 	</title>
diff -r 138feb491c8a -r ce325339e9ba artifacts/doc/conf/jasper/waterlevel.jasper
Binary file artifacts/doc/conf/jasper/waterlevel.jasper has changed
diff -r 138feb491c8a -r ce325339e9ba artifacts/doc/conf/jasper/waterlevel.jrxml
--- a/artifacts/doc/conf/jasper/waterlevel.jrxml	Mon Mar 16 17:08:04 2015 +0100
+++ b/artifacts/doc/conf/jasper/waterlevel.jrxml	Mon Mar 16 17:38:08 2015 +0100
@@ -20,14 +20,14 @@
 	<title>
 		<band height="162" splitType="Stretch">
 			<staticText>
-				<reportElement x="0" y="1" width="155" height="30"/>
+				<reportElement x="0" y="1" width="165" height="30"/>
 				<textElement>
 					<font size="18"/>
 				</textElement>
 				<text><![CDATA[Ergebnisausgabe]]></text>
 			</staticText>
 			<textField>
-				<reportElement x="155" y="0" width="360" height="31"/>
+				<reportElement x="165" y="0" width="350" height="31"/>
 				<textElement>
 					<font size="18"/>
 				</textElement>
diff -r 138feb491c8a -r ce325339e9ba artifacts/doc/conf/jasper/wdifferences.jasper
Binary file artifacts/doc/conf/jasper/wdifferences.jasper has changed
diff -r 138feb491c8a -r ce325339e9ba artifacts/doc/conf/jasper/wdifferences.jrxml
--- a/artifacts/doc/conf/jasper/wdifferences.jrxml	Mon Mar 16 17:08:04 2015 +0100
+++ b/artifacts/doc/conf/jasper/wdifferences.jrxml	Mon Mar 16 17:38:08 2015 +0100
@@ -9,20 +9,21 @@
 	<field name="calculation" class="java.lang.String"/>
 	<field name="differences" class="java.lang.String"/>
 	<field name="km" class="java.lang.String"/>
+	<field name="range" class="java.lang.String"/>
 	<background>
 		<band splitType="Stretch"/>
 	</background>
 	<title>
 		<band height="161" splitType="Stretch">
 			<staticText>
-				<reportElement x="0" y="1" width="155" height="30"/>
+				<reportElement x="0" y="1" width="165" height="30"/>
 				<textElement>
 					<font size="18"/>
 				</textElement>
 				<text><![CDATA[Ergebnisausgabe]]></text>
 			</staticText>
 			<textField>
-				<reportElement x="155" y="0" width="360" height="31"/>
+				<reportElement x="165" y="0" width="350" height="31"/>
 				<textElement>
 					<font size="18"/>
 				</textElement>
@@ -65,6 +66,16 @@
 				<textElement/>
 				<textFieldExpression><![CDATA[$F{differences}]]></textFieldExpression>
 			</textField>
+			<textField>
+				<reportElement x="123" y="130" width="392" height="20"/>
+				<textElement/>
+				<textFieldExpression><![CDATA[$F{range}]]></textFieldExpression>
+			</textField>
+			<staticText>
+				<reportElement x="0" y="130" width="123" height="20"/>
+				<textElement/>
+				<text><![CDATA[Bereich:]]></text>
+			</staticText>
 		</band>
 	</title>
 	<columnHeader>
diff -r 138feb491c8a -r ce325339e9ba artifacts/doc/conf/jasper/wdifferences_en.jasper
Binary file artifacts/doc/conf/jasper/wdifferences_en.jasper has changed
diff -r 138feb491c8a -r ce325339e9ba artifacts/doc/conf/jasper/wdifferences_en.jrxml
--- a/artifacts/doc/conf/jasper/wdifferences_en.jrxml	Mon Mar 16 17:08:04 2015 +0100
+++ b/artifacts/doc/conf/jasper/wdifferences_en.jrxml	Mon Mar 16 17:38:08 2015 +0100
@@ -9,6 +9,7 @@
 	<field name="calculation" class="java.lang.String"/>
 	<field name="differences" class="java.lang.String"/>
 	<field name="km" class="java.lang.String"/>
+	<field name="range" class="java.lang.String"/>
 	<background>
 		<band splitType="Stretch"/>
 	</background>
@@ -65,6 +66,16 @@
 				<textElement/>
 				<textFieldExpression><![CDATA[$F{differences}]]></textFieldExpression>
 			</textField>
+			<textField>
+				<reportElement x="123" y="130" width="392" height="20"/>
+				<textElement/>
+				<textFieldExpression><![CDATA[$F{range}]]></textFieldExpression>
+			</textField>
+			<staticText>
+				<reportElement x="0" y="130" width="123" height="20"/>
+				<textElement/>
+				<text><![CDATA[Range:]]></text>
+			</staticText>
 		</band>
 	</title>
 	<columnHeader>
diff -r 138feb491c8a -r ce325339e9ba artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDifferenceJRDataSource.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDifferenceJRDataSource.java	Mon Mar 16 17:08:04 2015 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDifferenceJRDataSource.java	Mon Mar 16 17:38:08 2015 +0100
@@ -53,6 +53,9 @@
         else if ("calculation".equals(fieldName)) {
             value = metaData.get("calculation");
         }
+        else if ("range".equals(fieldName)) {
+            value = metaData.get("range");
+        }
         else if ("date".equals(fieldName)) {
             value = metaData.get("date");
         }
diff -r 138feb491c8a -r ce325339e9ba artifacts/src/main/java/org/dive4elements/river/exports/WDifferencesExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/WDifferencesExporter.java	Mon Mar 16 17:08:04 2015 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/WDifferencesExporter.java	Mon Mar 16 17:38:08 2015 +0100
@@ -32,6 +32,7 @@
 import org.dive4elements.artifacts.common.utils.Config;
 
 import org.dive4elements.river.artifacts.WINFOArtifact;
+import org.dive4elements.river.artifacts.access.RangeAccess;
 
 import org.dive4elements.river.artifacts.model.CalculationResult;
 import org.dive4elements.river.artifacts.model.WKms;
@@ -227,6 +228,12 @@
 
         Locale locale = Resources.getLocale(meta);
         DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, locale);
+        NumberFormat kmf = getKmFormatter();
+
+        RangeAccess rangeAccess = new RangeAccess(flys);
+        double[] kms = rangeAccess.getKmRange();
+        source.addMetaData("range",
+                kmf.format(kms[0]) + " - " + kmf.format(kms[kms.length-1]));
 
         source.addMetaData("date", df.format(new Date()));
 
diff -r 138feb491c8a -r ce325339e9ba artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceExporter.java	Mon Mar 16 17:08:04 2015 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceExporter.java	Mon Mar 16 17:38:08 2015 +0100
@@ -31,6 +31,7 @@
 import org.dive4elements.river.artifacts.D4EArtifact;
 import org.dive4elements.river.artifacts.access.BedDifferencesAccess;
 import org.dive4elements.river.artifacts.access.RiverAccess;
+import org.dive4elements.river.artifacts.access.RangeAccess;
 import org.dive4elements.artifacts.common.utils.Config;
 import org.dive4elements.river.artifacts.resources.Resources;
 import org.dive4elements.river.artifacts.model.CalculationResult;
@@ -163,6 +164,12 @@
 
         Locale locale = Resources.getLocale(meta);
         DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, locale);
+        NumberFormat kmf = Formatter.getWaterlevelKM(context);
+
+        RangeAccess rangeAccess = new RangeAccess(arti);
+        double[] kms = rangeAccess.getKmRange();
+        source.addMetaData("range",
+                kmf.format(kms[0]) + " - " + kmf.format(kms[kms.length-1]));
 
         source.addMetaData("date", df.format(new Date()));
 


More information about the Dive4Elements-commits mailing list