Mercurial > mxd2map
changeset 49:0fecdcc28b1b
Created one method for each symbol type in the writer.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Wed, 20 Apr 2011 11:56:35 +0200 (2011-04-20) |
parents | 8e6d529e9a22 |
children | 50a6d2d63885 |
files | ChangeLog src/java/de/intevation/mxd/writer/MapScriptWriter.java |
diffstat | 2 files changed, 60 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Apr 20 11:48:46 2011 +0200 +++ b/ChangeLog Wed Apr 20 11:56:35 2011 +0200 @@ -1,3 +1,9 @@ +2011-04-20 Raimund Renkert <raimund.renkert@intevation.de> + + * src/java/de/intevation/mxd/writer/MapScriptWriter.java: + Created one method for each symbol type. + Write the character symbol attributes to the map. + 2011-04-20 Raimund Renkert <raimund.renkert@intevation.de> * src/java/de/intevation/mxd/reader/CharacterMarkerSymbolReader.java:
--- a/src/java/de/intevation/mxd/writer/MapScriptWriter.java Wed Apr 20 11:48:46 2011 +0200 +++ b/src/java/de/intevation/mxd/writer/MapScriptWriter.java Wed Apr 20 11:56:35 2011 +0200 @@ -272,30 +272,67 @@ String symType = symbolElement.getAttribute("style"); if(symType.equals("point")) { - lineObj points = new lineObj(); - points.add(new pointObj(1,1,0)); - sym.setType(MS_SYMBOL_TYPE.MS_SYMBOL_ELLIPSE.swigValue()); - sym.setPoints(points); - sym.setFilled(1); + writePointSymbol(sym, symbolElement); } else if (symType.equals("arrow")) { - double len = Double.parseDouble(symbolElement.getAttribute("length")); - double width = Double.parseDouble(symbolElement.getAttribute("width")); - double ratio = len/width; - lineObj points = new lineObj(); - - points.add(new pointObj(0, 0, 0)); - points.add(new pointObj((1*ratio), 0.5, 0)); - points.add(new pointObj(0, 1, 0)); - points.add(new pointObj(0, 0, 0)); - sym.setType(MS_SYMBOL_TYPE.MS_SYMBOL_VECTOR.swigValue()); - sym.setPoints(points); - sym.setFilled(1); + writeArrowSymbol(sym, symbolElement); + } + else if (symType.equals("char")) { + writeCharSymbol(sym, symbolElement); } } saveSymbolSet(symbolSet); } + + /** + * Write point symbols to the map. + * @param symbol The symbol object. + * @param symbolElement The DOM object containing the attributes. + */ + private void writePointSymbol(symbolObj symbol, Element symbolElement) { + lineObj points = new lineObj(); + points.add(new pointObj(1,1,0)); + symbol.setType(MS_SYMBOL_TYPE.MS_SYMBOL_ELLIPSE.swigValue()); + symbol.setPoints(points); + symbol.setFilled(1); + } + + + /** + * Write arrow symbol to the map. + * @param symbol The symbol object. + * @param symbolElement The DOM object containig the attributes. + */ + private void writeArrowSymbol(symbolObj symbol, Element symbolElement) { + double len = Double.parseDouble(symbolElement.getAttribute("length")); + double width = Double.parseDouble(symbolElement.getAttribute("width")); + double ratio = len/width; + lineObj points = new lineObj(); + + points.add(new pointObj(0, 0, 0)); + points.add(new pointObj((1*ratio), 0.5, 0)); + points.add(new pointObj(0, 1, 0)); + points.add(new pointObj(0, 0, 0)); + symbol.setType(MS_SYMBOL_TYPE.MS_SYMBOL_VECTOR.swigValue()); + symbol.setPoints(points); + symbol.setFilled(1); + } + + + /** + * Write font symbols to the map. + * @param symbol The symbol object. + * @param symbolElement The DOM object containing the attributes. + */ + private void writeCharSymbol(symbolObj symbol, Element symbolElement) { + symbol.setFont(symbolElement.getAttribute("font")); + symbol.setType(MS_SYMBOL_TYPE.MS_SYMBOL_TRUETYPE.swigValue()); + symbol.setAntialias(1); + symbol.setCharacter("#&" + symbolElement.getAttribute("char") + ";"); + } + + /** * Save the symbol set. * @param symbols The symbol set.