rrenkert@243: /*
rrenkert@243:  * Copyright (c) 2011 by Intevation GmbH, Germany <info@intevation.de>
rrenkert@243:  *
rrenkert@243:  * This file is part of MXD2map.
rrenkert@243:  *
rrenkert@243:  * This program is free software under the LGPL (>=v2.1)
rrenkert@243:  * Read the file LICENCE.txt coming with the software for details
rrenkert@243:  * or visit http://www.gnu.org/licenses/ if it does not exist.
rrenkert@243:  *
rrenkert@243:  * MXD2map has been developed on behalf of the
rrenkert@243:  * Bundesamt fuer Seeschifffahrt und Hydrographie (BSH) in Hamburg
rrenkert@243:  * by Intevation GmbH.
rrenkert@243:  *
rrenkert@243:  * Authors:
rrenkert@243:  * Raimund Renkert <raimund.renkert@intevation.de>
rrenkert@243:  * Bjoern Schilberg <bjoern.schilberg@intevation.de>
rrenkert@243:  * Stephan Holl <stephan.holl@intevation.de>
rrenkert@243:  */
rrenkert@243: 
rrenkert@63: package de.intevation.mxd.reader;
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.MultiLayerMarkerSymbol;
rrenkert@63: 
rrenkert@63: import org.w3c.dom.Element;
rrenkert@63: 
rrenkert@63: /**
rrenkert@63:  * Reads marker line symbol information.
rrenkert@63:  *
rrenkert@63:  * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
rrenkert@63:  */
rrenkert@80: public class MarkerLineSymbolReader
rrenkert@80: extends AbstractSymbolReader {
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 MarkerLineSymbol symbol;
rrenkert@63: 
rrenkert@181:     /**
rrenkert@181:      * Constructor with symbol.
rrenkert@181:      *
rrenkert@181:      * @param symbol The symbol used to display lines.
rrenkert@181:      */
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@181:     /**
rrenkert@181:      * Constructor with symbol.
rrenkert@181:      *
rrenkert@181:      * @param symbol The symbol used to display lines.
rrenkert@181:      */
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:      * Reads the symbol attributes.
rrenkert@63:      *
rrenkert@63:      * @return The XML node.
rrenkert@63:      */
rrenkert@115:     public Element read() {
rrenkert@63:         logger.debug("read()");
rrenkert@115:         try {
rrenkert@115:             IMarkerSymbol sym = symbol.getMarkerSymbol();
rrenkert@115:             if(sym instanceof MultiLayerMarkerSymbol) {
rrenkert@115:                 ISymbolReader sreader = new MultiLayerMarkerSymbolReader(sym);
rrenkert@115:                 sreader.setParent(parent);
rrenkert@115:                 sreader.setUtil(util);
rrenkert@115:                 sreader.read();
rrenkert@115:             }
rrenkert@115:             else {
rrenkert@115:                 logger.debug("The type of " + sym.getClass().toString() +
rrenkert@115:                              " is not implemented!");
rrenkert@115:             }
rrenkert@63:         }
rrenkert@115:         catch(Exception e) {
rrenkert@115:             logger.error(
rrenkert@115:                 "Could not read the symbol " +
rrenkert@115:                 symbol.getClass().toString());
rrenkert@63:         }
rrenkert@80:         return parent;
rrenkert@63:     }
rrenkert@63: }
rrenkert@63: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :