Mercurial > mxd2map
view src/java/de/intevation/mxd/reader/FillSymbolReader.java @ 262:2cb2f26d0d54
Removed needless imports.
author | raimund renkert <raimund.renkert@intevation.de> |
---|---|
date | Tue, 16 Aug 2011 17:15:35 +0200 |
parents | 10e0aa283217 |
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 java.lang.Exception; import org.w3c.dom.Element; import org.apache.log4j.Logger; import com.esri.arcgis.display.ISymbol; import com.esri.arcgis.display.IFillSymbol; import com.esri.arcgis.display.MultiLayerFillSymbol; import com.esri.arcgis.display.SimpleFillSymbol; import com.esri.arcgis.display.MarkerFillSymbol; import com.esri.arcgis.display.LineFillSymbol; import com.esri.arcgis.display.PictureFillSymbol; /** * Wrapper for fill symbol reader. * * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> */ public class FillSymbolReader extends AbstractSymbolReader { /** * The logger. */ private static final Logger logger = Logger.getLogger(FillSymbolReader.class); /** * Private member. */ private ISymbol symbol; private IFillSymbol fillSymbol; /** * Default constructor. */ public FillSymbolReader() throws Exception { logger.debug("contructor()"); this.symbol = null; this.fillSymbol = null; } /** * Constructor with symbol. * * @param symbol The symbol used to display polygons. */ public FillSymbolReader(ISymbol symbol) throws Exception { logger.debug("contructor(ISymbol)"); this.symbol = symbol; this.fillSymbol = null; } /** * Constructor with symbol. * * @param symbol The symbol used to display polygons. */ public FillSymbolReader(IFillSymbol symbol) throws Exception { logger.debug("contructor(ILineSymbol)"); this.fillSymbol = symbol; this.symbol= null; } /** * Read the symbol attributes. * * @return DOM element containing the symbol attributes. */ public Element read() { ISymbolReader sreader = null; if(symbol != null) { try { if(symbol instanceof SimpleFillSymbol) { sreader = new SimpleFillSymbolReader(symbol); } else if(symbol instanceof MultiLayerFillSymbol) { sreader = new MultiLayerFillSymbolReader(symbol); } else if(symbol instanceof MarkerFillSymbol) { sreader = new MarkerFillSymbolReader(symbol); } else if(symbol instanceof LineFillSymbol) { sreader = new LineFillSymbolReader(symbol); } else if(symbol instanceof PictureFillSymbol) { sreader = new PictureFillSymbolReader(symbol); } else { logger.debug("The reader for type " + symbol.getClass().toString() + " is not implemented!"); return parent; } } catch(Exception e) { logger.error( "Could not read the symbol " + symbol.getClass().toString()); return parent; } } else if(fillSymbol != null) { try { if(fillSymbol instanceof SimpleFillSymbol) { sreader = new SimpleFillSymbolReader(fillSymbol); } else if(fillSymbol instanceof MultiLayerFillSymbol) { sreader = new MultiLayerFillSymbolReader(fillSymbol); } else if(fillSymbol instanceof MarkerFillSymbol) { sreader = new MarkerFillSymbolReader(fillSymbol); } else if(fillSymbol instanceof LineFillSymbol) { sreader = new LineFillSymbolReader(fillSymbol); } else if(fillSymbol instanceof PictureFillSymbol) { sreader = new PictureFillSymbolReader(fillSymbol); } else { logger.debug("The reader for type " + fillSymbol.getClass().toString() + " is not implemented!"); return parent; } } catch(Exception e) { logger.error( "Could not read the symbol " + symbol.getClass().toString()); return parent; } } else { return parent; } if (sreader != null) { sreader.setParent(parent); sreader.setUtil(util); sreader.read(); } return parent; } /** * Sets the symbol to read. * * @param sym The symbol used to display polygons. */ public void setSymbol(ISymbol sym) { this.symbol = sym; this.fillSymbol = null; } /** * Sets the symbol to read. * * @param sym The symbol used to display polygons. */ public void setSymbol(IFillSymbol sym) { this.symbol = null; this.fillSymbol = sym; } /** * Determine whether this reader can be used to read the symbol. * * @param sym The ArcGIS symbol. */ public boolean canRead(ISymbol sym) { if(sym instanceof SimpleFillSymbol || sym instanceof MarkerFillSymbol || sym instanceof MultiLayerFillSymbol || sym instanceof LineFillSymbol || sym instanceof PictureFillSymbol) { return true; } else { return false; } } /** * Determine whether this reader can be used to read the symbol. * * @param sym The ArcGIS symbol. */ public boolean canRead(IFillSymbol sym) { if(sym instanceof SimpleFillSymbol || sym instanceof MarkerFillSymbol || sym instanceof MultiLayerFillSymbol || sym instanceof LineFillSymbol || sym instanceof PictureFillSymbol) { return true; } else { return false; } } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :