Mercurial > mxd2map
view src/java/de/intevation/mxd/reader/LineSymbolReader.java @ 329:e4a389935147
Update Website for 1.1 release
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Mon, 15 Oct 2012 13:14:31 +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 java.lang.Exception; import org.w3c.dom.Element; import org.apache.log4j.Logger; import com.esri.arcgis.display.ISymbol; import com.esri.arcgis.display.ILineSymbol; import com.esri.arcgis.display.MultiLayerLineSymbol; import com.esri.arcgis.display.SimpleLineSymbol; import com.esri.arcgis.display.MarkerLineSymbol; import com.esri.arcgis.display.PictureLineSymbol; import com.esri.arcgis.display.CartographicLineSymbol; import com.esri.arcgis.display.HashLineSymbol; /** * Wrapper for line symbol reader. * * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> */ public class LineSymbolReader extends AbstractSymbolReader { /** * The logger. */ private static final Logger logger = Logger.getLogger(LineSymbolReader.class); /** * Private member. */ private ISymbol symbol; private ILineSymbol lineSymbol; /** * Default constructor. */ public LineSymbolReader() throws Exception{ logger.debug("contructor()"); this.symbol = null; this.lineSymbol = null; } /** * Constructor with symbol. * * @param symbol The symbol used to display lines. */ public LineSymbolReader(ISymbol symbol) throws Exception { logger.debug("contructor(ISymbol)"); this.symbol = symbol; this.lineSymbol = null; } /** * Constructor with symbol. * * @param symbol The symbol used to display lines. */ public LineSymbolReader(ILineSymbol symbol) throws Exception{ logger.debug("contructor(ILineSymbol)"); this.lineSymbol = symbol; this.symbol= null; } /** * Read the symbo attributes. * * @return DOM element containing the symbol attributes. */ public Element read() { ISymbolReader sreader = null; if(symbol != null) { try { if(symbol instanceof SimpleLineSymbol) { sreader = new SimpleLineSymbolReader(symbol); } else if(symbol instanceof MarkerLineSymbol) { sreader = new MarkerLineSymbolReader(symbol); } else if(symbol instanceof PictureLineSymbol) { sreader = new PictureLineSymbolReader(symbol); } else if(symbol instanceof MultiLayerLineSymbol) { sreader = new MultiLayerLineSymbolReader(symbol); } else if(symbol instanceof CartographicLineSymbol) { sreader = new CartoLineSymbolReader(symbol); } else if(symbol instanceof HashLineSymbol) { sreader = new HashLineSymbolReader(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(lineSymbol != null) { try { if(lineSymbol instanceof SimpleLineSymbol) { sreader = new SimpleLineSymbolReader(lineSymbol); } else if(lineSymbol instanceof MarkerLineSymbol) { sreader = new MarkerLineSymbolReader(lineSymbol); } else if(lineSymbol instanceof PictureLineSymbol) { sreader = new PictureLineSymbolReader(lineSymbol); } else if(lineSymbol instanceof MultiLayerLineSymbol) { sreader = new MultiLayerLineSymbolReader(lineSymbol); } else if(lineSymbol instanceof CartographicLineSymbol) { sreader = new CartoLineSymbolReader(lineSymbol); } else if(lineSymbol instanceof HashLineSymbol) { sreader = new HashLineSymbolReader(lineSymbol); } else { logger.debug("The reader for type " + lineSymbol.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 points. */ public void setSymbol(ISymbol sym) { this.symbol = sym; this.lineSymbol = null; } /** * Sets the symbol to read. * * @param sym The symbol used to display points. */ public void setSymbol(ILineSymbol sym) { this.lineSymbol = sym; this.symbol = null; } /** * Determine whether this reader can be used to read the symbol. * * @param sym The ArcGIS symbol. */ public boolean canRead(ISymbol sym) { if(sym instanceof SimpleLineSymbol || sym instanceof MarkerLineSymbol || sym instanceof PictureLineSymbol || sym instanceof MultiLayerLineSymbol || sym instanceof CartographicLineSymbol || sym instanceof HashLineSymbol) { return true; } else { return false; } } /** * Determine whether this reader can be used to read the symbol. * * @param sym The ArcGIS symbol. */ public boolean canRead(ILineSymbol sym) { if(sym instanceof SimpleLineSymbol || sym instanceof MarkerLineSymbol || sym instanceof PictureLineSymbol || sym instanceof MultiLayerLineSymbol || sym instanceof CartographicLineSymbol || sym instanceof HashLineSymbol) { return true; } else { return false; } } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :