changeset 9357:5ce50640688c

S-Info flood duration: fixed error report output name, changed duration from int to double, added formatter
author mschaefer
date Wed, 01 Aug 2018 13:18:45 +0200
parents 202fd59b4f21
children 8eddc2393750
files artifacts/doc/conf/artifacts/sinfo.xml artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractExportContext.java artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/DurationWaterlevel.java artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculationResult.java artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculator.java gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties
diffstat 8 files changed, 24 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/doc/conf/artifacts/sinfo.xml	Tue Jul 31 18:17:10 2018 +0200
+++ b/artifacts/doc/conf/artifacts/sinfo.xml	Wed Aug 01 13:18:45 2018 +0200
@@ -395,9 +395,9 @@
           </facets>
         </outputmode>
  
-         <outputmode name="sinfo_flood_duration_report" description="output.sinfo_flood_duration_report" mime-type="text/xml" type="report">
+         <outputmode name="sinfo_floodduration_report" description="output.sinfo_floodduration_report" mime-type="text/xml" type="report">
           <facets>
-            <facet name="report" description="facet.sinfo_flood_duration_report" />
+            <facet name="report" description="facet.sinfo_floodduration_report" />
           </facets>
         </outputmode>
       </outputmodes>
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractExportContext.java	Tue Jul 31 18:17:10 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractExportContext.java	Wed Aug 01 13:18:45 2018 +0200
@@ -23,6 +23,7 @@
     private NumberFormat qFormat = null;
 
     private NumberFormat flowDepthFormat = null;
+    private NumberFormat floodDurationFormat = null;
     private NumberFormat salixScenFormat = null;
     private NumberFormat kmFormat = null;
 
@@ -70,6 +71,13 @@
         return this.flowDepthFormat;
     }
 
