[PATCH] WST-parser: making ranges tightly fit was broken since a<b was enforced. Re-enabled
Wald Commits
scm-commit at wald.intevation.org
Tue Oct 1 18:46:34 CEST 2013
# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1380645990 -7200
# Branch double-precision
# Node ID c5214e04b9b87ca515488a50d0087ff7d8e1879c
# Parent 70ab9e8cdefb70af31e6d1c0c3cc616ed98f48ab
WST-parser: making ranges tightly fit was broken since a<b was enforced. Re-enabled.
diff -r 70ab9e8cdefb -r c5214e04b9b8 backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java
--- 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;
}
More information about the Dive4elements-commits
mailing list