changeset 3252:62c9bcef0680

Fix issue705 (maĆ­n value names also in w/q-range mode). flys-artifacts/trunk@4886 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 06 Jul 2012 12:24:44 +0000
parents aeeb9192e395
children 209d50ee8e9f
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java
diffstat 2 files changed, 25 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Jul 06 11:12:55 2012 +0000
+++ b/flys-artifacts/ChangeLog	Fri Jul 06 12:24:44 2012 +0000
@@ -1,3 +1,11 @@
+2012-07-07	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Fix issue705 (names for mainvalues in export).
+
+	* src/main/java/de/intevation/flys/exports/WaterlevelExporter.java:
+	  Documentation and use NamedMainValues irrespective of WQ-type (
+	  single vs range).
+
 2012-07-07	Christian Lins <christian.lins@intevation.de>
 
 	* src/main/java/de/intevation/flys/utils/ThemeUtil.java,
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java	Fri Jul 06 11:12:55 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java	Fri Jul 06 12:24:44 2012 +0000
@@ -44,6 +44,9 @@
 
 
 /**
+ * Generates different output formats (wst, csv, pdf) of data that resulted from
+ * a waterlevel computation.
+ *
  * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
 public class WaterlevelExporter extends AbstractExporter {
@@ -239,6 +242,10 @@
     }
 
 
+    /**
+     * Get a string like 'W=' or 'Q=' with a number following in localized
+     * format.
+     */
     protected String localizeWQKms(WINFOArtifact winfo, WQKms wqkms) {
         WQ_MODE wqmode   = FLYSUtils.getWQMode(winfo);
         Double  rawValue = wqkms.getRawValue();
@@ -262,19 +269,18 @@
     protected void writeCSVData(CSVWriter writer) {
         logger.info("WaterlevelExporter.writeData");
 
-        WQ_MODE mode     = FLYSUtils.getWQMode((FLYSArtifact)master);
-        boolean atGauge  = mode == WQ_MODE.QGAUGE || mode == WQ_MODE.WGAUGE;
-        boolean isQ      = mode == WQ_MODE.QGAUGE || mode == WQ_MODE.QFREE;
+        WQ_MODE mode    = FLYSUtils.getWQMode((FLYSArtifact)master);
+        boolean atGauge = mode == WQ_MODE.QGAUGE || mode == WQ_MODE.WGAUGE;
+        boolean isQ     = mode == WQ_MODE.QGAUGE || mode == WQ_MODE.QFREE;
         FLYSUtils.WQ_INPUT input
             = FLYSUtils.getWQInputMode((FLYSArtifact)master);
-        boolean isRange = input == FLYSUtils.WQ_INPUT.RANGE;
 
         writeCSVMeta(writer);
         writeCSVHeader(writer, atGauge, isQ);
 
         for (WQKms[] tmp: data) {
             for (WQKms wqkms: tmp) {
-                wQKms2CSV(writer, wqkms, atGauge, isQ, isRange);
+                wQKms2CSV(writer, wqkms, atGauge, isQ);
             }
         }
     }
@@ -428,12 +434,14 @@
     }
 
 
+    /**
+     * Write "rows" of csv data from wqkms with writer.
+     */
     protected void wQKms2CSV(
         CSVWriter writer,
         WQKms     wqkms,
         boolean   atGauge,
-        boolean   isQ,
-        boolean   isRange
+        boolean   isQ
     ) {
         logger.debug("WaterlevelExporter.wQKms2CSV");
 
@@ -466,9 +474,8 @@
 
         long startTime = System.currentTimeMillis();
 
-        String colDesc = !isRange
-            ? FLYSUtils.getNamedMainValue((WINFOArtifact)flys, wqkms.getRawValue())
-            : desc;
+        String colDesc = FLYSUtils.getNamedMainValue((WINFOArtifact)flys,
+            wqkms.getRawValue());
 
         for (int i = 0; i < size; i ++) {
             result = wqkms.get(i, result);
@@ -713,7 +720,6 @@
             logger.debug("Writing PDF data took " +
                 (float)(stopTime-startTime)/1000f + " secs.");
         }
-
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org