+    public final NumberFormat getFloodDurationFormatter() {
+
+        if (this.floodDurationFormat == null)
+            this.floodDurationFormat = Formatter.getIntegerFormatter(this.context);
+        return this.floodDurationFormat;
+    }
+
     public final NumberFormat getSalixScenFormatter() {
         if (this.salixScenFormat == null)
             this.salixScenFormat = Formatter.getSalixLine(this.context);
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/DurationWaterlevel.java	Tue Jul 31 18:17:10 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/DurationWaterlevel.java	Wed Aug 01 13:18:45 2018 +0200
@@ -23,9 +23,9 @@
     private final double w;
     private final double q;
     private final String bezeichnung;
-    private final int floodDurDaysPerYear;
+    private final double floodDurDaysPerYear;
 
-    public DurationWaterlevel(final double w, final int floodDurDaysPerYear, final double q, final String bezeichnung) {
+    public DurationWaterlevel(final double w, final double floodDurDaysPerYear, final double q, final String bezeichnung) {
         this.w = w;
         this.q = q;
         this.bezeichnung = bezeichnung;
@@ -40,12 +40,12 @@
         return this.q;
     }
 
-    public int getFloodDurDaysPerYear() {
+    public double getFloodDurDaysPerYear() {
         return this.floodDurDaysPerYear;
     }
 
-    public String getFloodDurDaysPerYearFormatted() {
-        return String.valueOf(this.floodDurDaysPerYear);
+    public String getFloodDurDaysPerYearFormatted(final NumberFormat durFormatter) {
+        return durFormatter.format(this.floodDurDaysPerYear);
     }
 
     public String getBezeichnung() {
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculationResult.java	Tue Jul 31 18:17:10 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculationResult.java	Wed Aug 01 13:18:45 2018 +0200
@@ -125,6 +125,7 @@
         if (waterlevelList != null) {
             final NumberFormat wFormatter = exportContextCSV.getFlowDepthFormatter();
             final NumberFormat qFormatter = exportContextCSV.getQFormatter();
+            final NumberFormat durFormatter = exportContextCSV.getFloodDurationFormatter();
 
             for (int i = 0; i < waterlevelList.size(); i++) {
 
@@ -133,7 +134,7 @@
 
                 final DurationWaterlevel item = waterlevelList.get(i);
                 lines.add(item.getWFormatted(wFormatter));
-                lines.add(item.getFloodDurDaysPerYearFormatted());
+                lines.add(item.getFloodDurDaysPerYearFormatted(durFormatter));
                 lines.add(item.getQFormatted(qFormatter));
                 lines.add(item.getBezeichnung());
             }
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculator.java	Tue Jul 31 18:17:10 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculator.java	Wed Aug 01 13:18:45 2018 +0200
@@ -177,7 +177,7 @@
             final String label = wqd.getBezeichnung().startsWith("W=") ? "Q(" + wqd.getBezeichnung() + ")" : wqd.getBezeichnung();
             final StickyAxisAnnotation annotation = new StickyAxisAnnotation(label, (float) wqd.getDischarge(), SimpleAxis.Y_AXIS,
                     FloodDurationCurveGenerator.YAXIS.Q.idx);
-            annotation.setHitPoint(wqd.getFloodDurDaysPerYear());
+            annotation.setHitPoint((float) wqd.getFloodDurDaysPerYear());
             annotations.add(annotation);
         }
         return annotations;
@@ -207,7 +207,7 @@
             final String label = !wqd.getBezeichnung().startsWith("W=") ? "W(" + wqd.getBezeichnung() + ")" : wqd.getBezeichnung();
             final StickyAxisAnnotation annotation = new StickyAxisAnnotation(label, (float) wqd.getWaterlevel(), SimpleAxis.Y_AXIS,
                     FloodDurationCurveGenerator.YAXIS.W.idx);
-            annotation.setHitPoint(wqd.getFloodDurDaysPerYear());
+            annotation.setHitPoint((float) wqd.getFloodDurDaysPerYear());
             annotations.add(annotation);
         }
         return annotations;
@@ -424,11 +424,7 @@
         final List<DurationWaterlevel> wsts = new ArrayList<>(wqkmsArray.length);
 
         for (int i = 0; i <= wqkmsArray.length - 1; i++) {
-            assert (wqkmsArray[i].getKm(kmIndex) == station.doubleValue());
-
-            final int overflowDays = (int) Math.round(gaugeDurations.get(i));
-
-            final DurationWaterlevel dw = new DurationWaterlevel(wqkmsArray[i].getW(kmIndex), overflowDays, wqkmsArray[i].getQ(kmIndex),
+            final DurationWaterlevel dw = new DurationWaterlevel(wqkmsArray[i].getW(kmIndex), gaugeDurations.get(i), wqkmsArray[i].getQ(kmIndex),
                     wqkmsArray[i].getName());
             wsts.add(dw);
         }
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java	Tue Jul 31 18:17:10 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java	Wed Aug 01 13:18:45 2018 +0200
@@ -1543,6 +1543,8 @@
 
     String sinfo_collision_export();
 
+    String sinfo_collision_report();
+
     String sinfo_flood_height();
 
     String sinfo_columnlabel_soundings();
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties	Tue Jul 31 18:17:10 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties	Wed Aug 01 13:18:45 2018 +0200
@@ -817,6 +817,7 @@
 
 sinfo_predefined_collision = Grundber\u00fchrungen
 sinfo_collision = Grundber\u00fchrungen
+sinfo_collision_report = Grundber\u00fchrungen Bericht
 
 sinfo_flood_duration = \u00dcberflutungsdauer Infrastrukturen BWaStr
 sinfo_flood_height = H\u00f6he Infrastrukturen BWaStr
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties	Tue Jul 31 18:17:10 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties	Wed Aug 01 13:18:45 2018 +0200
@@ -817,6 +817,7 @@
 
 sinfo_predefined_collision = Grundber\u00fchrungen
 sinfo_collision = Grundber\u00fchrungen
+sinfo_collision_report = Grundber\u00fchrungen Bericht
 
 sinfo_flood_duration = \u00dcberflutungsdauer Infrastrukturen BWaStr
 sinfo_flood_height = H\u00f6he Infrastrukturen BWaStr

http://dive4elements.wald.intevation.org