changeset 1225:d859c4bc6ace

HYK Importer: Check if zone coordinates in HYKs are swapped and warn the user. flys-backend/trunk@2356 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 18 Jul 2011 16:55:32 +0000
parents ca7d461a53f1
children 1dbafbba50ea
files flys-backend/ChangeLog flys-backend/src/main/java/de/intevation/flys/importer/parsers/HYKParser.java
diffstat 2 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/ChangeLog	Mon Jul 18 16:43:27 2011 +0000
+++ b/flys-backend/ChangeLog	Mon Jul 18 16:55:32 2011 +0000
@@ -1,3 +1,8 @@
+2011-07-18	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/importer/parsers/HYKParser.java:
+	  Check if zone coordinates in HYKs are swapped and warn the user.
+
 2011-07-18	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/model/HYK.java
--- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/HYKParser.java	Mon Jul 18 16:43:27 2011 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/HYKParser.java	Mon Jul 18 16:55:32 2011 +0000
@@ -238,11 +238,15 @@
                             return false;
                         }
                         for (int i = 0; i < coords.length; ++i) {
+                            BigDecimal a = coords[i];
+                            BigDecimal b = coords[i == coords.length-1 ? i : i+1];
+                            if (a.compareTo(b) > 0) {
+                                log.warn("zone coordinates swapped in line " + 
+                                    in.getLineNumber());
+                                BigDecimal c = a; a = b; b = c;
+                            }
                             ImportHYKFlowZone zone = new ImportHYKFlowZone(
-                                formation,
-                                fzts[i],
-                                coords[i],
-                                coords[i == coords.length-1 ? i : i+1]);
+                                formation, fzts[i], a, b);
                             formation.addFlowZone(zone);
                         }
                         state = State.LINE_6;

http://dive4elements.wald.intevation.org