Mercurial > dive4elements > river
changeset 490:13af9318a4a2
Import "Hochwasser-Marken", too.
flys-backend/trunk@1838 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 05 May 2011 14:46:41 +0000 |
parents | e960098b1398 |
children | 738140fe56fe |
files | flys-backend/ChangeLog flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java flys-backend/src/main/java/de/intevation/flys/importer/WstParser.java |
diffstat | 3 files changed, 62 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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 <sascha.teichmann@intevation.de> + + * 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 <sascha.teichmann@intevation.de> * src/main/java/de/intevation/flys/importer/WstParser.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<ImportWst> officialLines; + protected List<ImportWst> floodWater; + protected ImportWst wst; protected River peer; @@ -57,6 +61,7 @@ extraWsts = new ArrayList<ImportWst>(); fixations = new ArrayList<ImportWst>(); officialLines = new ArrayList<ImportWst>(); + floodWater = new ArrayList<ImportWst>(); } 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) {
--- 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;