changeset 394:b9175ddea49b

Filled the discharge curve exporter (CSV) with code - now, it generates a CSV export with the computed discharge curve data. flys-artifacts/trunk@1820 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 04 May 2011 10:10:11 +0000
parents befedd7629d5
children aae8f327425e
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveExporter.java
diffstat 2 files changed, 28 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Wed May 04 08:24:50 2011 +0000
+++ b/flys-artifacts/ChangeLog	Wed May 04 10:10:11 2011 +0000
@@ -1,3 +1,9 @@
+2011-05-04  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/ComputedDischargeCurveExporter.java:
+	  Fetch the WQ data from WINFO artifact and write those values into the
+	  CSV export.
+
 2011-05-04  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java: Added
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveExporter.java	Wed May 04 08:24:50 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveExporter.java	Wed May 04 10:10:11 2011 +0000
@@ -14,6 +14,7 @@
 import de.intevation.artifacts.CallContext;
 
 import de.intevation.flys.artifacts.WINFOArtifact;
+import de.intevation.flys.artifacts.model.WQKms;
 
 
 /**
@@ -26,22 +27,41 @@
         Logger.getLogger(ComputedDischargeCurveExporter.class);
 
 
+    protected List<WQKms> data;
+
+
     public void init(Document request, OutputStream out, CallContext context) {
         logger.debug("ComputedDischargeCurveExporter.init");
 
         super.init(request, out, context);
+
+        this.data = new ArrayList<WQKms>();
     }
 
 
     protected void addData(Artifact artifact) {
-        // TODO FILL ME
+        WINFOArtifact winfoArtifact = (WINFOArtifact) artifact;
+        data.add(winfoArtifact.getComputedDischargeCurveData());
     }
 
 
     protected void writeCSVData(CSVWriter writer) {
         logger.info("ComputedDischargeCurveExporter.writeData");
 
-        // TODO FILL ME
+        double[] res = new double[3];
+
+        for (WQKms wqkms: data) {
+            int size = wqkms.size();
+
+            for (int i = 0; i < size; i++) {
+                res = wqkms.get(i, res);
+
+                writer.writeNext(new String[] {
+                    Double.toString(res[0]),
+                    Double.toString(res[1])
+                });
+            }
+        }
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org