[PATCH] header fix flood_duration

Wald Commits scm-commit at wald.intevation.org
Wed Jul 4 10:32:26 CEST 2018


# HG changeset patch
# User gernotbelger
# Date 1530693138 -7200
# Node ID 4e6111f87ddacdc4a07776460f3947a97975aab2
# Parent  85d6923b242db368f20f401db110f0986d45c943
header fix flood_duration

diff -r 85d6923b242d -r 4e6111f87dda artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/DurationWaterlevel.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/DurationWaterlevel.java	Tue Jul 03 17:05:42 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/DurationWaterlevel.java	Wed Jul 04 10:32:18 2018 +0200
@@ -56,19 +56,33 @@
         return wFormatter.format(this.w);
     }
 
+    // normally, the label is included in the type, but we need to replace the index ("_1")
     public static final String getHeaderQ() {
-        return "sinfo.flood_duration.header.q_index"; // kein extra-String für pdf
+        return "sinfo.flood_duration.header.q_index";
     }
 
-    public static final String getHeaderW() {
+    public static final String getHeaderWPdf() {
         return "sinfo.flood_duration.header.pdf.w_index";
     }
 
-    public static final String getHeaderBezeichn() {
+    public static final String getHeaderBezeichnPdf() {
         return "sinfo.flood_duration.header.pdf.bezeichnung_index";
     }
 
-    public static final String getHeaderFloodDurPerYear() {
+    public static final String getHeaderFloodDurPerYearPdf() {
         return "sinfo.flood_duration.header.pdf.fd_per_year_index";
     }
+
+    public static final String getHeaderWCsv() {
+        return "sinfo.flood_duration.header.w_index";
+    }
+
+    public static final String getHeaderBezeichnCsv() {
+        return "sinfo.flood_duration.header.bezeichnung_index";
+    }
+
+    public static final String getHeaderFloodDurPerYearCsv() {
+        return "sinfo.flood_duration.header.fd_per_year_index";
+    }
+
 }
diff -r 85d6923b242d -r 4e6111f87dda artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculationResult.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculationResult.java	Tue Jul 03 17:05:42 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculationResult.java	Wed Jul 04 10:32:18 2018 +0200
@@ -167,13 +167,6 @@
             }
         }
 
-        if ((this.waterlevelCount == 0 || this.waterlevelCount == 2) && mode == ExportMode.pdf) {
-            // lines.add("dummy1");
-            // lines.add("dummy2");
-            // lines.add("dummy3");
-            // lines.add("dummy4");
-        }
-
         lines.add(exportContextCSV.formatRowValue(row, SInfoResultType.gaugeLabel));
         lines.add(exportContextCSV.formatRowValue(row, SInfoResultType.location));
 
@@ -200,10 +193,10 @@
             final String appendIndex = new StringBuilder().append("_").append(naturalIndex).toString();
             final Object[] args = new Object[] { appendIndex };
             // new StringBuilder().append('\u2081').toString(); // schlechter UTF-8-Support für subscript ints
-            header.add(exportContextCSV.msg(DurationWaterlevel.getHeaderW(), new Object[] { appendIndex, "results.getRiver().getWstUnit()" }));
-            header.add(exportContextCSV.msg(DurationWaterlevel.getHeaderFloodDurPerYear(), args));
+            header.add(exportContextCSV.msg(DurationWaterlevel.getHeaderWCsv(), new Object[] { appendIndex, "results.getRiver().getWstUnit()" }));
+            header.add(exportContextCSV.msg(DurationWaterlevel.getHeaderFloodDurPerYearCsv(), args));
             header.add(exportContextCSV.msg(DurationWaterlevel.getHeaderQ(), args));
-            header.add(exportContextCSV.msg(DurationWaterlevel.getHeaderBezeichn(), args));
+            header.add(exportContextCSV.msg(DurationWaterlevel.getHeaderBezeichnCsv(), args));
         }
 
         header.add(exportContextCSV.formatCsvHeader(SInfoResultType.gaugeLabel));
@@ -236,25 +229,16 @@
         exportContextPDF.addJRMetadata(source, "infrastructure_height_header", SInfoResultType.infrastructureHeight);
         exportContextPDF.addJRMetadata(source, "infrastructure_type_header", SInfoResultType.infrastructuretype);
 
