view src/java/de/intevation/mxd/reader/MarkerLineSymbolReader.java @ 308:1c949a309940

Wirte offsite values for raster layers
author Andre Heinecke <aheinecke@intevation.de>
date Thu, 06 Sep 2012 18:59:35 +0200
parents df4e0946ef02
children a46adb3697fa
line wrap: on
line source
/*
 * Copyright (c) 2011 by Intevation GmbH, Germany <info@intevation.de>
 *
 * This file is part of MXD2map.
 *
 * This program is free software under the LGPL (>=v2.1)
 * Read the file LICENCE.txt coming with the software for details
 * or visit http://www.gnu.org/licenses/ if it does not exist.
 *
 * MXD2map has been developed on behalf of the
 * Bundesamt fuer Seeschifffahrt und Hydrographie (BSH) in Hamburg
 * by Intevation GmbH.
 *
 * Authors:
 * Raimund Renkert <raimund.renkert@intevation.de>
 * Bjoern Schilberg <bjoern.schilberg@intevation.de>
 * Stephan Holl <stephan.holl@intevation.de>
 */

package de.intevation.mxd.reader;

import org.apache.log4j.Logger;

import com.esri.arcgis.display.ISymbol;
import com.esri.arcgis.display.ILineSymbol;
import com.esri.arcgis.display.IMarkerSymbol;
import com.esri.arcgis.display.MarkerLineSymbol;
import com.esri.arcgis.display.MultiLayerMarkerSymbol;

import org.w3c.dom.Element;

/**
 * Reads marker line symbol information.
 *
 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
 */
public class MarkerLineSymbolReader
extends AbstractSymbolReader {

    /**
     * The logger.
     */
    private static final Logger logger =
        Logger.getLogger(MarkerLineSymbolReader.class);

    /**
     * Private member.
     */
    private MarkerLineSymbol symbol;

    /**
     * Constructor with symbol.
     *
     * @param symbol The symbol used to display lines.
     */
    public MarkerLineSymbolReader(ISymbol symbol)
    throws Exception {
        logger.debug("contructor()");
        if(symbol instanceof MarkerLineSymbol) {
            this.symbol = (MarkerLineSymbol)symbol;
        }
        else {
            throw new Exception("Not a MarkerLineSymbol!");
        }
    }

    /**
     * Constructor with symbol.
     *
     * @param symbol The symbol used to display lines.
     */
    public MarkerLineSymbolReader(ILineSymbol symbol)
    throws Exception {
        logger.debug("contructor()");
        if(symbol instanceof MarkerLineSymbol) {
            this.symbol = (MarkerLineSymbol)symbol;
        }
        else {
            throw new Exception("Not a MarkerLineSymbol!");
        }
    }

    /**
     * Reads the symbol attributes.
     *
     * @return The XML node.
     */
    public Element read() {
        logger.debug("read()");
        try {
            IMarkerSymbol sym = symbol.getMarkerSymbol();
            if(sym instanceof MultiLayerMarkerSymbol) {
                ISymbolReader sreader = new MultiLayerMarkerSymbolReader(sym);
                sreader.setParent(parent);
                sreader.setUtil(util);
                sreader.read();
            }
            else {
                logger.debug("The type of " + sym.getClass().toString() +
                             " is not implemented!");
            }
        }
        catch(Exception e) {
            logger.error(
                "Could not read the symbol " +
                symbol.getClass().toString());
        }
        return parent;
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)