[PATCH] (issue1608) Export appropiate data for different result types

Wald Commits scm-commit at wald.intevation.org
Wed Mar 25 11:25:37 CET 2015


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1427279128 -3600
# Node ID e7a2234e7c3faf00a543df9020643f95b945ecad
# Parent  39ce099a655198bef522969e4485d4b933e4c164
(issue1608) Export appropiate data for different result types

diff -r 39ce099a6551 -r e7a2234e7c3f artifacts/src/main/java/org/dive4elements/river/exports/FlowVelocityExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/FlowVelocityExporter.java	Tue Mar 24 18:17:23 2015 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/FlowVelocityExporter.java	Wed Mar 25 11:25:28 2015 +0100
@@ -107,14 +107,37 @@
                 NumberFormat valF = Formatter.getFlowVelocityValues(context);
                 NumberFormat qF   = Formatter.getFlowVelocityQ(context);
 
-                writer.writeNext(new String[] {
-                    kmF.format(data.getKM(i)),
-                    valF.format(data.getVMain(i)),
-                    valF.format(data.getVTotal(i)),
-                    valF.format(data.getTauMain(i)),
-                    qF.format(data.getQ(i)) + "=" + data.getZone(),
-                    RiverUtils.getLocationDescription(flys, data.getKM(i)),
-                });
+                if (data.getType().equals("main")) {
+                    /* Only a main channel value selected */
+                    writer.writeNext(new String[] {
+                        kmF.format(data.getKM(i)),
+                        valF.format(data.getVMain(i)),
+                        "",
+                        valF.format(data.getTauMain(i)),
+                        qF.format(data.getQ(i)) + "=" + data.getZone(),
+                        RiverUtils.getLocationDescription(flys, data.getKM(i)),
+                    });
+                } else if (data.getType().equals("total")) {
+                    /* Only a total channel value selected */
+                    writer.writeNext(new String[] {
+                        kmF.format(data.getKM(i)),
+                        "",
+                        valF.format(data.getVTotal(i)),
+                        valF.format(data.getTauMain(i)),
+                        qF.format(data.getQ(i)) + "=" + data.getZone(),
+                        RiverUtils.getLocationDescription(flys, data.getKM(i)),
+                    });
+                } else {
+                    /* In this case the type is main_total */
+                    writer.writeNext(new String[] {
+                        kmF.format(data.getKM(i)),
+                        valF.format(data.getVMain(i)),
+                        valF.format(data.getVTotal(i)),
+                        valF.format(data.getTauMain(i)),
+                        qF.format(data.getQ(i)) + "=" + data.getZone(),
+                        RiverUtils.getLocationDescription(flys, data.getKM(i)),
+                    });
+                }
             }
         }
     }


More information about the Dive4Elements-commits mailing list