[Dive4elements-commits] [PATCH 13 of 13] ImportRiver: Added w80 and hook for da50 parsing (not implemented)

Wald Commits scm-commit at wald.intevation.org
Fri Jan 4 11:12:52 CET 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1357294660 -3600
# Node ID 03246a8b3869a9b1b0e4974be3bb6e265f2efaed
# Parent  655e86f025c10592ccd635bb9cdb67844fd3559d
ImportRiver: Added w80 and hook for da50 parsing (not implemented).

diff -r 655e86f025c1 -r 03246a8b3869 flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java
--- 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) {


More information about the Dive4elements-commits mailing list