changeset 4720:9f7cd65daac2

DA66Parser: Try to guess whether station is given in km or in cm.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 27 Dec 2012 13:13:24 +0100
parents 7a8d3ec7abbc
children b0b1008c07e9
files flys-backend/src/main/java/de/intevation/flys/importer/parsers/DA66Parser.java
diffstat 1 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/DA66Parser.java	Thu Dec 27 13:13:05 2012 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/DA66Parser.java	Thu Dec 27 13:13:24 2012 +0100
@@ -245,6 +245,17 @@
     }
 
 
+    /** Returns station, deciding if it could in cm, in which case convert. */
+    private double stationInKm(double station) {
+        if (station > 10000) {
+            return station/100000d;
+        }
+        else {
+            return station;
+        }
+    }
+
+
     /**
      * Add a Point (YZ,Index) to the current cross section line.
      * @param y The y coordinate of new point.
@@ -303,8 +314,8 @@
                 if (m.find()) {
                     // Actually matches!
                     currentLine = new ArrayList<XY>();
-                    data.put(Double.parseDouble(m.group(FIELD.STATION.getIdx())),
-                        currentLine);
+                    double station = stationInKm(Double.parseDouble(m.group(FIELD.STATION.getIdx())));
+                    data.put(station, currentLine);
                 }
                 else {
                     logger.error("HEAD line bad.");

http://dive4elements.wald.intevation.org