-        // add dynamic headers
-
-        if (this.waterlevelCount == 0 || this.waterlevelCount == 2) {
-            // source.addMetaData("dummy1", "dummy1");
-            // source.addMetaData("dummy2", "dummy2");
-            // source.addMetaData("dummy3", "dummy3");
-            // source.addMetaData("dummy4", "dummy4");
-        }
-
         for (int i = 0; i < this.waterlevelCount; i++) {
             final int naturalIndex = i + 1;
 
             final Object[] args = new String[] { new StringBuilder().append("_").append(naturalIndex).toString() };
-            exportContextPDF.addJRMetadata(source, getPdfHeader("w", naturalIndex), exportContextPDF.msg(DurationWaterlevel.getHeaderW(), args));
+            exportContextPDF.addJRMetadata(source, getPdfHeader("w", naturalIndex), exportContextPDF.msg(DurationWaterlevel.getHeaderWPdf(), args));
             exportContextPDF.addJRMetadata(source, getPdfHeader("duration", naturalIndex),
-                    exportContextPDF.msg(DurationWaterlevel.getHeaderFloodDurPerYear(), args));
+                    exportContextPDF.msg(DurationWaterlevel.getHeaderFloodDurPerYearPdf(), args));
             exportContextPDF.addJRMetadata(source, getPdfHeader("q", naturalIndex), exportContextPDF.msg(DurationWaterlevel.getHeaderQ(), args));
             exportContextPDF.addJRMetadata(source, getPdfHeader("bezeichnung", naturalIndex),
-                    exportContextPDF.msg(DurationWaterlevel.getHeaderBezeichn(), args));
+                    exportContextPDF.msg(DurationWaterlevel.getHeaderBezeichnPdf(), args));
         }
 
         exportContextPDF.addJRMetadata(source, "gauge_header", SInfoResultType.gaugeLabel);
diff -r 85d6923b242d -r 4e6111f87dda artifacts/src/main/resources/messages.properties
--- a/artifacts/src/main/resources/messages.properties	Tue Jul 03 17:05:42 2018 +0200
+++ b/artifacts/src/main/resources/messages.properties	Wed Jul 04 10:32:18 2018 +0200
@@ -1005,10 +1005,9 @@
 sinfo.flood_duration.header.duration_index = \u00dcberflutungsdauer WSPL{0} [d/a]
 sinfo.flood_duration.header.fd_per_year_index = \u00dcberflutungsdauer WSPL{0} [d/a]
 sinfo.flood_duration.header.pdf.fd_per_year_index = \u00dcberflu-tungs-dauer WSPL{0} [d/a]
-sinfo.flood_duration.header.w_index = Wasser-stand/Wasser-spiegel-lage{0}
-sinfo.flood_duration.header.pdf.w_index = Wasser-stand/ Wasser-spiegel-lage{0}
-sinfo.flood_duration.header.q_index =  Q{0}
-sinfo.flood_duration.header.pdf.q_index =  Q{0} [m\u00b3/s]
+sinfo.flood_duration.header.w_index = Wasserstand/Wasserspiegellage{0}
+sinfo.flood_duration.header.pdf.w_index = Wasser-stand/ Wasser-spiegel-lage{0} 
+sinfo.flood_duration.header.q_index =  Q{0} [m\u00b3/s]
 
 sinfo.export.flow_depth_minmax.csv.header.min = Minimale Flie\u00dftiefe
 sinfo.export.flow_depth_minmax.csv.header.max = Maximale Flie\u00dftiefe
diff -r 85d6923b242d -r 4e6111f87dda artifacts/src/main/resources/messages_de.properties
--- a/artifacts/src/main/resources/messages_de.properties	Tue Jul 03 17:05:42 2018 +0200
+++ b/artifacts/src/main/resources/messages_de.properties	Wed Jul 04 10:32:18 2018 +0200
@@ -1005,10 +1005,9 @@
 sinfo.flood_duration.header.duration_index = \u00dcberflutungsdauer WSPL{0} [d/a]
 sinfo.flood_duration.header.fd_per_year_index = \u00dcberflutungsdauer WSPL{0} [d/a]
 sinfo.flood_duration.header.pdf.fd_per_year_index = \u00dcberflu-tungs-dauer WSPL{0} [d/a]
-sinfo.flood_duration.header.w_index = Wasser-stand/Wasser-spiegel-lage{0}
-sinfo.flood_duration.header.pdf.w_index = Wasser-stand/ Wasser-spiegel-lage{0}
-sinfo.flood_duration.header.q_index =  Q{0}
-sinfo.flood_duration.header.pdf.q_index =  Q{0} [m\u00b3/s]
+sinfo.flood_duration.header.w_index = Wasserstand/Wasserspiegellage{0}
+sinfo.flood_duration.header.pdf.w_index = Wasser-stand/ Wasser-spiegel-lage{0} 
+sinfo.flood_duration.header.q_index =  Q{0} [m\u00b3/s]
 
 sinfo.export.flow_depth_minmax.csv.header.min = Minimale Flie\u00dftiefe
 sinfo.export.flow_depth_minmax.csv.header.max = Maximale Flie\u00dftiefe


More information about the Dive4Elements-commits mailing list