# HG changeset patch # User Raimund Renkert # Date 1306921973 -7200 # Node ID 273e49f51cfb1678b04beedf7152e4df1ff536bd # Parent 3993b5adf67c4103193e11716bf8c86877a13a94# Parent 39fe778ab9f46f0f403769620b06e8ae5cb98d8c Merged with Stephans commit. diff -r 39fe778ab9f4 -r 273e49f51cfb ChangeLog --- a/ChangeLog Wed Jun 01 11:34:25 2011 +0200 +++ b/ChangeLog Wed Jun 01 11:52:53 2011 +0200 @@ -1,3 +1,12 @@ +2011-06-01 Raimund Renkert + + * src/java/de/intevation/mxd/reader/CharacterMarkerSymbolReader.java: + Read and convert the symbol color and convert to integer. + + * src/java/de/intevation/mxd/writer/SymbolWriter.java: + Set the correct character and font string. Save the symbolset to the + mapfile path. + 2011-06-01 Stephan Holl * M ttf-fonts/fonts.txt: Added a more verbose comment for removing diff -r 39fe778ab9f4 -r 273e49f51cfb src/java/de/intevation/mxd/reader/CharacterMarkerSymbolReader.java --- a/src/java/de/intevation/mxd/reader/CharacterMarkerSymbolReader.java Wed Jun 01 11:34:25 2011 +0200 +++ b/src/java/de/intevation/mxd/reader/CharacterMarkerSymbolReader.java Wed Jun 01 11:52:53 2011 +0200 @@ -7,8 +7,12 @@ import com.esri.arcgis.display.CharacterMarkerSymbol; import com.esri.arcgis.display.IColor; import com.esri.arcgis.support.ms.stdole.Font; +import com.esri.arcgis.display.IRgbColor; +import com.esri.arcgis.display.RgbColor; + import org.w3c.dom.Element; +import java.awt.Color; /** * Reads character marker symbol information. @@ -61,7 +65,6 @@ logger.debug("read()"); Element symbolElement = util.addSymbol(parent); - IColor c = symbol.getColor(); symbolElement.setAttribute( "angle", String.valueOf(symbol.getAngle())); @@ -75,18 +78,34 @@ "y_offset", String.valueOf(symbol.getYOffset())); symbolElement.setAttribute( - "color", - String.valueOf(c.getRGB())); - symbolElement.setAttribute( - "tranparency", - String.valueOf(c.getTransparency())); - symbolElement.setAttribute( "name", symbol.getNameString()); symbolElement.setAttribute( "char", String.valueOf(symbol.getCharacterIndex())); + if(symbol.getColor() instanceof IRgbColor) { + IRgbColor color = (IRgbColor)symbol.getColor(); + Color c = new Color ( + color.getRed(), + color.getGreen(), + color.getBlue()); + symbolElement.setAttribute("color", String.valueOf(c.getRGB())); + symbolElement.setAttribute("transparency", + String.valueOf(color.getTransparency())); + } + else { + RgbColor col = new RgbColor(); + col.setRGB(symbol.getColor().getRGB()); + Color c = new Color ( + col.getRed(), + col.getGreen(), + col.getBlue()); + symbolElement.setAttribute("color", String.valueOf(c.getRGB())); + symbolElement.setAttribute("transparency", + String.valueOf(col.getTransparency())); + } + Font f = symbol.getFont(); symbolElement.setAttribute("font", f.getName()); symbolElement.setAttribute("char_set", String.valueOf(f.getCharset())); diff -r 39fe778ab9f4 -r 273e49f51cfb src/java/de/intevation/mxd/writer/SymbolWriter.java --- a/src/java/de/intevation/mxd/writer/SymbolWriter.java Wed Jun 01 11:34:25 2011 +0200 +++ b/src/java/de/intevation/mxd/writer/SymbolWriter.java Wed Jun 01 11:52:53 2011 +0200 @@ -99,10 +99,13 @@ 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") + ";"); } public boolean canWrite(String type) { @@ -118,12 +121,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); }