changeset 6320:6cdafb6feee1

issue1335: Set a single (0) QRange for Waterlevel diffs from csv.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 13 Jun 2013 07:12:35 +0200
parents 550cb41d37d9
children 6c41a4ca2876
files backend/src/main/java/org/dive4elements/river/importer/ImportWstQRange.java backend/src/main/java/org/dive4elements/river/importer/parsers/WaterlevelDifferencesParser.java
diffstat 2 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/importer/ImportWstQRange.java	Wed Jun 12 12:36:43 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/ImportWstQRange.java	Thu Jun 13 07:12:35 2013 +0200
@@ -37,6 +37,15 @@
         this.q     = q;
     }
 
+    public ImportWstQRange(
+        BigDecimal a,
+        BigDecimal b,
+        BigDecimal q
+    ) {
+        this.range = new ImportRange(a, b);
+        this.q     = q;
+    }
+
     public ImportRange getRange() {
         return range;
     }
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/WaterlevelDifferencesParser.java	Wed Jun 12 12:36:43 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/WaterlevelDifferencesParser.java	Thu Jun 13 07:12:35 2013 +0200
@@ -24,7 +24,9 @@
 import org.dive4elements.river.importer.ImportUnit;
 
 import org.dive4elements.river.importer.ImportWst;
+import org.dive4elements.river.importer.ImportWstQRange;
 import org.dive4elements.river.importer.ImportWstColumn;
+import org.dive4elements.river.importer.ImportWstColumnValue;
 
 
 /**
@@ -95,6 +97,17 @@
             differences.add(current);
         }
 
+        // For all differences columns, add a single Q-Range with
+        // 0.
+        for (ImportWstColumn column: columns) {
+            List<ImportWstColumnValue> cValues = column.getColumnValues();
+            column.addColumnQRange(
+                new ImportWstQRange(
+                    cValues.get(0).getPosition(),
+                    cValues.get(cValues.size() - 1).getPosition(),
+                    new BigDecimal(0d))
+                );
+        }
         current = null;
         columns = null;
     }

http://dive4elements.wald.intevation.org