Mercurial > mxd2map
diff src/java/de/intevation/mxd/writer/SymbolWriter.java @ 181:0bde090506f9
Added comments.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Mon, 11 Jul 2011 14:28:38 +0200 |
parents | d95dbd643add |
children | c79c3c6fc99a |
line wrap: on
line diff
--- a/src/java/de/intevation/mxd/writer/SymbolWriter.java Mon Jul 11 12:11:08 2011 +0200 +++ b/src/java/de/intevation/mxd/writer/SymbolWriter.java Mon Jul 11 14:28:38 2011 +0200 @@ -27,9 +27,18 @@ */ private static final Logger logger = Logger.getLogger(SymbolWriter.class); + /** + * Private member. + */ private mapObj map; private classObj cl; + /** + * Contructor with map object and class object. + * + * @param map The map object. + * @param cl The class object containing the style. + */ public SymbolWriter (mapObj map, classObj cl) { this.map = map; this.cl = cl; @@ -37,6 +46,9 @@ /** * Write the content. + * + * @param symbolElement DOM element containg the style and symbol + * attributes. */ public boolean write(Element symbolElement) { logger.debug("write(Element)"); @@ -85,6 +97,11 @@ return true; } + /** + * Create a simple point symbol. + * + * @param symbol The symbol object. + */ private void writeSimple(symbolObj symbol) { logger.debug("writeSimple(symbolObj)"); lineObj points = new lineObj(); @@ -94,6 +111,12 @@ symbol.setFilled(1); } + /** + * Create an arrow symbol. + * + * @param symbol The symbol object. + * @param symbolElement DOM element containing symbol attributes. + */ private void writeArrow(symbolObj symbol, Element symbolElement) { logger.debug("writeArrow(symbolObj, Element)"); double len = 0; @@ -120,9 +143,14 @@ symbol.setFilled(1); } + /** + * Create a character marker symbol. + * + * @param symbol The symbol object. + * @param symbolElement DOM element containing symbol attributes. + */ private void writeCharacter(symbolObj symbol, Element symbolElement) { logger.debug("writeCharacter(symbolObj, Element)"); - //TODO Write the symbol correctly. See Issue 3885 on trac.osgeo.org String font = symbolElement.getAttribute("font"); //Remove all blank character to match the mapserver fonts.txt. font = font.replaceAll(" ", ""); @@ -133,11 +161,21 @@ symbol.setCharacter("&#" + symbolElement.getAttribute("char") + ";"); } + /** + * Create a hatch symbol for polygon fill. + * + * @param symbol The symbol object. + */ private void writeHatch(symbolObj symbol) { logger.debug("writeHatch(symbolObj)"); symbol.setType(MS_SYMBOL_TYPE.MS_SYMBOL_HATCH.swigValue()); } + /** + * Determine whether this writer can create the symbol. + * + * @param type The symbol type. + */ public boolean canWrite(String type) { if (type.equals("point") || type.equals("arrow") || @@ -150,6 +188,11 @@ } } + /** + * Save the symbol set. + * + * @param symbols The symbol set object. + */ private void saveSymbolSet(symbolSetObj symbols) throws Exception { String path = this.map.getMappath(); @@ -178,6 +221,13 @@ this.map.setSymbolSet(symbolPath); } + /** + * Determine whether the symbol exists. + * + * @param elem DOM element containing the symbol attributes. + * + * @return Returns the symbol index if the symbol exists, else returns -1. + */ private int symbolExists (Element elem) { symbolSetObj symbolSet = map.getSymbolset(); for (int i = 0; i < symbolSet.getNumsymbols(); i++) {