diff artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthExporter.java @ 8954:183f42641ab6

Fixed: flowd depth calculation without transport bodies heights did not work any more
author gernotbelger
date Mon, 19 Mar 2018 14:13:37 +0100
parents 09e4a4909814
children d5802f22e4f5
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthExporter.java	Mon Mar 19 14:01:21 2018 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthExporter.java	Mon Mar 19 14:13:37 2018 +0100
@@ -31,6 +31,10 @@
 // REMARK: must be public because its registered in generators.xml
 public class FlowDepthExporter extends AbstractSInfoExporter<FlowDepthCalculationResult, FlowDepthCalculationResults> {
 
+    private static enum ExportMode {
+        pdf, csv
+    }
+
     /** The log used in this exporter. */
     private static Logger log = Logger.getLogger(FlowDepthExporter.class);
 
@@ -94,22 +98,24 @@
 
     @Override
     protected String[] formatCSVRow(final FlowDepthCalculationResults results, final FlowDepthCalculationResult result, final SInfoResultRow row) {
-        return formatRow(row);
+        return formatRow(row, ExportMode.csv);
     }
 
     /**
      * Format a row of a flow depth result into an array of string, both used by csv and pdf
      *
+     * @param pdf
+     *
      * @param useTkh
      */
-    private String[] formatRow(final SInfoResultRow row) {
+    private String[] formatRow(final SInfoResultRow row, final ExportMode mode) {
 
         final Collection<String> lines = new ArrayList<>(11);
 
         lines.add(row.exportValue(this.context, SInfoResultType.station));
         lines.add(row.exportValue(this.context, SInfoResultType.flowdepth));
 
-        if (getData().isUseTkh()) {
+        if (mode == ExportMode.pdf || getData().isUseTkh()) {
             lines.add(row.exportValue(this.context, SInfoResultType.flowdepthtkh));
             lines.add(row.exportValue(this.context, SInfoResultType.tkh));
         }
@@ -152,6 +158,6 @@
 
     @Override
     protected String[] formatPDFRow(final FlowDepthCalculationResults results, final SInfoResultRow row) {
-        return formatRow(row);
+        return formatRow(row, ExportMode.pdf);
     }
 }
\ No newline at end of file

http://dive4elements.wald.intevation.org