changeset 4750:60398ab6129a

W80Parser: Actually add points while parsing w80 file.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 03 Jan 2013 10:00:13 +0100
parents 3028037c6293
children ee6c0f246b28
files flys-backend/src/main/java/de/intevation/flys/importer/parsers/W80Parser.java
diffstat 1 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/W80Parser.java	Thu Jan 03 09:59:41 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/W80Parser.java	Thu Jan 03 10:00:13 2013 +0100
@@ -188,6 +188,9 @@
     @Override
     protected void handleLine(int lineNum, String line) {
         String pointId = line.substring(0,20);
+        String station = line.substring(9,16);
+        String pointIndex = line.substring(16,21);
+        // For GK, first seven digits are of interest.
         String gkRight = line.substring(20,30);
         String gkHigh  = line.substring(30,40);
         String date    = line.substring(40,46);
@@ -199,6 +202,21 @@
         String dateDec = line.substring(64,70);
         String note    = line.substring(70,78);
         String actual  = line.substring(78);
+        double stationKm = Double.parseDouble(station) / 1000d;
+        double gkRightKm = Double.parseDouble(gkRight.substring(0,7));
+        double gkHighKm  = Double.parseDouble(gkHigh.substring(0,7));
+        double heightM   = Double.parseDouble(height);
+
+        // New (or first) line.
+        if (anchor == null || anchor.getStation() != stationKm) {
+            this.anchor = new Anchor(new Coordinate(gkRightKm, gkHighKm, heightM), stationKm);
+            currentLine = new ArrayList<XY>();
+            data.put(stationKm, currentLine);
+            currentLine.add(new XY(0d, heightM,0));
+        }
+        else {
+            addPoint(gkRightKm, gkHighKm, heightM, pointIndex);
+        }
     }
 
 

http://dive4elements.wald.intevation.org