[PATCH 2 of 2] Punkt 8.1 Grundberührungen Header

Wald Commits scm-commit at wald.intevation.org
Wed Jan 9 14:47:30 CET 2019


# HG changeset patch
# User gernotbelger
# Date 1547041641 -3600
# Node ID 8b457ca70512faf46ac0fad2efe6f8f258792772
# Parent  b61e2a9fa5d69a331c1d8c4bc9bcfae6e9a1d7e5
Punkt 8.1 Grundberührungen Header

diff -r b61e2a9fa5d6 -r 8b457ca70512 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionCalcDetailResult.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionCalcDetailResult.java	Tue Jan 08 17:34:53 2019 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionCalcDetailResult.java	Wed Jan 09 14:47:21 2019 +0100
@@ -55,7 +55,7 @@
         header.add(exportContextCSV.formatCsvHeader(GeneralResultType.station));
         header.add(exportContextCSV.formatCsvHeader(GeneralResultType.dateShort));
         header.add(exportContextCSV.msgUnitCSV(SInfoResultType.collisionGaugeW, SInfoResultType.collisionGaugeW.getUnit()));
-        header.add(exportContextCSV.formatCsvHeader(GeneralResultType.gaugeLabelCm));
+        header.add(exportContextCSV.formatCsvHeader(GeneralResultType.gaugeLabel));
         header.add(exportContextCSV.msgUnitCSV(SInfoResultType.dischargeLong, SInfoResultType.dischargeLong.getUnit()));
         header.add(exportContextCSV.formatCsvHeader(SInfoResultType.dischargeZone));
 
@@ -84,7 +84,7 @@
         lines.add(exportContext.formatRowValue(row, GeneralResultType.station));
         lines.add(exportContext.formatRowValue(row, GeneralResultType.dateShort));
         lines.add(exportContext.formatRowValue(row, SInfoResultType.collisionGaugeW));
-        lines.add(exportContext.formatRowValue(row, GeneralResultType.gaugeLabelCm));
+        lines.add(exportContext.formatRowValue(row, GeneralResultType.gaugeLabel));
         lines.add(exportContext.formatRowValue(row, SInfoResultType.dischargeLong));
         lines.add(exportContext.formatRowValue(row, SInfoResultType.dischargeZone));
 
@@ -103,7 +103,7 @@
         exportContextCSV.addJRMetadata(source, "station_header", GeneralResultType.station);
         exportContextCSV.addJRMetadata(source, "date_header", GeneralResultType.dateShort);
         exportContextCSV.addJRMetadata(source, "gaugew_header", SInfoResultType.collisionGaugeW);
-        exportContextCSV.addJRMetadata(source, "gauge_header", GeneralResultType.gaugeLabelCm);
+        exportContextCSV.addJRMetadata(source, "gauge_header", GeneralResultType.gaugeLabel);
         exportContextCSV.addJRMetadata(source, "discharge_header", SInfoResultType.dischargeLong);
         exportContextCSV.addJRMetadata(source, "dischargezone_header", SInfoResultType.dischargeZone);
     }
diff -r b61e2a9fa5d6 -r 8b457ca70512 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionCalculation.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionCalculation.java	Tue Jan 08 17:34:53 2019 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionCalculation.java	Wed Jan 09 14:47:21 2019 +0100
@@ -114,8 +114,7 @@
             final int toYear, final boolean isEpoch) {
         for (final CollisionAggregateValue aggregate : CollisionAggregateValue.getValuesByKm(river, fromKm, toKm, fromYear, toYear)) {
             rows.add(ResultRow.create().putValue(GeneralResultType.station, aggregate.getStation())
-                    .putValue(SInfoResultType.years, yearsToString(isEpoch, fromYear, toYear))
-                    .putValue(SInfoResultType.collisionCount, aggregate.getCount()));
+                    .putValue(SInfoResultType.years, yearsToString(isEpoch, fromYear, toYear)).putValue(SInfoResultType.collisionCount, aggregate.getCount()));
         }
     }
 
