[PATCH 2 of 2] Issue1333: expand single-line i.e. 0-lenght Q-range to minimal length

Wald Commits scm-commit at wald.intevation.org
Thu Sep 12 18:44:42 CEST 2013


# HG changeset patch
# User Tom Gottfried <tom.gottfried at intevation.de>
# Date 1379004201 -7200
# Branch double-precision
# Node ID 0850a4983fcd0aa336432eced212bf3dfeb162e5
# Parent  dcc7a6c8b92c30684410abbfbb958caf22abd1a8
Issue1333: expand single-line i.e. 0-lenght Q-range to minimal length.

diff -r dcc7a6c8b92c -r 0850a4983fcd backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java
--- 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) {


More information about the Dive4elements-commits mailing list