Mercurial > dive4elements > river
changeset 484:a9e9a8a44d19
Parse and store "amtliche Linien" wst files.
flys-backend/trunk@1807 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 03 May 2011 14:18:43 +0000 |
parents | f1fd9cab6a07 |
children | 6b231041dc18 |
files | flys-backend/ChangeLog flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java |
diffstat | 2 files changed, 58 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-backend/ChangeLog Tue May 03 13:50:37 2011 +0000 +++ b/flys-backend/ChangeLog Tue May 03 14:18:43 2011 +0000 @@ -1,3 +1,8 @@ +2011-05-03 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: + Parse and store "amtliche Linien" wst files. + 2011-05-03 Sascha L. Teichmann <sascha.teichmann@intevation.de> * src/main/java/de/intevation/flys/importer/ImportRiver.java:
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java Tue May 03 13:50:37 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java Tue May 03 14:18:43 2011 +0000 @@ -26,6 +26,13 @@ public static final String EXTRA_LONGITUDINALS = "Zus.L\u00e4ngsschnitte"; + public static final String [] OFFICIAL_LINES_FOLDERS = { + "Basisdaten", + "Fixierungen" }; + + public static final String OFFICIAL_LINES = + "Amtl_Linien.wst"; + protected String name; protected File wstFile; @@ -40,13 +47,16 @@ protected List<ImportWst> fixations; + protected List<ImportWst> officialLines; + protected ImportWst wst; protected River peer; public ImportRiver() { - extraWsts = new ArrayList<ImportWst>(); - fixations = new ArrayList<ImportWst>(); + extraWsts = new ArrayList<ImportWst>(); + fixations = new ArrayList<ImportWst>(); + officialLines = new ArrayList<ImportWst>(); } public ImportRiver(String name, File wstFile, File bbInfoFile) { @@ -94,6 +104,37 @@ parseWst(); parseExtraWsts(); parseFixations(); + parseOfficialLines(); + } + + public void parseOfficialLines() throws IOException { + log.info("Parse official wst files"); + + File riverDir = wstFile.getParentFile().getParentFile(); + + for (String folder: OFFICIAL_LINES_FOLDERS) { + File dir = FileTools.repair(new File(riverDir, folder)); + + if (!dir.isDirectory() || !dir.canRead()) { + log.info("no directory '" + folder + "' found"); + continue; + } + + File file = FileTools.repair(new File(dir, OFFICIAL_LINES)); + if (!file.isFile() || !file.canRead()) { + log.warn("no official lines wst file found"); + continue; + } + log.debug("Found WST file: " + file); + + WstParser wstParser = new WstParser(); + wstParser.parse(file); + ImportWst iw = wstParser.getWst(); + iw.setKind(3); + iw.setDescription(folder + "/" + iw.getDescription()); + officialLines.add(iw); + } // for all folders + } public void parseFixations() throws IOException { @@ -213,6 +254,7 @@ storeWst(); storeExtraWsts(); storeFixations(); + storeOfficialLines(); } public void storeWst() { @@ -238,6 +280,15 @@ } } + public void storeOfficialLines() { + log.info("store official lines wsts"); + River river = getPeer(); + for (ImportWst wst: officialLines) { + log.debug("name: " + wst.getDescription()); + wst.storeDependencies(river); + } + } + public void storeAnnotations() { River river = getPeer(); for (ImportAnnotation annotation: annotations) {