Mercurial > mxd2map
diff src/java/de/intevation/mxd/writer/SymbolWriter.java @ 106:609c234e8e23
merged with reimunds changes
author | Stephan Holl <stephan.holl@intevation.de> |
---|---|
date | Tue, 07 Jun 2011 15:50:43 +0200 |
parents | 18e4f143896b |
children | 11d63bf00326 |
line wrap: on
line diff
--- a/src/java/de/intevation/mxd/writer/SymbolWriter.java Tue Jun 07 13:53:48 2011 +0200 +++ b/src/java/de/intevation/mxd/writer/SymbolWriter.java Tue Jun 07 15:50:43 2011 +0200 @@ -1,10 +1,6 @@ package de.intevation.mxd.writer; import org.apache.log4j.Logger; -import java.io.File; -import java.io.FileInputStream; -import java.io.BufferedInputStream; -import java.util.Properties; import org.w3c.dom.Element; @@ -50,8 +46,8 @@ String name = symbolElement.getAttribute("name"); symbolObj sym = symbolSet.getSymbolByName(name); - String symType = symbolElement.getAttribute("style"); + String type = symbolElement.getAttribute("type"); if(symType.equals("point")) { writeSimple(sym); } @@ -62,6 +58,9 @@ //TODO Does not work at all... waiting for fix. writeCharacter(sym, symbolElement); } + else if (type.equals("line")) { + writeHatch(sym); + } else { return false; } @@ -99,16 +98,25 @@ private void writeCharacter(symbolObj symbol, Element symbolElement) { logger.debug("writeCharacter(symbolObj, Element)"); //TODO Write the symbol correctly. See Issue 3885 on trac.osgeo.org - symbol.setFont(symbolElement.getAttribute("font")); + String font = symbolElement.getAttribute("font"); + //Remove all blank character to match the mapserver fonts.txt. + font = font.replaceAll(" ", ""); + symbol.setFont(font); symbol.setType(MS_SYMBOL_TYPE.MS_SYMBOL_TRUETYPE.swigValue()); symbol.setAntialias(1); - symbol.setCharacter("#&" + symbolElement.getAttribute("char") + ";"); + symbol.setCharacter("&#" + symbolElement.getAttribute("char") + ";"); + } + + private void writeHatch(symbolObj symbol) { + logger.debug("writeHatch(symbolObj)"); + symbol.setType(MS_SYMBOL_TYPE.MS_SYMBOL_HATCH.swigValue()); } public boolean canWrite(String type) { if (type.equals("point") || type.equals("arrow") || - type.equals("char")) { + type.equals("char") || + type.equals("line")) { return true; } else { @@ -118,12 +126,12 @@ private void saveSymbolSet(symbolSetObj symbols) throws Exception { - String path = "";// TODO Get the correct path. Mapfile path or symbolset path + String path = this.map.getMappath(); if(path.equals("")) { return; } - else if(path.endsWith(".map")) { - path.replace(".map", ".sym"); + else { + path += "symbols.sym"; } symbols.save(path); }