[Dive4elements-commits] [PATCH 05 of 10] DA66Parser: Handle coding convention that was introduced to overcome fixed

Wald Commits scm-commit at wald.intevation.org
Thu Jan 3 10:16:21 CET 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1357203442 -3600
# Node ID 0b60b77d4d00170a389955c643b75bfa53a8c44b
# Parent  c10103dc202f0c04eaa631c39993550a07f7a92c
DA66Parser: Handle coding convention that was introduced to overcome fixed
length fields.

diff -r c10103dc202f -r 0b60b77d4d00 flys-backend/src/main/java/de/intevation/flys/importer/parsers/DA66Parser.java
--- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/DA66Parser.java	Thu Jan 03 09:56:43 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/DA66Parser.java	Thu Jan 03 09:57:22 2013 +0100
@@ -252,6 +252,42 @@
         }
     }
 
+    /** Apply the convention how to deal with numbers < -99.999 .*/
+    private String applyLetterConvention(String orig) {
+        if (orig.endsWith("-")) {
+            return "-" + orig.replace("-","");
+        }
+        else if (orig.endsWith("J")) {
+            return "-" + orig.replace("J","1");
+        }
+        else if (orig.endsWith("K")) {
+            return "-" + orig.replace("K","2");
+        }
+        else if (orig.endsWith("L")) {
+            return "-" + orig.replace("L","3");
+        }
+        else if (orig.endsWith("M")) {
+            return "-" + orig.replace("M","4");
+        }
+        else if (orig.endsWith("N")) {
+            return "-" + orig.replace("N","5");
+        }
+        else if (orig.endsWith("O")) {
+            return "-" + orig.replace("O","6");
+        }
+        else if (orig.endsWith("P")) {
+            return "-" + orig.replace("P","7");
+        }
+        else if (orig.endsWith("Q")) {
+            return "-" + orig.replace("Q","8");
+        }
+        else if (orig.endsWith("R")) {
+            return "-" + orig.replace("R","9");
+        }
+        else {
+            return orig;
+        }
+    }
 
     /**
      * Add a Point (YZ,Index) to the current cross section line.
@@ -269,6 +305,8 @@
 
         double iy;
         double iz;
+        // Handle letter convention.
+        y = applyLetterConvention(y);
         try {
             iy = Double.parseDouble(y) / 1000d;
             iz = Double.parseDouble(z) / 1000d;


More information about the Dive4elements-commits mailing list