Mercurial > mxd2map
annotate src/java/de/intevation/mxd/reader/GdbRasterCatalogLayerReader.java @ 278:c023b4978663
Reworked the dir-layout to fit the need of the NSIS-installer;
added the missing RunExample.bat-file to the repo
author | Stephan Holl <stephan.holl@intevation.de> |
---|---|
date | Thu, 06 Oct 2011 13:27:40 +0200 |
parents | eae3fe89e669 |
children |
rev | line source |
---|---|
243
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
1 /* |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
2 * Copyright (c) 2011 by Intevation GmbH, Germany <info@intevation.de> |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
3 * |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
4 * This file is part of MXD2map. |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
5 * |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
6 * This program is free software under the LGPL (>=v2.1) |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
7 * Read the file LICENCE.txt coming with the software for details |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
8 * or visit http://www.gnu.org/licenses/ if it does not exist. |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
9 * |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
10 * MXD2map has been developed on behalf of the |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
11 * Bundesamt fuer Seeschifffahrt und Hydrographie (BSH) in Hamburg |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
12 * by Intevation GmbH. |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
13 * |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
14 * Authors: |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
15 * Raimund Renkert <raimund.renkert@intevation.de> |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
16 * Bjoern Schilberg <bjoern.schilberg@intevation.de> |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
17 * Stephan Holl <stephan.holl@intevation.de> |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
18 */ |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
19 |
36
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
20 package de.intevation.mxd.reader; |
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 import org.apache.log4j.Logger; |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
23 |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
24 import com.esri.arcgis.carto.ILayer; |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
25 import com.esri.arcgis.carto.GdbRasterCatalogLayer; |
252
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
26 import com.esri.arcgis.system.IPropertySet; |
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
27 import com.esri.arcgis.geodatabase.IWorkspace; |
36
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 import org.w3c.dom.Element; |
117
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
30 import java.io.IOException; |
36
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
31 import de.intevation.mxd.utils.MapToXMLUtils; |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
32 |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
33 /** |
43
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
36
diff
changeset
|
34 * Reads Layer information. |
36
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
35 * |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
36 * @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
|
37 */ |
43
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
36
diff
changeset
|
38 public class GdbRasterCatalogLayerReader |
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
36
diff
changeset
|
39 implements ILayerReader { |
36
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
40 |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
41 /** |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
42 * The logger. |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
43 */ |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
44 private static final Logger logger = |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
45 Logger.getLogger(GdbRasterCatalogLayerReader.class); |
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 /** |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
48 * Privte member. |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
49 */ |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
50 private GdbRasterCatalogLayer layer; |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
51 private MapToXMLUtils util; |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
52 |
181 | 53 /** |
54 * Constructor with layer. | |
55 * | |
56 * @param layer The ArcGIS layer object. | |
57 */ | |
36
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
58 public GdbRasterCatalogLayerReader(ILayer layer) |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
59 throws Exception { |
43
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
36
diff
changeset
|
60 if(layer instanceof GdbRasterCatalogLayer) { |
36
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
61 this.layer = (GdbRasterCatalogLayer)layer; |
43
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
36
diff
changeset
|
62 } |
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
36
diff
changeset
|
63 else { |
36
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
64 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
|
65 layer.getClass().toString()); |
43
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
36
diff
changeset
|
66 } |
36
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
67 } |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
68 |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
69 /** |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
70 * Setter for XML document helper. |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
71 * |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
72 * @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
|
73 */ |
43
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
36
diff
changeset
|
74 public void setUtil(MapToXMLUtils util) { |
36
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
75 this.util = util; |
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 |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
78 /** |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
79 * Reads the Layer content. |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
80 * |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
81 * @return The layer XML element. |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
82 */ |
118
39957898c694
Improved top level exception handling and logging.
Raimund Renkert <rrenkert@intevation.de>
parents:
117
diff
changeset
|
83 public Element read() |
39957898c694
Improved top level exception handling and logging.
Raimund Renkert <rrenkert@intevation.de>
parents:
117
diff
changeset
|
84 throws IOException { |
36
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
85 logger.debug("read()"); |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
86 |
117
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
87 Element layerElement; |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
88 try { |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
89 layerElement = util.addLayer(); |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
90 } |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
91 catch(Exception e) { |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
92 logger.error( |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
93 "Could not create DOM element for layer." + |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
94 "Stopped reading layer."); |
118
39957898c694
Improved top level exception handling and logging.
Raimund Renkert <rrenkert@intevation.de>
parents:
117
diff
changeset
|
95 throw new IOException( |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
118
diff
changeset
|
96 this.getClass().toString() + |
118
39957898c694
Improved top level exception handling and logging.
Raimund Renkert <rrenkert@intevation.de>
parents:
117
diff
changeset
|
97 "Error creating dom element"); |
117
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
98 } |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
99 |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
100 try { |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
101 layerElement.setAttribute("name", layer.getName()); |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
102 } |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
103 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
118
diff
changeset
|
104 logger.warn("Could not read layer name. Stopped reading layer."); |
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
118
diff
changeset
|
105 throw new IOException("Error reading layer name."); |
117
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
106 } |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
107 |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
108 try { |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
109 layerElement.setAttribute("min_scale", |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
110 String.valueOf(layer.getMinimumScale())); |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
111 } |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
112 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
118
diff
changeset
|
113 logger.warn("Could not read minimum layer scale."); |
117
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
114 } |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
115 |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
116 try { |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
117 layerElement.setAttribute("max_scale", |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
118 String.valueOf(layer.getMaximumScale())); |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
119 } |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
120 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
118
diff
changeset
|
121 logger.warn("Could not read maximum layer scale."); |
117
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
122 } |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
123 |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
124 try { |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
125 if(layer.isVisible()) { |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
126 layerElement.setAttribute("status", "on"); |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
127 } |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
128 else { |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
129 layerElement.setAttribute("status", "off"); |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
130 } |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
131 } |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
132 catch(IOException ioe) { |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
133 logger.warn( |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
134 "Could not read layer status." + |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
135 " Setting layer status to \"on\""); |
36
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
136 layerElement.setAttribute("status", "on"); |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
137 } |
117
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
138 |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
139 try { |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
140 layerElement.setAttribute("definition_query", |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
141 layer.getDefinitionExpression()); |
36
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
142 } |
117
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
143 catch(IOException ioe) { |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
144 logger.warn( |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
118
diff
changeset
|
145 "Could not read layer definition query."); |
117
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
146 } |
252
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
147 |
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
148 try { |
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
149 layerElement.setAttribute("type", "raster"); |
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
150 IWorkspace rw = layer.getWorkspace(); |
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
151 layerElement.setAttribute( |
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
152 "dataset", |
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
153 rw.getDatasetNames(16).next().getName()); |
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
154 IPropertySet set = rw.getConnectionProperties(); |
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
155 Object names[] = new Object[set.getCount()]; |
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
156 Object prop[] = new Object[set.getCount()]; |
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
157 set.getAllProperties(names, prop); |
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
158 layerElement.setAttribute("connection_type", "SDE"); |
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
159 for(int i = 0; i < names.length; i++) { |
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
160 if(names[i] != null) { |
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
161 String[] prop_names = (String[])names[i]; |
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
162 for(int j = 0; j < prop_names.length; j++) { |
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
163 layerElement.setAttribute( |
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
164 prop_names[j].toLowerCase(), |
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
165 set.getProperty(prop_names[j]).toString()); |
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
166 } |
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
167 } |
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
168 } |
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
169 } |
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
170 catch(Exception e) { |
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
171 e.printStackTrace(); |
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
172 logger.error( |
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
173 "Could not read layer datasource." + |
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
174 " Stopped reading layer " + layer.getName() + "."); |
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
175 util.removeLayer(layerElement); |
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
176 return null; |
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
177 } |
eae3fe89e669
Added raster layer support.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
178 |
36
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
179 return layerElement; |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
180 } |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
181 } |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
182 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |