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