# HG changeset patch # User Raimund Renkert # Date 1308562540 -7200 # Node ID 5ba8bf865dc769a1d7e5bd8abc8ddacc260cb8c2 # Parent ff0354265a7d64daf78259978f01f06d0c10ac74 Write expressions for string values to the mapfile. diff -r ff0354265a7d -r 5ba8bf865dc7 ChangeLog --- a/ChangeLog Fri Jun 17 18:22:40 2011 +0200 +++ b/ChangeLog Mon Jun 20 11:35:40 2011 +0200 @@ -1,3 +1,8 @@ +2011-06-20 Raimund Renkert + + * src/java/de/intevation/mxd/writer/MapScriptWriter.java: + Write expressions for string values to the mapfile. + 2011-06-17 Raimund Renkert Write the correct expression for double values. diff -r ff0354265a7d -r 5ba8bf865dc7 src/java/de/intevation/mxd/writer/MapScriptWriter.java --- 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; + } }