Mercurial > mxd2map
view src/java/de/intevation/mxd/reader/GdbRasterCatalogLayerReader.java @ 188:43f1cbdcd597
Modified and beautified the documentation:
* INSTALL.txt, doku/Makefile, doku/source/conf.py,
doku/source/functionality.txt, doku/source/index.txt,
doku/source/restrictions.txt, website/favicon.png, LICENCE.txt:
added more details to the content of the documentation. some more
configurations.
* doku/source/LICENCE.txt: New. Added a licence-text (symlinking
into the documentation).
* doku/source/_static/favicon.png,
doku/source/_static/logo_wide.png,
doku/source/_templates/indexsidebar.html,
doku/source/_templates/layout.html: Optic-cosmetics.
author | Stephan Holl <stephan.holl@intevation.de> |
---|---|
date | Wed, 20 Jul 2011 15:53:01 +0200 |
parents | 0bde090506f9 |
children | df4e0946ef02 |
line wrap: on
line source
package de.intevation.mxd.reader; import org.apache.log4j.Logger; import com.esri.arcgis.carto.ILayer; import com.esri.arcgis.carto.GdbRasterCatalogLayer; import org.w3c.dom.Element; import java.io.IOException; import de.intevation.mxd.utils.MapToXMLUtils; /** * Reads Layer information. * * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> */ public class GdbRasterCatalogLayerReader implements ILayerReader { /** * The logger. */ private static final Logger logger = Logger.getLogger(GdbRasterCatalogLayerReader.class); /** * Privte member. */ private GdbRasterCatalogLayer layer; private MapToXMLUtils util; /** * Constructor with layer. * * @param layer The ArcGIS layer object. */ public GdbRasterCatalogLayerReader(ILayer layer) throws Exception { if(layer instanceof GdbRasterCatalogLayer) { this.layer = (GdbRasterCatalogLayer)layer; } else { throw new Exception("Not an instance of GdbRastaCatalogLayer: " + layer.getClass().toString()); } } /** * Setter for XML document helper. * * @param util The helper for storing map information. */ public void setUtil(MapToXMLUtils util) { this.util = util; } /** * Reads the Layer content. * * @return The layer XML element. */ public Element read() throws IOException { logger.debug("read()"); Element layerElement; try { layerElement = util.addLayer(); } catch(Exception e) { logger.error( "Could not create DOM element for layer." + "Stopped reading layer."); throw new IOException( this.getClass().toString() + "Error creating dom element"); } try { layerElement.setAttribute("name", layer.getName()); } catch(IOException ioe) { logger.warn("Could not read layer name. Stopped reading layer."); throw new IOException("Error reading layer name."); } try { layerElement.setAttribute("min_scale", String.valueOf(layer.getMinimumScale())); } catch(IOException ioe) { logger.warn("Could not read minimum layer scale."); } try { layerElement.setAttribute("max_scale", String.valueOf(layer.getMaximumScale())); } catch(IOException ioe) { logger.warn("Could not read maximum layer scale."); } try { if(layer.isVisible()) { layerElement.setAttribute("status", "on"); } else { layerElement.setAttribute("status", "off"); } } catch(IOException ioe) { logger.warn( "Could not read layer status." + " Setting layer status to \"on\""); layerElement.setAttribute("status", "on"); } try { layerElement.setAttribute("definition_query", layer.getDefinitionExpression()); } catch(IOException ioe) { logger.warn( "Could not read layer definition query."); } return layerElement; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :