Mercurial > mxd2map
diff src/java/de/intevation/mxd/writer/MapScriptWriter.java @ 106:609c234e8e23
merged with reimunds changes
author | Stephan Holl <stephan.holl@intevation.de> |
---|---|
date | Tue, 07 Jun 2011 15:50:43 +0200 |
parents | 4696d0769f9c |
children | d6d2a4058ebf |
line wrap: on
line diff
--- a/src/java/de/intevation/mxd/writer/MapScriptWriter.java Tue Jun 07 13:53:48 2011 +0200 +++ b/src/java/de/intevation/mxd/writer/MapScriptWriter.java Tue Jun 07 15:50:43 2011 +0200 @@ -6,22 +6,16 @@ import org.w3c.dom.Element; import org.w3c.dom.NodeList; +import java.io.File; + import javax.xml.xpath.XPathConstants; -import java.awt.Color; import edu.umn.gis.mapscript.mapObj; import edu.umn.gis.mapscript.layerObj; import edu.umn.gis.mapscript.classObj; -import edu.umn.gis.mapscript.styleObj; -import edu.umn.gis.mapscript.colorObj; -import edu.umn.gis.mapscript.symbolObj; -import edu.umn.gis.mapscript.symbolSetObj; -import edu.umn.gis.mapscript.lineObj; -import edu.umn.gis.mapscript.pointObj; import edu.umn.gis.mapscript.MS_UNITS; import edu.umn.gis.mapscript.MS_LAYER_TYPE; -import edu.umn.gis.mapscript.MS_SYMBOL_TYPE; import de.intevation.mxd.utils.XMLUtils; @@ -179,9 +173,18 @@ 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")); + String datasource = ""; + if(layerElement.hasAttribute("workspace")) { + datasource = layerElement.getAttribute("workspace"); + datasource += File.separator; + } + datasource += layerElement.getAttribute("data_source"); + layer.setData(datasource); //Write classes. writeClass(layer, layerElement); @@ -220,20 +223,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); -// LineStyleWriter swriter = new LineStyleWriter (this.map, co); -// swriter.write (symbolElement); + else if(type.equals("line") && elem.getTagName().equals("symbol")) { + LineStyleWriter swriter = new LineStyleWriter (this.map, co); + swriter.write (elem); + } + else if(type.equals("polygon") && elem.getTagName().equals("symbol")) { + FillStyleWriter swriter = new FillStyleWriter (this.map, co); + swriter.write (elem); } } }