Mercurial > mxd2map
diff src/java/de/intevation/mxd/writer/FillStyleWriter.java @ 251:6b80e46b8f38
Added picture symbol support to the converter.
author | raimund renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 12 Aug 2011 16:08:57 +0200 |
parents | df4e0946ef02 |
children | 2cb2f26d0d54 |
line wrap: on
line diff
--- a/src/java/de/intevation/mxd/writer/FillStyleWriter.java Fri Aug 12 09:15:34 2011 +0200 +++ b/src/java/de/intevation/mxd/writer/FillStyleWriter.java Fri Aug 12 16:08:57 2011 +0200 @@ -77,7 +77,7 @@ * @param symbolElement DOM element containing style attributes. */ public boolean write(Element symbolElement) { - logger.debug("write()Element"); + logger.debug("write(Element)"); symbolSetObj symbolSet = map.getSymbolset(); if(symbolElement.hasChildNodes()) { @@ -85,7 +85,6 @@ for (int i = 0; i < symbols.getLength(); i++) { Element nextSym = (Element)symbols.item(i); String type = nextSym.getAttribute("type"); - if(((symbols.getLength() > 1 && i == 0) || (symbols.getLength() == 1 && !symbolElement.hasAttribute("hatch"))) && @@ -101,14 +100,41 @@ } writeOutline(nextSym); if (symbols.getLength() == 1) { - writeSimple(symbolElement); - } - try { - SymbolWriter sw = new SymbolWriter(this.map, this.cl); - sw.saveSymbolSet(symbolSet); - } - catch(Exception e) { - logger.warn("Could not save symbol set."); + String stype = symbolElement.getAttribute("style"); + if(stype.equals("picture")) { + double gap = 0; + if(symbolElement.hasAttribute("xseparation")) { + try { + gap = Double.parseDouble( + symbolElement.getAttribute("xseparation")); + } + catch(NumberFormatException nfe) { + gap = 0; + } + } + + try { + SymbolWriter sw = + new SymbolWriter(this.map, this.cl); + sw.write(symbolElement); + sw.saveSymbolSet(symbolSet); + } + catch(Exception e) { + logger.warn("Could not save symbol set."); + } + writeMarker(symbolElement, gap); + } + else { + writeSimple(symbolElement); + try { + SymbolWriter sw = + new SymbolWriter(this.map, this.cl); + sw.saveSymbolSet(symbolSet); + } + catch(Exception e) { + logger.warn("Could not save symbol set."); + } + } } } else if(nextSym.getTagName().equals("symbol") && @@ -148,7 +174,8 @@ else { writeSimple(symbolElement); try { - SymbolWriter sw = new SymbolWriter(this.map, this.cl); + SymbolWriter sw = + new SymbolWriter(this.map, this.cl); sw.saveSymbolSet(symbolSet); } catch(Exception e) { @@ -318,6 +345,7 @@ logger.debug("writeMarker()"); String name = symbolElement.getAttribute("name"); String type = symbolElement.getAttribute("type"); + String stype = symbolElement.getAttribute("style"); if (symbolElement.hasAttribute("angle")) { try { style.setAngle( @@ -416,6 +444,9 @@ } } } + if(stype.equals("picture")) { + style.setSymbolByName(map, name); + } } /**