diff src/java/de/intevation/mxd/writer/MapScriptWriter.java @ 127:5ba8bf865dc7

Write expressions for string values to the mapfile.
author Raimund Renkert <rrenkert@intevation.de>
date Mon, 20 Jun 2011 11:35:40 +0200
parents ff0354265a7d
children 1616622a8c8d
line wrap: on
line diff
--- a/src/java/de/intevation/mxd/writer/MapScriptWriter.java	Fri Jun 17 18:22:40 2011 +0200
+++ b/src/java/de/intevation/mxd/writer/MapScriptWriter.java	Mon Jun 20 11:35:40 2011 +0200
@@ -226,11 +226,14 @@
                 }
                 catch(Exception e) {
                     type = 2;
-                    logger.info("not a double");
                 }
                 if (type == 1) {
                     co.setExpression(createDoubleExpression(classElement, count));
                 }
+                else if (type == 2) {
+                    co.setExpression(createStringExpression(classElement, count));
+                }
+
             }
             //Write symbols and styles.
             NodeList l = classElement.getChildNodes();
@@ -286,7 +289,7 @@
                 }
             }
         }
-        else if (op.equals("==")) {
+        else if (op.equals("=")) {
             op1 = op;
             for(int j = 0; j < count; j++) {
                exp = "([" +
@@ -297,5 +300,21 @@
         }
         return exp;
     }
+
+    private String createStringExpression (Element classElement, int count) {
+        String exp = "";
+        String op = classElement.getAttribute("expression_operator");
+        if (op.equals("=")) {
+            for(int j = 0; j < count; j++) {
+                exp = "(\"[";
+                exp += classElement.getAttribute(
+                            "expression_field_" + j);
+                exp += "]\" " + op;
+                exp += " \"" + classElement.getAttribute("value");
+                exp += "\")";
+            }
+        }
+        return exp;
+    }
 }
 
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)