changeset 7002:0850a4983fcd double-precision

Issue1333: expand single-line i.e. 0-lenght Q-range to minimal length.
author Tom Gottfried <tom.gottfried@intevation.de>
date Thu, 12 Sep 2013 18:43:21 +0200
parents dcc7a6c8b92c
children 3d83a4cf33ba
files backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java
diffstat 1 files changed, 17 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java	Fri Aug 30 17:31:20 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java	Thu Sep 12 18:43:21 2013 +0200
@@ -428,6 +428,23 @@
             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) {
+		to = new BigDecimal(from.doubleValue() - INTERVAL_GAP);
+	    }
+	    else {
+		to = new BigDecimal(from.doubleValue() + INTERVAL_GAP);
+	    }
+	}
+
         ImportRange range = new ImportRange(from, to);
 
         // little workaround to make the q ranges tightly fit.
@@ -435,8 +452,6 @@
         // still work.
 
         if (lastRange != null) {
-            double a1 = lastRange.getA().doubleValue();
-            double b1 = lastRange.getB().doubleValue();
             double a2 = range.getA().doubleValue();
 
             if (a1 < b1) {

http://dive4elements.wald.intevation.org