comparison flys-backend/src/main/java/de/intevation/flys/importer/parsers/DA66Parser.java @ 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 c3e2b0d343dc
comparison
equal deleted inserted replaced
4719:7a8d3ec7abbc 4720:9f7cd65daac2
243 XY lastPoint = this.currentLine.get(currentLine.size()-1); 243 XY lastPoint = this.currentLine.get(currentLine.size()-1);
244 return lastPoint.getIndex(); 244 return lastPoint.getIndex();
245 } 245 }
246 246
247 247
248 /** Returns station, deciding if it could in cm, in which case convert. */
249 private double stationInKm(double station) {
250 if (station > 10000) {
251 return station/100000d;
252 }
253 else {
254 return station;
255 }
256 }
257
258
248 /** 259 /**
249 * Add a Point (YZ,Index) to the current cross section line. 260 * Add a Point (YZ,Index) to the current cross section line.
250 * @param y The y coordinate of new point. 261 * @param y The y coordinate of new point.
251 * @param z The z coordinate of new point. 262 * @param z The z coordinate of new point.
252 * @param idx Ignored, the parameter of new point. 263 * @param idx Ignored, the parameter of new point.
301 //logger.debug("New station"); 312 //logger.debug("New station");
302 Matcher m = LINE_PATTERN.matcher(line); 313 Matcher m = LINE_PATTERN.matcher(line);
303 if (m.find()) { 314 if (m.find()) {
304 // Actually matches! 315 // Actually matches!
305 currentLine = new ArrayList<XY>(); 316 currentLine = new ArrayList<XY>();
306 data.put(Double.parseDouble(m.group(FIELD.STATION.getIdx())), 317 double station = stationInKm(Double.parseDouble(m.group(FIELD.STATION.getIdx())));
307 currentLine); 318 data.put(station, currentLine);
308 } 319 }
309 else { 320 else {
310 logger.error("HEAD line bad."); 321 logger.error("HEAD line bad.");
311 } 322 }
312 } 323 }

http://dive4elements.wald.intevation.org