rrenkert@47: package de.intevation.mxd.reader; rrenkert@47: rrenkert@47: import org.apache.log4j.Logger; rrenkert@47: rrenkert@47: import com.esri.arcgis.display.ISymbol; rrenkert@63: import com.esri.arcgis.display.IMarkerSymbol; rrenkert@47: import com.esri.arcgis.display.CharacterMarkerSymbol; rrenkert@47: import com.esri.arcgis.display.IColor; rrenkert@47: import com.esri.arcgis.support.ms.stdole.Font; rrenkert@47: rrenkert@47: import org.w3c.dom.Element; rrenkert@47: rrenkert@47: /** rrenkert@47: * Reads character marker symbol information. rrenkert@47: * rrenkert@47: * @author Raimund Renkert rrenkert@47: */ rrenkert@80: public class CharacterMarkerSymbolReader rrenkert@80: extends AbstractSymbolReader { rrenkert@47: rrenkert@47: /** rrenkert@47: * The logger. rrenkert@47: */ rrenkert@47: private static final Logger logger = rrenkert@47: Logger.getLogger(CharacterMarkerSymbolReader.class); rrenkert@47: rrenkert@47: /** rrenkert@47: * Private member. rrenkert@47: */ rrenkert@47: private CharacterMarkerSymbol symbol; rrenkert@47: rrenkert@47: public CharacterMarkerSymbolReader(ISymbol symbol) rrenkert@47: throws Exception { rrenkert@47: logger.debug("contructor()"); rrenkert@47: if(symbol instanceof CharacterMarkerSymbol) { rrenkert@47: this.symbol = (CharacterMarkerSymbol)symbol; rrenkert@47: } rrenkert@47: else { rrenkert@47: throw new Exception("Not a CharacterMarkerSymbol!"); rrenkert@47: } rrenkert@47: } rrenkert@47: rrenkert@63: public CharacterMarkerSymbolReader(IMarkerSymbol symbol) rrenkert@63: throws Exception { rrenkert@63: logger.debug("contructor()"); rrenkert@63: if(symbol instanceof CharacterMarkerSymbol) { rrenkert@63: this.symbol = (CharacterMarkerSymbol)symbol; rrenkert@63: } rrenkert@63: else { rrenkert@63: throw new Exception("Not a CharacterMarkerSymbol!"); rrenkert@63: } rrenkert@63: } rrenkert@63: rrenkert@47: /** rrenkert@47: * Reads the symbol attributes. rrenkert@47: * rrenkert@47: * @return The XML node. rrenkert@47: */ rrenkert@47: public Element read() rrenkert@74: throws Exception { rrenkert@47: logger.debug("read()"); rrenkert@80: Element symbolElement = util.addSymbol(parent); rrenkert@47: rrenkert@47: IColor c = symbol.getColor(); rrenkert@47: symbolElement.setAttribute( rrenkert@47: "angle", rrenkert@47: String.valueOf(symbol.getAngle())); rrenkert@47: symbolElement.setAttribute( rrenkert@47: "size", rrenkert@47: String.valueOf(symbol.getSize())); rrenkert@47: symbolElement.setAttribute( rrenkert@47: "x_offset", rrenkert@47: String.valueOf(symbol.getXOffset())); rrenkert@47: symbolElement.setAttribute( rrenkert@47: "y_offset", rrenkert@47: String.valueOf(symbol.getYOffset())); rrenkert@47: symbolElement.setAttribute( rrenkert@47: "color", rrenkert@47: String.valueOf(c.getRGB())); rrenkert@47: symbolElement.setAttribute( rrenkert@47: "tranparency", rrenkert@47: String.valueOf(c.getTransparency())); rrenkert@47: symbolElement.setAttribute( rrenkert@47: "name", rrenkert@47: symbol.getNameString()); rrenkert@48: symbolElement.setAttribute( rrenkert@48: "char", rrenkert@48: String.valueOf(symbol.getCharacterIndex())); rrenkert@48: rrenkert@47: Font f = symbol.getFont(); rrenkert@48: symbolElement.setAttribute("font", f.getName()); rrenkert@48: symbolElement.setAttribute("char_set", String.valueOf(f.getCharset())); rrenkert@48: symbolElement.setAttribute("bold", String.valueOf(f.getBold())); rrenkert@48: symbolElement.setAttribute("italic", String.valueOf(f.getItalic())); rrenkert@48: symbolElement.setAttribute("font_size", String.valueOf(f.getSize())); rrenkert@48: symbolElement.setAttribute( rrenkert@48: "strike_through", rrenkert@48: String.valueOf(f.getStrikethrough())); rrenkert@48: symbolElement.setAttribute("weight", String.valueOf(f.getWeight())); rrenkert@47: symbolElement.setAttribute("style", "char"); rrenkert@89: symbolElement.setAttribute("type", "marker"); rrenkert@47: return symbolElement; rrenkert@47: } rrenkert@47: } rrenkert@47: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :