Mercurial > mxd2map
diff src/java/de/intevation/mxd/writer/MapScriptWriter.java @ 97:18e4f143896b
Added polygon writer.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Mon, 06 Jun 2011 17:24:43 +0200 |
parents | c285ed08b72c |
children | 4696d0769f9c |
line wrap: on
line diff
--- a/src/java/de/intevation/mxd/writer/MapScriptWriter.java Wed Jun 01 14:21:24 2011 +0200 +++ b/src/java/de/intevation/mxd/writer/MapScriptWriter.java Mon Jun 06 17:24:43 2011 +0200 @@ -171,6 +171,9 @@ else if (type.equals("line")) { layer.setType(MS_LAYER_TYPE.MS_LAYER_LINE); } + else if (type.equals("polygon")) { + layer.setType(MS_LAYER_TYPE.MS_LAYER_POLYGON); + } //The layer datasource. layer.setData(layerElement.getAttribute("data_source")); @@ -212,20 +215,22 @@ co.setExpression(exp); } //Write symbols and styles. - NodeList slist = classElement.getElementsByTagName("symbol"); - String type = layerElement.getAttribute("type"); - if(type.equals("point")) { - for(int j = 0; j < slist.getLength(); j++){ - Element symbolElement = (Element) slist.item(j); + NodeList l = classElement.getChildNodes(); + for (int j = 0; j < l.getLength(); j++) { + Element elem = (Element)l.item(j); + + String type = layerElement.getAttribute("type"); + if(type.equals("point") && elem.getTagName().equals("symbol")) { MarkerStyleWriter swriter = new MarkerStyleWriter (this.map, co); - swriter.write (symbolElement); + swriter.write (elem); } - } - else if(type.equals("line")) { - for(int j = 0; j < slist.getLength(); j++){ - Element symbolElement = (Element) slist.item(j); + else if(type.equals("line") && elem.getTagName().equals("symbol")) { LineStyleWriter swriter = new LineStyleWriter (this.map, co); - swriter.write (symbolElement); + swriter.write (elem); + } + else if(type.equals("polygon") && elem.getTagName().equals("symbol")) { + FillStyleWriter swriter = new FillStyleWriter (this.map, co); + swriter.write (elem); } } }