annotate src/java/de/intevation/mxd/reader/GdbRasterCatalogLayerReader.java @ 81:18814ae6d92d

Merged with Stephans commits.
author Raimund Renkert <rrenkert@intevation.de>
date Fri, 27 May 2011 13:25:58 +0200
parents 7eba97e8201b
children 59e06c405a9a
rev   line source
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
1 package de.intevation.mxd.reader;
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
2
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
3 import java.io.IOException;
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
4
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
5 import org.apache.log4j.Logger;
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
6
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
7 import com.esri.arcgis.carto.ILayer;
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
8 import com.esri.arcgis.carto.GdbRasterCatalogLayer;
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
9
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
10 import org.w3c.dom.Element;
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
11
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
12 import de.intevation.mxd.utils.MapToXMLUtils;
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
13
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
14 /**
43
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 36
diff changeset
15 * Reads Layer information.
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
16 *
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
17 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
18 */
43
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 36
diff changeset
19 public class GdbRasterCatalogLayerReader
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 36
diff changeset
20 implements ILayerReader {
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
21
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
22 /**
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
23 * The logger.
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
24 */
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
25 private static final Logger logger =
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26 Logger.getLogger(GdbRasterCatalogLayerReader.class);
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
27
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28 /**
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29 * Privte member.
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
30 */
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31 private GdbRasterCatalogLayer layer;
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
32 private MapToXMLUtils util;
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
35 public GdbRasterCatalogLayerReader(ILayer layer)
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
36 throws Exception {
43
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 36
diff changeset
37 if(layer instanceof GdbRasterCatalogLayer) {
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
38 this.layer = (GdbRasterCatalogLayer)layer;
43
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 36
diff changeset
39 }
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 36
diff changeset
40 else {
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
41 throw new Exception("Not an instance of GdbRastaCatalogLayer: " +
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
42 layer.getClass().toString());
43
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 36
diff changeset
43 }
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
44 }
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
45
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
46 /**
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
47 * Setter for XML document helper.
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
48 *
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
49 * @param util The helper for storing map information.
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
50 */
43
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 36
diff changeset
51 public void setUtil(MapToXMLUtils util) {
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
52 this.util = util;
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
53 }
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
54
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
55 /**
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
56 * Reads the Layer content.
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
57 *
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
58 * @return The layer XML element.
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
59 */
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
60 public Element read()
74
7eba97e8201b Catch all exceptions in the MXDReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
61 throws Exception {
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
62 logger.debug("read()");
74
7eba97e8201b Catch all exceptions in the MXDReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
63 Element layerElement = util.addLayer();
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
64
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
65 layerElement.setAttribute("name", layer.getName());
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
66 layerElement.setAttribute("min_scale",
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
67 String.valueOf(layer.getMinimumScale()));
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
68 layerElement.setAttribute("max_scale",
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
69 String.valueOf(layer.getMaximumScale()));
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
70 if(layer.isVisible()) {
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
71 layerElement.setAttribute("status", "on");
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
72 }
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
73 else {
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
74 layerElement.setAttribute("status", "off");
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
75 }
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
76
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
77 layerElement.setAttribute("definition_query",
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
78 layer.getDefinitionExpression());
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
79
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
80 return layerElement;
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
81 }
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
82 }
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
83 // 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)