changeset 8614:e7a2234e7c3f

(issue1608) Export appropiate data for different result types
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 25 Mar 2015 11:25:28 +0100
parents 39ce099a6551
children 054d1b57ae4a
files artifacts/src/main/java/org/dive4elements/river/exports/FlowVelocityExporter.java
diffstat 1 files changed, 31 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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)),
+                    });
+                }
             }
         }
     }

http://dive4elements.wald.intevation.org