[PATCH] Adapted bed differences PDF export to CSV export and some cleanup of field names

Wald Commits scm-commit at wald.intevation.org
Wed Jun 4 18:22:17 CEST 2014


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1401898934 -7200
# Node ID c0843a658474aa2df2a6438d375bb188dba83f69
# Parent  931dffefc3dd7ace8ee2c00cd48acdc310e625fa
Adapted bed differences PDF export to CSV export and some cleanup of field names.

diff -r 931dffefc3dd -r c0843a658474 artifacts/doc/conf/jasper/beddifference.jasper
Binary file artifacts/doc/conf/jasper/beddifference.jasper has changed
diff -r 931dffefc3dd -r c0843a658474 artifacts/doc/conf/jasper/beddifference.jrxml
--- a/artifacts/doc/conf/jasper/beddifference.jrxml	Wed Jun 04 15:34:22 2014 +0200
+++ b/artifacts/doc/conf/jasper/beddifference.jrxml	Wed Jun 04 18:22:14 2014 +0200
@@ -4,15 +4,20 @@
 	<property name="ireport.x" value="0"/>
 	<property name="ireport.y" value="0"/>
 	<field name="river" class="java.lang.String"/>
-	<field name="meter" class="java.lang.String"/>
+	<field name="diff" class="java.lang.String"/>
 	<field name="date" class="java.lang.String"/>
 	<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="unit" class="java.lang.String"/>
+	<field name="diffheader" class="java.lang.String"/>
 	<field name="diffpairheader" class="java.lang.String"/>
 	<field name="diffpair" class="java.lang.String"/>
+	<field name="morph1header" class="java.lang.String"/>
+	<field name="morph1" class="java.lang.String"/>
+	<field name="morph2header" class="java.lang.String"/>
+	<field name="morph2" class="java.lang.String"/>
+	<field name="kmheader" class="java.lang.String"/>
 	<background>
 		<band splitType="Stretch"/>
 	</background>
@@ -86,40 +91,60 @@
 			<line>
 				<reportElement x="0" y="19" width="515" height="1"/>
 			</line>
-			<staticText>
-				<reportElement x="0" y="0" width="155" height="20"/>
-				<textElement/>
-				<text><![CDATA[Fluss-Km]]></text>
-			</staticText>
 			<textField>
-				<reportElement x="155" y="0" width="150" height="20"/>
+				<reportElement x="0" y="0" width="54" height="20"/>
 				<textElement markup="none"/>
-				<textFieldExpression><![CDATA[$F{unit}]]></textFieldExpression>
+				<textFieldExpression><![CDATA[$F{kmheader}]]></textFieldExpression>
 			</textField>
 			<textField>
-				<reportElement x="305" y="4" width="140" height="20"/>
+				<reportElement x="167" y="0" width="96" height="20"/>
+				<textElement markup="none"/>
+				<textFieldExpression><![CDATA[$F{diffheader}]]></textFieldExpression>
+			</textField>
+			<textField>
+				<reportElement x="54" y="0" width="113" height="19"/>
 				<textElement/>
 				<textFieldExpression><![CDATA[$F{diffpairheader}]]></textFieldExpression>
 			</textField>
+			<textField>
+				<reportElement x="263" y="0" width="123" height="20"/>
+				<textElement/>
+				<textFieldExpression><![CDATA[$F{morph1header}]]></textFieldExpression>
+			</textField>
+			<textField>
+				<reportElement x="386" y="0" width="128" height="19"/>
+				<textElement/>
+				<textFieldExpression><![CDATA[$F{morph2header}]]></textFieldExpression>
+			</textField>
 		</band>
 	</columnHeader>
 	<detail>
 		<band height="18" splitType="Stretch">
 			<textField isBlankWhenNull="true">
-				<reportElement x="0" y="0" width="155" height="14"/>
+				<reportElement x="0" y="0" width="54" height="14"/>
 				<textElement/>
 				<textFieldExpression><![CDATA[$F{km}]]></textFieldExpression>
 			</textField>
 			<textField isBlankWhenNull="true">
-				<reportElement x="155" y="0" width="150" height="14"/>
+				<reportElement x="167" y="0" width="96" height="14"/>
 				<textElement/>
-				<textFieldExpression><![CDATA[$F{meter}]]></textFieldExpression>
+				<textFieldExpression><![CDATA[$F{diff}]]></textFieldExpression>
 			</textField>
 			<textField isBlankWhenNull="true">
