# HG changeset patch # User Sascha L. Teichmann # Date 1304606801 0 # Node ID 13af9318a4a2a2af4bf5d19fbe45ce7b396fc703 # Parent e960098b139894a052f64c5ffe6986b01c199115 Import "Hochwasser-Marken", too. flys-backend/trunk@1838 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r e960098b1398 -r 13af9318a4a2 flys-backend/ChangeLog --- a/flys-backend/ChangeLog Thu May 05 09:45:13 2011 +0000 +++ b/flys-backend/ChangeLog Thu May 05 14:46:41 2011 +0000 @@ -1,3 +1,11 @@ +2011-05-05 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: + Import 'Hochwasser-Marken', too. + + * src/main/java/de/intevation/flys/importer/WstParser.java: + Removed superfluous import. + 2011-05-05 Sascha L. Teichmann * src/main/java/de/intevation/flys/importer/WstParser.java: diff -r e960098b1398 -r 13af9318a4a2 flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java Thu May 05 09:45:13 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java Thu May 05 14:46:41 2011 +0000 @@ -33,6 +33,8 @@ public static final String OFFICIAL_LINES = "Amtl_Linien.wst"; + public static final String FLOOD_WATER = "HW-Marken"; + protected String name; protected File wstFile; @@ -49,6 +51,8 @@ protected List officialLines; + protected List floodWater; + protected ImportWst wst; protected River peer; @@ -57,6 +61,7 @@ extraWsts = new ArrayList(); fixations = new ArrayList(); officialLines = new ArrayList(); + floodWater = new ArrayList(); } public ImportRiver(String name, File wstFile, File bbInfoFile) { @@ -105,6 +110,44 @@ parseExtraWsts(); parseFixations(); parseOfficialLines(); + parseFloodWater(); + } + + public void parseFloodWater() throws IOException { + log.info("Parse flood water wst file"); + + File riverDir = wstFile.getParentFile().getParentFile(); + + File dir = FileTools.repair(new File(riverDir, FLOOD_WATER)); + + if (!dir.isDirectory() || !dir.canRead()) { + log.info("no directory '" + dir + "' found"); + return; + } + + File [] files = dir.listFiles(); + + if (files == null) { + log.warn("cannot read '" + dir + "'"); + return; + } + + for (File file: files) { + if (!file.isFile() || !file.canRead()) { + continue; + } + String name = file.getName().toLowerCase(); + if (!(name.endsWith(".zus") || name.endsWith(".wst"))) { + continue; + } + log.info("found file '" + file.getName() + "'"); + WstParser wstParser = new WstParser(); + wstParser.parse(file); + ImportWst iw = wstParser.getWst(); + iw.setKind(4); + iw.setDescription(FLOOD_WATER + "/" + iw.getDescription()); + floodWater.add(iw); + } } public void parseOfficialLines() throws IOException { @@ -171,7 +214,7 @@ wstParser.parse(file); ImportWst iw = wstParser.getWst(); iw.setKind(2); - iw.setDescription("Fix: " + iw.getDescription()); + iw.setDescription(FIXATIONS+ "/" + iw.getDescription()); fixations.add(iw); } } @@ -255,6 +298,7 @@ storeExtraWsts(); storeFixations(); storeOfficialLines(); + storeFloodWater(); } public void storeWst() { @@ -289,6 +333,15 @@ } } + public void storeFloodWater() { + log.info("store flood water wsts"); + River river = getPeer(); + for (ImportWst wst: floodWater) { + log.debug("name: " + wst.getDescription()); + wst.storeDependencies(river); + } + } + public void storeAnnotations() { River river = getPeer(); for (ImportAnnotation annotation: annotations) { diff -r e960098b1398 -r 13af9318a4a2 flys-backend/src/main/java/de/intevation/flys/importer/WstParser.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/WstParser.java Thu May 05 09:45:13 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/WstParser.java Thu May 05 14:46:41 2011 +0000 @@ -1,7 +1,6 @@ package de.intevation.flys.importer; import java.util.ArrayList; -import java.util.HashMap; import java.util.HashSet; import java.io.File;