changeset 6015:e514cab94026

PRFParser: Re-enable line skipping. Act so on station change.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Mon, 13 May 2013 18:33:01 +0200
parents 2132c4b70cf9
children d24d29d9efa7
files backend/src/main/java/org/dive4elements/river/importer/parsers/PRFParser.java
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/PRFParser.java	Mon May 13 17:58:17 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/PRFParser.java	Mon May 13 18:33:01 2013 +0200
@@ -342,7 +342,15 @@
                 return false;
             }
 
+            int skip = lineSkipCount;
+
             while ((line = in.readLine()) != null) {
+                // Expecting dummy lines.
+                if (skip > 0) {
+                    skip--;
+                    continue;
+                }
+
                 double km;
                 try {
                     km = kmFormat.extractKm(line);
@@ -356,10 +364,14 @@
 
                 List<XY> kmData = data.get(station);
 
+                // When the station changed we know we are expecting skip/dummy lines.
                 if (kmData == null) {
                     //log.debug("found new km: " + station);
                     kmData = new ArrayList<XY>();
                     data.put(station, kmData);
+                    // When a station change occurs, dummy lines will occur, too.
+                    skip = lineSkipCount;
+                    continue;
                 }
 
                 dataFormat.extractData(line, kmData);

http://dive4elements.wald.intevation.org