Mercurial > mxd2map
changeset 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 (2011-06-20) |
parents | ff0354265a7d |
children | 1616622a8c8d |
files | ChangeLog src/java/de/intevation/mxd/writer/MapScriptWriter.java |
diffstat | 2 files changed, 26 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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 <raimund.renkert@intevation.de> + + * src/java/de/intevation/mxd/writer/MapScriptWriter.java: + Write expressions for string values to the mapfile. + 2011-06-17 Raimund Renkert <raimund.renkert@intevation.de> Write the correct expression for double values.
--- 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; + } }