rrenkert@63: package de.intevation.mxd.reader; rrenkert@63: rrenkert@63: import java.io.IOException; rrenkert@63: rrenkert@63: import java.awt.Color; rrenkert@63: rrenkert@63: import org.apache.log4j.Logger; rrenkert@63: rrenkert@63: import com.esri.arcgis.display.ISymbol; rrenkert@67: import com.esri.arcgis.display.ILineSymbol; rrenkert@63: import com.esri.arcgis.display.IMarkerSymbol; rrenkert@63: import com.esri.arcgis.display.MarkerLineSymbol; rrenkert@63: import com.esri.arcgis.display.esriSimpleLineStyle; rrenkert@63: import com.esri.arcgis.display.MultiLayerMarkerSymbol; rrenkert@63: import com.esri.arcgis.display.IRgbColor; rrenkert@63: import com.esri.arcgis.display.RgbColor; rrenkert@63: rrenkert@63: import org.w3c.dom.Element; rrenkert@63: import de.intevation.mxd.utils.MapToXMLUtils; rrenkert@63: rrenkert@63: /** rrenkert@63: * Reads marker line symbol information. rrenkert@63: * rrenkert@63: * @author Raimund Renkert rrenkert@63: */ rrenkert@63: public class MarkerLineSymbolReader implements ISymbolReader{ rrenkert@63: rrenkert@63: /** rrenkert@63: * The logger. rrenkert@63: */ rrenkert@63: private static final Logger logger = rrenkert@63: Logger.getLogger(MarkerLineSymbolReader.class); rrenkert@63: rrenkert@63: /** rrenkert@63: * Private member. rrenkert@63: */ rrenkert@63: private Element renderer; rrenkert@63: private MarkerLineSymbol symbol; rrenkert@63: private MapToXMLUtils util; rrenkert@63: rrenkert@63: rrenkert@63: public MarkerLineSymbolReader(ISymbol symbol) rrenkert@63: throws Exception { rrenkert@63: logger.debug("contructor()"); rrenkert@63: if(symbol instanceof MarkerLineSymbol) { rrenkert@63: this.symbol = (MarkerLineSymbol)symbol; rrenkert@63: } rrenkert@63: else { rrenkert@63: throw new Exception("Not a MarkerLineSymbol!"); rrenkert@63: } rrenkert@63: } rrenkert@63: rrenkert@67: rrenkert@67: public MarkerLineSymbolReader(ILineSymbol symbol) rrenkert@67: throws Exception { rrenkert@67: logger.debug("contructor()"); rrenkert@67: if(symbol instanceof MarkerLineSymbol) { rrenkert@67: this.symbol = (MarkerLineSymbol)symbol; rrenkert@67: } rrenkert@67: else { rrenkert@67: throw new Exception("Not a MarkerLineSymbol!"); rrenkert@67: } rrenkert@67: } rrenkert@67: rrenkert@63: /** rrenkert@63: * Setter for the parent XML element. rrenkert@63: * rrenkert@63: * @param parent The XML parent node. rrenkert@63: */ rrenkert@63: public void setParent(Element parent) { rrenkert@63: this.renderer = parent; rrenkert@63: } rrenkert@63: rrenkert@63: /** rrenkert@63: * Setter for XML document helper. rrenkert@63: * rrenkert@63: * @param util The helper class for storing map information. rrenkert@63: */ rrenkert@63: public void setUtil(MapToXMLUtils util) { rrenkert@63: this.util = util; rrenkert@63: } rrenkert@63: rrenkert@63: /** rrenkert@63: * Reads the symbol attributes. rrenkert@63: * rrenkert@63: * @return The XML node. rrenkert@63: */ rrenkert@63: public Element read() rrenkert@63: throws IOException { rrenkert@63: logger.debug("read()"); rrenkert@63: try { rrenkert@63: IMarkerSymbol sym = symbol.getMarkerSymbol(); rrenkert@63: if(sym instanceof MultiLayerMarkerSymbol) { rrenkert@63: ISymbolReader sreader = new MultiLayerMarkerSymbolReader(sym); rrenkert@63: sreader.setParent(renderer); rrenkert@63: sreader.setUtil(util); rrenkert@63: sreader.read(); rrenkert@63: } rrenkert@63: else { rrenkert@63: logger.debug("The type of " + sym.getClass().toString() + rrenkert@63: " is not implemented!"); rrenkert@63: System.out.println( rrenkert@63: "No known instance: " + sym.getClass().toString()); rrenkert@63: } rrenkert@63: } rrenkert@63: catch (Exception e) { rrenkert@63: e.printStackTrace(); rrenkert@63: } rrenkert@63: return renderer; rrenkert@63: } rrenkert@63: } rrenkert@63: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :