comparison backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java @ 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 1d60614c1059
children 3d83a4cf33ba
comparison
equal deleted inserted replaced
7001:dcc7a6c8b92c 7002:0850a4983fcd
426 426
427 if (values == null || from == MAX_RANGE || from == MIN_RANGE) { 427 if (values == null || from == MAX_RANGE || from == MIN_RANGE) {
428 return; 428 return;
429 } 429 }
430 430
431 Double a1 = null;
432 Double b1 = null;
433 if (lastRange != null) {
434 a1 = lastRange.getA().doubleValue();
435 b1 = lastRange.getB().doubleValue();
436 }
437
438 // expand single-line i.e. 0-lenght Q-range to minimal length
439 if (from == to) {
440 if (lastRange != null && a1 > b1) {
441 to = new BigDecimal(from.doubleValue() - INTERVAL_GAP);
442 }
443 else {
444 to = new BigDecimal(from.doubleValue() + INTERVAL_GAP);
445 }
446 }
447
431 ImportRange range = new ImportRange(from, to); 448 ImportRange range = new ImportRange(from, to);
432 449
433 // little workaround to make the q ranges tightly fit. 450 // little workaround to make the q ranges tightly fit.
434 // Leave a very small gap to ensure that the range queries 451 // Leave a very small gap to ensure that the range queries
435 // still work. 452 // still work.
436 453
437 if (lastRange != null) { 454 if (lastRange != null) {
438 double a1 = lastRange.getA().doubleValue();
439 double b1 = lastRange.getB().doubleValue();
440 double a2 = range.getA().doubleValue(); 455 double a2 = range.getA().doubleValue();
441 456
442 if (a1 < b1) { 457 if (a1 < b1) {
443 lastRange.setB(new BigDecimal(a2 - INTERVAL_GAP)); 458 lastRange.setB(new BigDecimal(a2 - INTERVAL_GAP));
444 } 459 }

http://dive4elements.wald.intevation.org