-				<reportElement x="305" y="0" width="97" height="14"/>
+				<reportElement x="54" y="0" width="113" height="14"/>
 				<textElement/>
 				<textFieldExpression><![CDATA[$F{diffpair}]]></textFieldExpression>
 			</textField>
+			<textField isBlankWhenNull="true">
+				<reportElement x="263" y="0" width="123" height="14"/>
+				<textElement/>
+				<textFieldExpression><![CDATA[$F{morph1}]]></textFieldExpression>
+			</textField>
+			<textField isBlankWhenNull="true">
+				<reportElement x="386" y="0" width="128" height="14"/>
+				<textElement/>
+				<textFieldExpression><![CDATA[$F{morph2}]]></textFieldExpression>
+			</textField>
 		</band>
 	</detail>
 	<pageFooter>
diff -r 931dffefc3dd -r c0843a658474 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	Wed Jun 04 15:34:22 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDifferenceJRDataSource.java	Wed Jun 04 18:22:14 2014 +0200
@@ -62,20 +62,35 @@
         else if ("differences".equals(fieldName)) {
             value = metaData.get("differences");
         }
-        else if ("unit".equals(fieldName)) {
-            value = metaData.get("unit");
+        else if ("kmheader".equals(fieldName)) {
+            value = metaData.get("kmheader");
+        }
+        else if ("diffpairheader".equals(fieldName)) {
+            value = metaData.get("diffpairheader");
+        }
+        else if ("diffheader".equals(fieldName)) {
+            value = metaData.get("diffheader");
+        }
+        else if ("morph1header".equals(fieldName)) {
+            value = metaData.get("morph1header");
+        }
+        else if ("morph2header".equals(fieldName)) {
+            value = metaData.get("morph2header");
         }
         else if ("km".equals(fieldName)) {
             value = data.get(index)[0];
         }
-        else if ("meter".equals(fieldName)) {
+        else if ("diffpair".equals(fieldName)) {
             value = data.get(index)[1];
         }
-        else if ("diffpair".equals(fieldName)) {
+        else if ("diff".equals(fieldName)) {
             value = data.get(index)[2];
         }
-        else if ("diffpairheader".equals(fieldName)) {
-            value = metaData.get("diffpairheader");
+        else if ("morph1".equals(fieldName)) {
+            value = data.get(index)[3];
+        }
+        else if ("morph2".equals(fieldName)) {
+            value = data.get(index)[4];
         }
         return value;
     }
diff -r 931dffefc3dd -r c0843a658474 artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceExporter.java	Wed Jun 04 15:34:22 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceExporter.java	Wed Jun 04 18:22:14 2014 +0200
@@ -160,9 +160,15 @@
         source.addMetaData("differences", StringUtils.join(
                 access.getDifferenceArtifactNamePairs(), "\n"));
 
-        source.addMetaData("unit", msg(CSV_HEADER_DIFF, "cm"));
+        source.addMetaData("kmheader",
+                msg(CSV_HEADER_KM, "km"));
         source.addMetaData("diffpairheader",
                 msg(CSV_HEADER_DIFF_PAIR, "Difference pair"));
+        source.addMetaData("diffheader", msg(CSV_HEADER_DIFF, "cm"));
+        source.addMetaData("morph1header", 
+                msg(CSV_HEADER_MORPH1, "Morph. active width minuend"));
+        source.addMetaData("morph2header", 
+                msg(CSV_HEADER_MORPH2, "Morph. active width subtrahend"));
     }
 
 
@@ -190,13 +196,19 @@
         NumberFormat kmf = Formatter.getCalculationKm(context.getMeta());
         NumberFormat mf = Formatter.getMeterFormat(context);
         for (BedDifferencesResult result: results) {
+            BedDiffYearResult yResult = (BedDiffYearResult) result;
             double[][] kms = result.getDifferencesData();
             String desc = result.getDiffDescription();
+            double[][] morph1 = yResult.getMorphWidth1Data();
+            double[][] morph2 = yResult.getMorphWidth2Data();
             for (int j = 0; j < kms[0].length; j++) {
                 source.addData(new String[] {
                     kmf.format(kms[0][j]),
+                    desc,
                     mf.format(kms[1][j]),
-                    desc });
+                    mf.format(morph1[1][j]),
+                    mf.format(morph2[1][j])
+                    });
             }
         }
         return source;


More information about the Dive4Elements-commits mailing list