changeset 7222:c5214e04b9b8 double-precision

WST-parser: making ranges tightly fit was broken since a<b was enforced. Re-enabled.
author Tom Gottfried <tom@intevation.de>
date Tue, 01 Oct 2013 18:46:30 +0200
parents 70ab9e8cdefb
children 78ea9d267f76
files backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java
diffstat 1 files changed, 9 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java	Tue Oct 01 18:32:01 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java	Tue Oct 01 18:46:30 2013 +0200
@@ -69,6 +69,8 @@
     protected ImportWst wst;
 
     protected ImportRange lastRange;
+    protected Double lastA;
+    protected Double lastB;
 
     public WstParser() {
     }
@@ -422,16 +424,9 @@
             return;
         }
 
-	Double a1 = null;
-	Double b1 = null;
-        if (lastRange != null) {
-            a1 = lastRange.getA().doubleValue();
-            b1 = lastRange.getB().doubleValue();
-	}
-
 	// expand single-line i.e. 0-lenght Q-range to minimal length
 	if (from == to) {
-	    if (lastRange != null && a1 > b1) {
+	    if (lastRange != null && lastA > lastB) {
 		to = new BigDecimal(from.doubleValue() - INTERVAL_GAP);
 	    }
 	    else {
@@ -447,12 +442,13 @@
 
         if (lastRange != null) {
             double a2 = range.getA().doubleValue();
+            double b2 = range.getB().doubleValue();
 
-            if (a1 < b1) {
+            if (lastA < lastB) {
                 lastRange.setB(new BigDecimal(a2 - INTERVAL_GAP));
             }
-            else { // a1 >= b1
-                lastRange.setB(new BigDecimal(a2 + INTERVAL_GAP));
+            else { // lastA >= lastB
+                lastRange.setA(new BigDecimal(b2 + INTERVAL_GAP));
             }
         }
 
@@ -462,6 +458,8 @@
             column.addColumnQRange(wstQRange);
         }
 
+        lastA = from.doubleValue();
+        lastB = to.doubleValue();
         lastRange = range;
     }
 

http://dive4elements.wald.intevation.org