changeset 4767:03246a8b3869

ImportRiver: Added w80 and hook for da50 parsing (not implemented).
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 04 Jan 2013 11:17:40 +0100
parents 655e86f025c1
children 99f9e371371b
files flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java
diffstat 1 files changed, 46 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java	Fri Jan 04 11:16:50 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java	Fri Jan 04 11:17:40 2013 +0100
@@ -34,6 +34,7 @@
 import de.intevation.flys.importer.parsers.SQRelationParser;
 import de.intevation.flys.importer.parsers.SedimentDensityParser;
 import de.intevation.flys.importer.parsers.SedimentYieldParser;
+import de.intevation.flys.importer.parsers.W80Parser;
 import de.intevation.flys.importer.parsers.WaterlevelDifferencesParser;
 import de.intevation.flys.importer.parsers.WaterlevelParser;
 import de.intevation.flys.importer.parsers.WstParser;
@@ -229,6 +230,8 @@
         parseAnnotations();
         parsePRFs();
         parseDA66s();
+        parseDA50s();
+        parseW80s();
         parseHYKs();
         parseWst();
         parseExtraWsts();
@@ -911,6 +914,48 @@
             ImportRiver.this, description, ti, lines));
     }
 
+    /** Create a W80 Parser and parse w80 files found. */
+    public void parseW80s() {
+        if (Config.INSTANCE.skipW80s()) {
+            log.info("skip parsing W80s");
+        }
+        W80Parser parser = new W80Parser();
+        File riverDir = wstFile
+            .getParentFile()  // Basisdaten
+            .getParentFile()  // Hydrologie
+            .getParentFile(); // <river>
+
+        // TODO this can probably be further merged with implementation for PRF parser.
+        parser.parseW80s(riverDir, new CrossSectionParser.Callback() {
+
+            Set<HashedFile> w80s = new HashSet<HashedFile>();
+
+            @Override
+            public boolean accept(File file) {
+                HashedFile hf = new HashedFile(file);
+                boolean success = w80s.add(hf);
+                if (!success) {
+                    log.warn("W80 file '" + file + "' seems to be a duplicate.");
+                }
+                return success;
+            }
+
+            @Override
+            public void parsed(CrossSectionParser parser) {
+                log.debug("callback from W80 parser");
+
+                addCrossSections(parser);
+            }
+        });
+    }
+
+    public void parseDA50s() {
+        if (Config.INSTANCE.skipDA50s()) {
+            log.info("skip parsing DA50s");
+        }
+        else log.warn("DA50 parsing not yet implemented");
+    }
+
 
     /** Create a DA66 Parser and parse the da66 files found. */
     // TODO this is a copy of parsePRFs, extract interfaces (e.g. CrossSectionParser).
@@ -1040,7 +1085,7 @@
     }
 
     public void storeCrossSections() {
-        if (!Config.INSTANCE.skipPRFs() || !Config.INSTANCE.skipDA66s()) {
+        if (!Config.INSTANCE.skipPRFs() || !Config.INSTANCE.skipDA66s() || !Config.INSTANCE.skipDA50s() || !Config.INSTANCE.skipW80s()) {
             log.info("store cross sections");
             getPeer();
             for (ImportCrossSection crossSection: crossSections) {

http://dive4elements.wald.intevation.org