@@ -136,9 +135,8 @@
     /**
      * Calculates the collision details for a km range of a river and a year, and adds them to a ResultRow collection
      */
-    private void calculateDetails(final Collection<ResultRow> rows, final River river, final double fromKm, final double toKm,
-            final int year, final Map<String, GaugeDischargeValuesFinder> qFinders, final Map<String, GaugeMainValueFinder> zoneFinders,
-            final Calculation problems) {
+    private void calculateDetails(final Collection<ResultRow> rows, final River river, final double fromKm, final double toKm, final int year,
+            final Map<String, GaugeDischargeValuesFinder> qFinders, final Map<String, GaugeMainValueFinder> zoneFinders, final Calculation problems) {
 
         for (final CollisionValue collision : CollisionValue.getValues(river, fromKm, toKm, DateUtil.getStartDateFromYear(year),
                 DateUtil.getEndDateFromYear(year))) {
@@ -147,10 +145,8 @@
             final double qOut = Double.isInfinite(q) ? Double.NaN : q;
             final String zone = getZone(zoneFinders, gaugeName, q, river, problems);
             rows.add(ResultRow.create().putValue(GeneralResultType.station, collision.getStation())
-                    .putValue(GeneralResultType.dateShort, collision.getEventDate())
-                    .putValue(SInfoResultType.collisionGaugeW, collision.getGaugeW())
-                    .putValue(GeneralResultType.gaugeLabelCm, gaugeName)
-                    .putValue(SInfoResultType.dischargeLong, qOut)
+                    .putValue(GeneralResultType.dateShort, collision.getEventDate()).putValue(SInfoResultType.collisionGaugeW, collision.getGaugeW())
+                    .putValue(GeneralResultType.gaugeLabel, gaugeName).putValue(SInfoResultType.dischargeLong, qOut)
                     .putValue(SInfoResultType.dischargeZone, zone));
         }
     }
@@ -158,8 +154,8 @@
     /**
      * Gets the discharge of a gauge and a W
      */
-    private double getQ(final Map<String, GaugeDischargeValuesFinder> qFinders, final String gaugeName, final double w,
-            final River river, final Calculation problems) {
+    private double getQ(final Map<String, GaugeDischargeValuesFinder> qFinders, final String gaugeName, final double w, final River river,
+            final Calculation problems) {
         // Find the gauge and load its discharge table, if not already in the map
         final String gnKey = gaugeName.toLowerCase();
         if (!qFinders.containsKey(gnKey))
@@ -173,8 +169,8 @@
     /**
      * Gets the main value zone name of a gauge and a Q
      */
-    private String getZone(final Map<String, GaugeMainValueFinder> zoneFinders, final String gaugeName, final double q,
-            final River river, final Calculation problems) {
+    private String getZone(final Map<String, GaugeMainValueFinder> zoneFinders, final String gaugeName, final double q, final River river,
+            final Calculation problems) {
         // Find the gauge and load its main value list, if not already in the map
         final String gnKey = gaugeName.toLowerCase();
         if (!zoneFinders.containsKey(gnKey))
diff -r b61e2a9fa5d6 -r 8b457ca70512 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/SInfoResultType.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/SInfoResultType.java	Tue Jan 08 17:34:53 2019 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/SInfoResultType.java	Wed Jan 09 14:47:21 2019 +0100
@@ -585,7 +585,8 @@
         }
     };
 
-    public static final SInfoResultType collisionGaugeW = new SInfoResultType(I18NStrings.UNIT_CM, SInfoI18NStrings.CSV_COLLISION_GAUGEW_HEADER) {
+    public static final SInfoResultType collisionGaugeW = new SInfoResultType(I18NStrings.UNIT_CM, SInfoI18NStrings.CSV_COLLISION_GAUGEW_HEADER,
+            "sinfo.export.pdf.header.collision.gaugew.with_unit") {
         private static final long serialVersionUID = 1L;
 
         @Override


More information about the Dive4Elements-commits mailing list