# HG changeset patch # User Felix Wolfsteller # Date 1357203613 -3600 # Node ID 60398ab6129a4951ea3c60d7c6b5716d277dfccc # Parent 3028037c6293c0652a0329624581c055f21aab7a W80Parser: Actually add points while parsing w80 file. diff -r 3028037c6293 -r 60398ab6129a flys-backend/src/main/java/de/intevation/flys/importer/parsers/W80Parser.java --- 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(); + data.put(stationKm, currentLine); + currentLine.add(new XY(0d, heightM,0)); + } + else { + addPoint(gkRightKm, gkHighKm, heightM, pointIndex); + } }