comparison backend/src/main/java/org/dive4elements/river/importer/parsers/BedHeightParser.java @ 8561:2b3c8ea6cbee

Accept more elevation system names (e.g. with hyphen).
author "Tom Gottfried <tom@intevation.de>"
date Mon, 16 Feb 2015 12:12:12 +0100
parents 6fcf4717605f
children 1f878c82262f
comparison
equal deleted inserted replaced
8560:6fcf4717605f 8561:2b3c8ea6cbee
67 67
68 public static final Pattern META_LOCATION_SYSTEM = 68 public static final Pattern META_LOCATION_SYSTEM =
69 Pattern.compile("^Lagesystem: (.*).*"); 69 Pattern.compile("^Lagesystem: (.*).*");
70 70
71 public static final Pattern META_CUR_ELEVATION_SYSTEM = 71 public static final Pattern META_CUR_ELEVATION_SYSTEM =
72 Pattern.compile("^H.hensystem:\\s(\\w++) (.* )??\\[(.*)\\].*"); 72 Pattern.compile("^H.hensystem:\\s(.*)?? \\[(.*)\\].*");
73 73
74 public static final Pattern META_OLD_ELEVATION_SYSTEM = 74 public static final Pattern META_OLD_ELEVATION_SYSTEM =
75 Pattern.compile("^urspr.ngliches H.hensystem:\\s(\\w++) (.* )??\\[(.*)\\].*"); 75 Pattern.compile("^urspr.ngliches H.hensystem:\\s(.*)?? \\[(.*)\\].*");
76 76
77 public static final Pattern META_RANGE = 77 public static final Pattern META_RANGE =
78 Pattern.compile("^Strecke:\\D*(\\d++.?\\d*) ?- ?(\\d++.?\\d*).*"); 78 Pattern.compile("^Strecke:\\D*(\\d++.?\\d*) ?- ?(\\d++.?\\d*).*");
79 79
80 public static final Pattern META_EVALUATION_BY = 80 public static final Pattern META_EVALUATION_BY =
346 ) { 346 ) {
347 Matcher m = META_CUR_ELEVATION_SYSTEM.matcher(line); 347 Matcher m = META_CUR_ELEVATION_SYSTEM.matcher(line);
348 348
349 if (m.matches()) { 349 if (m.matches()) {
350 String name = m.group(1); 350 String name = m.group(1);
351 String num = m.group(2); 351 String unit = m.group(2);
352 String unit = m.group(3);
353 352
354 obj.setCurElevationModel(new ImportElevationModel( 353 obj.setCurElevationModel(new ImportElevationModel(
355 name + " " + num, 354 name,
356 new ImportUnit(unit) 355 new ImportUnit(unit)
357 )); 356 ));
358 357
359 return true; 358 return true;
360 } 359 }
369 ) { 368 ) {
370 Matcher m = META_OLD_ELEVATION_SYSTEM.matcher(line); 369 Matcher m = META_OLD_ELEVATION_SYSTEM.matcher(line);
371 370
372 if (m.matches()) { 371 if (m.matches()) {
373 String name = m.group(1); 372 String name = m.group(1);
374 String num = m.group(2); 373 String unit = m.group(2);
375 String unit = m.group(3);
376 374
377 obj.setOldElevationModel(new ImportElevationModel( 375 obj.setOldElevationModel(new ImportElevationModel(
378 name + " " + num, 376 name,
379 new ImportUnit(unit) 377 new ImportUnit(unit)
380 )); 378 ));
381 379
382 return true; 380 return true;
383 } 381 }

http://dive4elements.wald.intevation.org