Mercurial > mxd2map
comparison src/java/de/intevation/mxd/reader/GdbRasterCatalogLayerReader.java @ 36:472aa36d0e01
Added a new layer reader and symbol reader.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Tue, 12 Apr 2011 14:43:58 +0200 |
parents | |
children | ef7ca23c4233 |
comparison
equal
deleted
inserted
replaced
35:7873682a1a11 | 36:472aa36d0e01 |
---|---|
1 package de.intevation.mxd.reader; | |
2 | |
3 import java.io.IOException; | |
4 | |
5 import org.apache.log4j.Logger; | |
6 | |
7 import com.esri.arcgis.carto.ILayer; | |
8 import com.esri.arcgis.carto.GdbRasterCatalogLayer; | |
9 | |
10 import org.w3c.dom.Element; | |
11 | |
12 import de.intevation.mxd.utils.MapToXMLUtils; | |
13 | |
14 /** | |
15 * Reads Layer information.. | |
16 * | |
17 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> | |
18 */ | |
19 public class GdbRasterCatalogLayerReader implements ILayerReader{ | |
20 | |
21 /** | |
22 * The logger. | |
23 */ | |
24 private static final Logger logger = | |
25 Logger.getLogger(GdbRasterCatalogLayerReader.class); | |
26 | |
27 /** | |
28 * Privte member. | |
29 */ | |
30 private GdbRasterCatalogLayer layer; | |
31 private MapToXMLUtils util; | |
32 | |
33 | |
34 public GdbRasterCatalogLayerReader(ILayer layer) | |
35 throws Exception { | |
36 if(layer instanceof GdbRasterCatalogLayer) | |
37 this.layer = (GdbRasterCatalogLayer)layer; | |
38 else | |
39 throw new Exception("Not an instance of GdbRastaCatalogLayer: " + | |
40 layer.getClass().toString()); | |
41 } | |
42 | |
43 /** | |
44 * Setter for XML document helper. | |
45 * | |
46 * @param util The helper for storing map information. | |
47 */ | |
48 public void setUtil(MapToXMLUtils util){ | |
49 this.util = util; | |
50 } | |
51 | |
52 /** | |
53 * Reads the Layer content. | |
54 * | |
55 * @return The layer XML element. | |
56 */ | |
57 public Element read() | |
58 throws IOException { | |
59 logger.debug("read()"); | |
60 Element layerElement; | |
61 try { | |
62 layerElement = util.addLayer(); | |
63 } | |
64 catch(Exception e) { | |
65 e.printStackTrace(); | |
66 return null; | |
67 } | |
68 | |
69 layerElement.setAttribute("name", layer.getName()); | |
70 layerElement.setAttribute("min_scale", | |
71 String.valueOf(layer.getMinimumScale())); | |
72 layerElement.setAttribute("max_scale", | |
73 String.valueOf(layer.getMaximumScale())); | |
74 if(layer.isVisible()) { | |
75 layerElement.setAttribute("status", "on"); | |
76 } | |
77 else { | |
78 layerElement.setAttribute("status", "off"); | |
79 } | |
80 | |
81 layerElement.setAttribute("definition_query", | |
82 layer.getDefinitionExpression()); | |
83 | |
84 return layerElement; | |
85 } | |
86 } | |
87 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |