[Dive4elements-commits] [PATCH] Wst Parser: Yet another attempt to fix the order of the Q ranges (made by S. Teichmann)
Wald Commits
scm-commit at wald.intevation.org
Wed Apr 3 21:02:23 CEST 2013
# HG changeset patch
# User Tom Gottfried <tom.gottfried at intevation.de>
# Date 1365015737 -7200
# Node ID 732a8bd446502999d046879d08788be2b9385d91
# Parent f3b270e5462ed65b12873d40df3766f5df20d11f
Wst Parser: Yet another attempt to fix the order of the Q ranges (made by S. Teichmann)
diff -r f3b270e5462e -r 732a8bd44650 flys-backend/src/main/java/de/intevation/flys/importer/parsers/WstParser.java
--- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/WstParser.java Wed Apr 03 20:16:01 2013 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/WstParser.java Wed Apr 03 21:02:17 2013 +0200
@@ -114,6 +114,8 @@
HashSet<BigDecimal> kms = new HashSet<BigDecimal>();
+ BigDecimal kmHist1 = null, kmHist2 = null;
+
while ((input = in.readLine()) != null) {
String line = input;
if (first) { // fetch number of columns
@@ -145,6 +147,12 @@
parseLineAsDouble(line, columnCount, false, true);
if (aktAbfluesse != null) {
+ if (kmHist1 != null && kmHist2 != null) {
+ if (kmHist1.compareTo(kmHist2) < 0) {
+ log.debug("swapped");
+ BigDecimal t = minKm; minKm = maxKm; maxKm = t;
+ }
+ }
addInterval(minKm, maxKm, aktAbfluesse);
minKm = MAX_RANGE;
maxKm = MIN_RANGE;
@@ -272,6 +280,9 @@
continue;
}
+ kmHist2 = kmHist1;
+ kmHist1 = kaem;
+
if (kaem.compareTo(minKm) < 0) {
minKm = kaem;
}
@@ -319,7 +330,9 @@
} // for all lines in WST file
wst.setUnit(new ImportUnit(einheit));
-
+ if (kmHist1.compareTo(kmHist2) < 0) {
+ BigDecimal t = minKm; minKm = maxKm; maxKm = t;
+ }
addInterval(minKm, maxKm, aktAbfluesse);
fixRangesOrder();
More information about the Dive4elements-commits
mailing list