Mercurial > dive4elements > river
changeset 8021:4ec43afaa263
Merged
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Wed, 09 Jul 2014 16:03:04 +0200 |
parents | 139b057a39dd (diff) aa8dcf7331a8 (current diff) |
children | b5cba2690347 |
files | |
diffstat | 1 files changed, 22 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/HYKParser.java Wed Jul 09 15:56:15 2014 +0200 +++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/HYKParser.java Wed Jul 09 16:03:04 2014 +0200 @@ -111,6 +111,8 @@ ImportHYKEntry entry = null; ImportHYKFormation formation = null; + BigDecimal lastZoneEnd = null; + while ((line = in.readLine()) != null) { if (line.startsWith("*") || line.startsWith("----")) { @@ -186,6 +188,22 @@ "failed in line " + in.getLineNumber()); return false; } + + if (parts.length > 3) { + try { + lastZoneEnd = new BigDecimal(parts[3]); + } + catch (NumberFormatException nfe) { + log.error( + "HYK: parsing last flow zone end in " + + "failed in line " + in.getLineNumber()); + return false; + } + } + else { + lastZoneEnd = null; + } + formation = new ImportHYKFormation(); formation.setBottom(bottom); formation.setTop(top); @@ -247,7 +265,10 @@ } for (int i = 0; i < coords.length; ++i) { BigDecimal a = coords[i]; - BigDecimal b = coords[i == coords.length-1 ? i : i+1]; + BigDecimal b = i == coords.length-1 + ? (lastZoneEnd != null ? lastZoneEnd : coords[i]) + : coords[i+1]; + if (a.compareTo(b) > 0) { log.warn("HYK: zone coordinates swapped in line " + in.getLineNumber());